Fix for has to communicate with SDC for Nst-selection enhancements 29/118929/3
authorhariharan97 <rh20085046@wipro.com>
Tue, 9 Mar 2021 05:48:40 +0000 (11:18 +0530)
committerhariharan97 <rh20085046@wipro.com>
Tue, 9 Mar 2021 09:40:59 +0000 (15:10 +0530)
Issue-ID: OPTFRA-928
Signed-off-by: hariharan97 <rh20085046@wipro.com>
Change-Id: I6d661e5482194d1ecd8e583c065ce1e77fa52b80

conductor/conductor/common/sms.py
conductor/conductor/data/plugins/inventory_provider/sdc.py

index 35ca644..49f6411 100644 (file)
 '''Secret Management Service Integration'''
 from conductor.common import config_loader
 from onapsmsclient import Client
-
 from oslo_config import cfg
 from oslo_log import log
-import conductor.data.plugins.inventory_provider.aai
-import conductor.api.controllers.v1.plans
-import conductor.common.music.api
-import conductor.data.plugins.service_controller.sdnc
+
+
 from conductor.common.utils import cipherUtils
 
 LOG = log.getLogger(__name__)
@@ -35,8 +32,8 @@ CONF = cfg.CONF
 
 AAF_SMS_OPTS = [
     cfg.BoolOpt('is_enabled',
-               default=True,
-               help='Is Secret Management service enabled'),
+                default=True,
+                help='Is Secret Management service enabled'),
     cfg.StrOpt('aaf_sms_url',
                default='https://aaf-sms.onap:10443',
                help='Base URL for SMS, up to and not including '
@@ -61,9 +58,12 @@ config_spec = {
 
 
 def preload_secrets():
-    """ This is intended to load the secrets required for testing Application
+    """This is intended to load the secrets required for testing Application
+
         Actual deployment will have a preload script. Make sure the config is
-        in sync"""
+
+        in sync
+        """
     preload_config = config_loader.load_config_file(
         config_spec.get("preload_secrets"))
     domain = preload_config.get("domain")
@@ -113,6 +113,8 @@ def load_secrets():
     config.set_override('username', secret_dict['aaf_api']['username'], 'aaf_api')
     config.set_override('password', decrypt_pass(secret_dict['aaf_api']['password']), 'aaf_api')
     config.set_override('aaf_conductor_user', secret_dict['aaf_api']['aaf_conductor_user'], 'aaf_api')
+    config.set_override('username', secret_dict['sdc']['username'], 'sdc')
+    config.set_override('password', decrypt_pass(secret_dict['sdc']['password']), 'sdc')
 
 
 def decrypt_pass(passwd):
@@ -123,9 +125,12 @@ def decrypt_pass(passwd):
 
 
 def delete_secrets():
-    """ This is intended to delete the secrets for a clean initialization for
+    """This is intended to delete the secrets for a clean initialization for
+
         testing Application. Actual deployment will have a preload script.
-        Make sure the config is in sync"""
+
+        Make sure the config is in sync
+        """
     config = CONF.aaf_sms
     sms_url = config.aaf_sms_url
     timeout = config.aaf_sms_timeout
index 6f3cb4f..c69d7b0 100644 (file)
@@ -57,7 +57,7 @@ SDC_OPTS = [
                default='certificate_key.pem',
                help='Private Certificate Key file in pem format.'),
     cfg.StrOpt('certificate_authority_bundle_file',
-               default='certificate_authority_bundle.pem',
+               default='',
                help='Certificate Authority Bundle file in pem format. '
                     'Must contain the appropriate trust chain for the '
                     'Certificate file.'),
@@ -108,14 +108,16 @@ class SDC(object):
                  context=None, value=None):
         """Performs HTTP request."""
         headers = {
-            'X-FromAppId': 'CONDUCTOR',
+            'X-FromAppId': 'AAI',
             'X-TransactionId': str(uuid.uuid4()),
+            'X-ECOMP-InstanceID': 'AAI',
         }
         kwargs = {
             "method": method,
             "path": path,
             "headers": headers,
             "data": data,
+            "content_type": "application/octet-stream"
         }
 
         # TODO(jdandrea): Move timing/response logging into the rest helper?
@@ -144,6 +146,7 @@ class SDC(object):
             "username": self.username,
             "password": self.password,
             "read_timeout": self.timeout,
+            "ca_bundle_file": self.verify,
         }
         self.rest = rest.REST(**kwargs)