Fix for has to communicate with SDC for Nst-selection enhancements
[optf/has.git] / conductor / conductor / common / sms.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