aboutsummaryrefslogtreecommitdiffstats
path: root/onap-client/onap_client/sdnc
diff options
context:
space:
mode:
authorstark, steven <steven.stark@att.com>2020-08-03 13:03:24 -0700
committerstark, steven <steven.stark@att.com>2020-08-03 13:03:24 -0700
commit32409110b65b013bc65930f3cfdef09671cd3a5a (patch)
tree4bb6c95c057cdde0f08af78e7abc53e2be02fad4 /onap-client/onap_client/sdnc
parent9df81b14e7203d6c3911f5f36881cb5170afdccc (diff)
[VVP] ONAP Client enhancements
Output hooks for resources. Outputs for each resource are returned as part of the complete onap-client spec when a resource is created. Hooks have been added for the SDC resources, to return the TOSCA model for each created resource. Dynamic config change. Ability to specify and reconfigure the onap-client configuration file at runtime without restarting the current session. Logging. Logging has been upgraded to create its own logging instance rather than the root logging instance, to avoid collisions. Issue-ID: VVP-455 Signed-off-by: stark, steven <steven.stark@att.com> Change-Id: I7b03411d221801fc51b80ee6a73d9491e823da56
Diffstat (limited to 'onap-client/onap_client/sdnc')
-rw-r--r--onap-client/onap_client/sdnc/__init__.py4
-rw-r--r--onap-client/onap_client/sdnc/catalog/config_catalog.py119
-rw-r--r--onap-client/onap_client/sdnc/catalog/operations_catalog.py85
-rw-r--r--onap-client/onap_client/sdnc/client.py2
-rw-r--r--onap-client/onap_client/sdnc/preload.py3
5 files changed, 97 insertions, 116 deletions
diff --git a/onap-client/onap_client/sdnc/__init__.py b/onap-client/onap_client/sdnc/__init__.py
index eb3184f..5519a84 100644
--- a/onap-client/onap_client/sdnc/__init__.py
+++ b/onap-client/onap_client/sdnc/__init__.py
@@ -34,7 +34,3 @@
# limitations under the License.
#
# ============LICENSE_END============================================
-
-from onap_client.config import APP_CONFIG
-
-SDNC_PROPERTIES = APP_CONFIG.sdnc
diff --git a/onap-client/onap_client/sdnc/catalog/config_catalog.py b/onap-client/onap_client/sdnc/catalog/config_catalog.py
index da3c1cf..18854e8 100644
--- a/onap-client/onap_client/sdnc/catalog/config_catalog.py
+++ b/onap-client/onap_client/sdnc/catalog/config_catalog.py
@@ -38,77 +38,72 @@
import uuid
from functools import partial
-from onap_client import sdnc
from onap_client import config
from onap_client.sdnc.client import SDNCClient
PAYLOADS_DIR = config.PAYLOADS_DIR
-sdnc_properties = sdnc.SDNC_PROPERTIES
application_id = config.APPLICATION_ID
class ConfigClient(SDNCClient):
@property
- def catalog_resources(self):
- return CATALOG_RESOURCES
-
- @property
def namespace(self):
return "config"
-
-CATALOG_RESOURCES = {
- "GET_SERVICE_INSTANCES": {
- "verb": "GET",
- "description": "Get a list of all service instances",
- "uri": partial(
- "{endpoint}{service_path}/GENERIC-RESOURCE-API:services".format,
- endpoint=sdnc_properties.SDNC_ENDPOINT,
- service_path=sdnc_properties.SDNC_CONFIG_PATH,
- ),
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (sdnc_properties.SDNC_USERNAME, sdnc_properties.SDNC_PASSWORD,),
- },
- "GET_SERVICE_INSTANCE": {
- "verb": "GET",
- "description": "Get details for a service instance",
- "uri": partial(
- "{endpoint}{service_path}/GENERIC-RESOURCE-API:services/service/{service_instance_id}".format,
- endpoint=sdnc_properties.SDNC_ENDPOINT,
- service_path=sdnc_properties.SDNC_CONFIG_PATH,
- ),
- "uri-parameters": ["service_instance_id"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (sdnc_properties.SDNC_USERNAME, sdnc_properties.SDNC_PASSWORD,),
- },
- "GET_VNF_INSTANCE": {
- "verb": "GET",
- "description": "Get details for a vnf instance",
- "uri": partial(
- "{endpoint}{service_path}/GENERIC-RESOURCE-API:services/service/{service_instance_id}/service-data/vnfs/vnf/{vnf_instance_id}".format,
- endpoint=sdnc_properties.SDNC_ENDPOINT,
- service_path=sdnc_properties.SDNC_CONFIG_PATH,
- ),
- "uri-parameters": ["service_instance_id", "vnf_instance_id"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (sdnc_properties.SDNC_USERNAME, sdnc_properties.SDNC_PASSWORD,),
- },
-}
+ @property
+ def catalog_resources(self):
+ return {
+ "GET_SERVICE_INSTANCES": {
+ "verb": "GET",
+ "description": "Get a list of all service instances",
+ "uri": partial(
+ "{endpoint}{service_path}/GENERIC-RESOURCE-API:services".format,
+ endpoint=self.config.sdnc.SDNC_ENDPOINT,
+ service_path=self.config.sdnc.SDNC_CONFIG_PATH,
+ ),
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.sdnc.SDNC_USERNAME, self.config.sdnc.SDNC_PASSWORD,),
+ },
+ "GET_SERVICE_INSTANCE": {
+ "verb": "GET",
+ "description": "Get details for a service instance",
+ "uri": partial(
+ "{endpoint}{service_path}/GENERIC-RESOURCE-API:services/service/{service_instance_id}".format,
+ endpoint=self.config.sdnc.SDNC_ENDPOINT,
+ service_path=self.config.sdnc.SDNC_CONFIG_PATH,
+ ),
+ "uri-parameters": ["service_instance_id"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.sdnc.SDNC_USERNAME, self.config.sdnc.SDNC_PASSWORD,),
+ },
+ "GET_VNF_INSTANCE": {
+ "verb": "GET",
+ "description": "Get details for a vnf instance",
+ "uri": partial(
+ "{endpoint}{service_path}/GENERIC-RESOURCE-API:services/service/{service_instance_id}/service-data/vnfs/vnf/{vnf_instance_id}".format,
+ endpoint=self.config.sdnc.SDNC_ENDPOINT,
+ service_path=self.config.sdnc.SDNC_CONFIG_PATH,
+ ),
+ "uri-parameters": ["service_instance_id", "vnf_instance_id"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": 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 12db3a3..2d9662b 100644
--- a/onap-client/onap_client/sdnc/catalog/operations_catalog.py
+++ b/onap-client/onap_client/sdnc/catalog/operations_catalog.py
@@ -38,60 +38,55 @@
import uuid
from functools import partial
-from onap_client import sdnc
from onap_client import config
from onap_client.sdnc.client import SDNCClient
PAYLOADS_DIR = config.PAYLOADS_DIR
-sdnc_properties = sdnc.SDNC_PROPERTIES
application_id = config.APPLICATION_ID
class OperationsClient(SDNCClient):
@property
- def catalog_resources(self):
- return CATALOG_RESOURCES
-
- @property
def namespace(self):
return "operations"
-
-CATALOG_RESOURCES = {
- "GR_API_PRELOAD": {
- "verb": "POST",
- "description": "Upload a GR API preload to SDNC",
- "uri": partial(
- "{endpoint}{service_path}/GENERIC-RESOURCE-API:preload-vf-module-topology-operation".format,
- endpoint=sdnc_properties.SDNC_ENDPOINT,
- service_path=sdnc_properties.SDNC_OPERATIONS_PATH,
- ),
- "payload-path": ["preload_path"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (sdnc_properties.SDNC_USERNAME, sdnc_properties.SDNC_PASSWORD,),
- },
- "VNF_API_PRELOAD": {
- "verb": "POST",
- "description": "Upload a VNF API preload to SDNC",
- "uri": partial(
- "{endpoint}{service_path}/VNF-API:preload-vnf-topology-operation".format,
- endpoint=sdnc_properties.SDNC_ENDPOINT,
- service_path=sdnc_properties.SDNC_OPERATIONS_PATH,
- ),
- "payload-path": ["preload_path"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (sdnc_properties.SDNC_USERNAME, sdnc_properties.SDNC_PASSWORD,),
- },
-}
+ @property
+ def catalog_resources(self):
+ return {
+ "GR_API_PRELOAD": {
+ "verb": "POST",
+ "description": "Upload a GR API preload to SDNC",
+ "uri": partial(
+ "{endpoint}{service_path}/GENERIC-RESOURCE-API:preload-vf-module-topology-operation".format,
+ endpoint=self.config.sdnc.SDNC_ENDPOINT,
+ service_path=self.config.sdnc.SDNC_OPERATIONS_PATH,
+ ),
+ "payload-path": ["preload_path"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.sdnc.SDNC_USERNAME, self.config.sdnc.SDNC_PASSWORD,),
+ },
+ "VNF_API_PRELOAD": {
+ "verb": "POST",
+ "description": "Upload a VNF API preload to SDNC",
+ "uri": partial(
+ "{endpoint}{service_path}/VNF-API:preload-vnf-topology-operation".format,
+ endpoint=self.config.sdnc.SDNC_ENDPOINT,
+ service_path=self.config.sdnc.SDNC_OPERATIONS_PATH,
+ ),
+ "payload-path": ["preload_path"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": 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 c0a3d1b..9f5a495 100644
--- a/onap-client/onap_client/sdnc/client.py
+++ b/onap-client/onap_client/sdnc/client.py
@@ -35,11 +35,9 @@
#
# ============LICENSE_END============================================
-from onap_client import sdnc
from onap_client.client.clients import Client
from onap_client import config
-sdnc_properties = sdnc.SDNC_PROPERTIES
application_id = config.APPLICATION_ID
diff --git a/onap-client/onap_client/sdnc/preload.py b/onap-client/onap_client/sdnc/preload.py
index 8f67feb..5e1ee91 100644
--- a/onap-client/onap_client/sdnc/preload.py
+++ b/onap-client/onap_client/sdnc/preload.py
@@ -42,7 +42,6 @@ from onap_client.resource import Resource
from onap_client.client.clients import Client
from onap_client.exceptions import ServiceInstanceNotFound, VNFInstanceNotFound
from onap_client import so
-from onap_client.config import LOG as logger
class Preload(Resource):
@@ -106,8 +105,6 @@ class Preload(Resource):
module_model.get("groupName"),
)
- logger.info("Created preload {}".format(preload_path))
-
create_preload(preload_path, instance_input.get("api_type"))
return instance_input