Add AAF root cert location to conductor.conf 63/99463/3
authordhebeha <dhebeha.mj71@wipro.com>
Wed, 11 Dec 2019 07:05:37 +0000 (12:35 +0530)
committerdhebeha <dhebeha.mj71@wipro.com>
Fri, 10 Jan 2020 11:04:49 +0000 (16:34 +0530)
Modify multicloud.py to verify the session
using AAF root certificate if https

Issue-ID: OPTFRA-328
Change-Id: Ica47cbda3821120a020f34c97a4e398e2f7bbda5
Signed-off-by: dhebeha <dhebeha.mj71@wipro.com>
.gitignore
conductor.conf
conductor/conductor/data/plugins/vim_controller/multicloud.py
conductor/conductor/tests/unit/data/plugins/inventory_provider/test_multicloud.py

index a5cf397..e434753 100644 (file)
@@ -104,3 +104,8 @@ _ReSharper*/
 # FIXME: Put all paths to temporarily hide under here.
 # This must be considered temporary and is to be cleaned out!
 conductor/api/extra/
+
+#eclipse
+.project
+.settings/
+.pydevproject
index 75e4e70..b4f09b1 100755 (executable)
@@ -400,6 +400,15 @@ concurrent = true
 # The version of Multicloud API. (string value)
 #server_url_version = v0
 
+# Certificate Authority Bundle file in pem format. Must contain the appropriate
+# trust chain for the Certificate file. (string value)
+#certificate_authority_bundle_file = certificate_authority_bundle.pem
+certificate_authority_bundle_file = /usr/local/bin/AAF_RootCA.cer
+
+# Enabling HTTPs mode (boolean value)
+# enable_https_mode = <None>
+# default is false
+enable_https_mode = True
 
 [music_api]
 
index 3d904b4..5c2b5f7 100644 (file)
@@ -45,6 +45,12 @@ MULTICLOUD_OPTS = [
     cfg.StrOpt('server_url_version',
                default='v0',
                help='The version of Multicloud API.'),
+    cfg.StrOpt('certificate_authority_bundle_file',
+               default='certificate_authority_bundle.pem',
+               help='Certificate Authority Bundle file in pem format. '
+                    'Must contain the appropriate trust chain for the '
+                    'Certificate file.'),
+    cfg.BoolOpt('enable_https_mode', default = False, help='enable HTTPs mode for multicloud connection'),
 ]
 
 CONF.register_opts(MULTICLOUD_OPTS, group='multicloud')
@@ -109,6 +115,9 @@ class MULTICLOUD(base.VimControllerBase):
             "read_timeout": self.timeout,
         }
         self.rest = rest.REST(**kwargs)
+        if(self.conf.multicloud.enable_https_mode):
+            self.rest.server_url = self.base[:4]+'s'+self.base[4:]
+            self.rest.session.verify =self.conf.multicloud.certificate_authority_bundle_file    
 
     def check_vim_capacity(self, vim_request):
         LOG.debug("Invoking check_vim_capacity api")
index 1f4013e..34319d2 100644 (file)
@@ -35,6 +35,7 @@ class TestMultiCloud(unittest.TestCase):
         ]
         cfg.CONF.register_cli_opts(cli_opts)
         self.mc_ep = mc.MULTICLOUD()
+        self.mc_ep.conf.set_override('certificate_authority_bundle_file', '../AAF_RootCA.cer', 'multicloud')
         self.mc_ep.conf.set_override('debug', False)
 
     def tearDown(self):