From 32409110b65b013bc65930f3cfdef09671cd3a5a Mon Sep 17 00:00:00 2001 From: "stark, steven" Date: Mon, 3 Aug 2020 13:03:24 -0700 Subject: [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 Change-Id: I7b03411d221801fc51b80ee6a73d9491e823da56 --- onap-client/onap_client/sdc/client.py | 89 +++++++++++++++++------------------ 1 file changed, 42 insertions(+), 47 deletions(-) (limited to 'onap-client/onap_client/sdc/client.py') diff --git a/onap-client/onap_client/sdc/client.py b/onap-client/onap_client/sdc/client.py index c1923da..4089c39 100644 --- a/onap-client/onap_client/sdc/client.py +++ b/onap-client/onap_client/sdc/client.py @@ -38,11 +38,9 @@ import uuid from functools import partial -from onap_client import sdc from onap_client.client.clients import Client from onap_client import config -sdc_properties = sdc.SDC_PROPERTIES application_id = config.APPLICATION_ID @@ -53,48 +51,45 @@ class SDCClient(Client): @property def catalog_resources(self): - return CATALOG_RESOURCES - - -CATALOG_RESOURCES = { - "HEALTH_CHECK": { - "verb": "GET", - "description": "Queries SDC health check endpoint", - "uri": partial( - "{endpoint}{service_path}".format, - endpoint=sdc_properties.SDC_HC_ENDPOINT, - service_path=sdc_properties.SDC_HEALTH_CHECK_PATH, - ), - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.SDC_DESIGNER_USER_ID, - sdc_properties.SDC_DESIGNER_PASSWORD, - ), - }, - "GET_RESOURCE_CATEGORIES": { - "verb": "GET", - "description": "Queries SDC for resource categories", - "uri": partial( - "{endpoint}{service_path}".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_RESOURCE_CATEGORIES_PATH, - ), - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, -} + return { + "HEALTH_CHECK": { + "verb": "GET", + "description": "Queries SDC health check endpoint", + "uri": partial( + "{endpoint}{service_path}".format, + endpoint=self.config.sdc.SDC_HC_ENDPOINT, + service_path=self.config.sdc.SDC_HEALTH_CHECK_PATH, + ), + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID, + "X-TransactionId": str(uuid.uuid4()), + "X-FromAppId": application_id, + }, + "auth": ( + self.config.sdc.SDC_DESIGNER_USER_ID, + self.config.sdc.SDC_DESIGNER_PASSWORD, + ), + }, + "GET_RESOURCE_CATEGORIES": { + "verb": "GET", + "description": "Queries SDC for resource categories", + "uri": partial( + "{endpoint}{service_path}".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_RESOURCE_CATEGORIES_PATH, + ), + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID, + }, + "auth": ( + self.config.sdc.GLOBAL_SDC_USERNAME, + self.config.sdc.GLOBAL_SDC_PASSWORD, + ), + }, + } -- cgit 1.2.3-korg