aboutsummaryrefslogtreecommitdiffstats
path: root/onap-client/onap_client/sdc/client.py
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/sdc/client.py
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/sdc/client.py')
-rw-r--r--onap-client/onap_client/sdc/client.py89
1 files changed, 42 insertions, 47 deletions
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,
+ ),
+ },
+ }