diff options
Diffstat (limited to 'onap-client/onap_client/sdnc')
-rw-r--r-- | onap-client/onap_client/sdnc/catalog/config_catalog.py | 13 | ||||
-rw-r--r-- | onap-client/onap_client/sdnc/catalog/operations_catalog.py | 9 | ||||
-rw-r--r-- | onap-client/onap_client/sdnc/client.py | 4 | ||||
-rw-r--r-- | onap-client/onap_client/sdnc/preload.py | 17 |
4 files changed, 15 insertions, 28 deletions
diff --git a/onap-client/onap_client/sdnc/catalog/config_catalog.py b/onap-client/onap_client/sdnc/catalog/config_catalog.py index 18854e8..b3c5b1f 100644 --- a/onap-client/onap_client/sdnc/catalog/config_catalog.py +++ b/onap-client/onap_client/sdnc/catalog/config_catalog.py @@ -34,21 +34,16 @@ # limitations under the License. # # ============LICENSE_END============================================ - import uuid from functools import partial -from onap_client import config from onap_client.sdnc.client import SDNCClient -PAYLOADS_DIR = config.PAYLOADS_DIR -application_id = config.APPLICATION_ID - class ConfigClient(SDNCClient): @property def namespace(self): - return "config" + return "configuration" @property def catalog_resources(self): @@ -66,7 +61,7 @@ class ConfigClient(SDNCClient): "Accept": "application/json", "Content-Type": "application/json", "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, + "X-FromAppId": self.config.application_id, }, "auth": (self.config.sdnc.SDNC_USERNAME, self.config.sdnc.SDNC_PASSWORD,), }, @@ -84,7 +79,7 @@ class ConfigClient(SDNCClient): "Accept": "application/json", "Content-Type": "application/json", "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, + "X-FromAppId": self.config.application_id, }, "auth": (self.config.sdnc.SDNC_USERNAME, self.config.sdnc.SDNC_PASSWORD,), }, @@ -102,7 +97,7 @@ class ConfigClient(SDNCClient): "Accept": "application/json", "Content-Type": "application/json", "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, + "X-FromAppId": self.config.application_id, }, "auth": (self.config.sdnc.SDNC_USERNAME, self.config.sdnc.SDNC_PASSWORD,), }, diff --git a/onap-client/onap_client/sdnc/catalog/operations_catalog.py b/onap-client/onap_client/sdnc/catalog/operations_catalog.py index 2d9662b..79e6f29 100644 --- a/onap-client/onap_client/sdnc/catalog/operations_catalog.py +++ b/onap-client/onap_client/sdnc/catalog/operations_catalog.py @@ -34,16 +34,11 @@ # limitations under the License. # # ============LICENSE_END============================================ - import uuid from functools import partial -from onap_client import config from onap_client.sdnc.client import SDNCClient -PAYLOADS_DIR = config.PAYLOADS_DIR -application_id = config.APPLICATION_ID - class OperationsClient(SDNCClient): @property @@ -67,7 +62,7 @@ class OperationsClient(SDNCClient): "Accept": "application/json", "Content-Type": "application/json", "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, + "X-FromAppId": self.config.application_id, }, "auth": (self.config.sdnc.SDNC_USERNAME, self.config.sdnc.SDNC_PASSWORD,), }, @@ -85,7 +80,7 @@ class OperationsClient(SDNCClient): "Accept": "application/json", "Content-Type": "application/json", "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, + "X-FromAppId": self.config.application_id, }, "auth": (self.config.sdnc.SDNC_USERNAME, self.config.sdnc.SDNC_PASSWORD,), }, diff --git a/onap-client/onap_client/sdnc/client.py b/onap-client/onap_client/sdnc/client.py index 9f5a495..1ebd04a 100644 --- a/onap-client/onap_client/sdnc/client.py +++ b/onap-client/onap_client/sdnc/client.py @@ -34,11 +34,7 @@ # limitations under the License. # # ============LICENSE_END============================================ - from onap_client.client.clients import Client -from onap_client import config - -application_id = config.APPLICATION_ID class SDNCClient(Client): diff --git a/onap-client/onap_client/sdnc/preload.py b/onap-client/onap_client/sdnc/preload.py index 5e1ee91..6fa9c4f 100644 --- a/onap-client/onap_client/sdnc/preload.py +++ b/onap-client/onap_client/sdnc/preload.py @@ -56,8 +56,8 @@ class Preload(Resource): } def _create(self, instance_input): - service_instance = so.vnf_instance.get_service_instance( - instance_input.get("service_instance_name") + service_instance = so.service_instance.get_service_instance( + instance_input.get("service_instance_name"), oc=self.oc ) if not service_instance: raise ServiceInstanceNotFound( @@ -66,7 +66,7 @@ class Preload(Resource): ) ) - vnf_instance = so.vnf_instance.get_vnf_instance( + vnf_instance = so.service_instance.get_vnf_instance( service_instance, instance_input.get("vnf_instance_name") ) if not vnf_instance: @@ -90,9 +90,9 @@ class Preload(Resource): vnf_model_name = vnf_model_information["model-name"] vnf_component = so.vnf_instance.get_vnf_model_component( - service_model_name, vnf_model_name + service_model_name, vnf_model_name, oc=self.oc ) - module_model = so.vnf_instance.get_module_model( + module_model = so.module_instance.get_module_model( vnf_component, instance_input.get("heat_template_name") ) @@ -105,13 +105,14 @@ class Preload(Resource): module_model.get("groupName"), ) - create_preload(preload_path, instance_input.get("api_type")) + create_preload(preload_path, instance_input.get("api_type"), oc=self.oc) return instance_input -def create_preload(preload_path, api_type): - oc = Client() +def create_preload(preload_path, api_type, oc=None): + if not oc: + oc = Client() if api_type == "GR_API": oc.sdnc.operations.gr_api_preload(preload_path=preload_path) |