X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=blobdiff_plain;f=osm_nbi%2Fengine.py;h=19461895c4504b5f93445acc60b2bb85087d548f;hp=ab7eec007a138d942237d8ddf5b08371cf6e1992;hb=870060400cacf0aaa511fca035937544173237f0;hpb=337ec516ed05bece8ef50694d277e55f34ab278e diff --git a/osm_nbi/engine.py b/osm_nbi/engine.py index ab7eec0..1946189 100644 --- a/osm_nbi/engine.py +++ b/osm_nbi/engine.py @@ -153,6 +153,20 @@ class Engine(object): raise EngineException("Unknown topic {}!!!".format(topic), HTTPStatus.INTERNAL_SERVER_ERROR) return self.map_topic[topic].show(session, _id) + def get_file(self, session, topic, _id, path=None, accept_header=None): + """ + Get descriptor package or artifact file content + :param session: contains the used login username and working project + :param topic: it can be: users, projects, vnfds, nsds, + :param _id: server id of the item + :param path: artifact path or "$DESCRIPTOR" or None + :param accept_header: Content of Accept header. Must contain applition/zip or/and text/plain + :return: opened file plus Accept format or raises an exception + """ + if topic not in self.map_topic: + raise EngineException("Unknown topic {}!!!".format(topic), HTTPStatus.INTERNAL_SERVER_ERROR) + return self.map_topic[topic].get_file(session, _id, path, accept_header) + def del_item_list(self, session, topic, _filter=None): """ Delete a list of items