Add support barbican to runtestmanager

Change-Id: I394202e3e3a1b6d0bcbe7da7a53d0db14b07e799
diff --git a/tcp_tests/managers/runtestmanager.py b/tcp_tests/managers/runtestmanager.py
index b258937..e7fc15c 100644
--- a/tcp_tests/managers/runtestmanager.py
+++ b/tcp_tests/managers/runtestmanager.py
@@ -57,6 +57,7 @@
             self.control_host)[0]
         self.compute_name = self.underlay.get_target_node_names(
             self.compute_host)[0]
+        self.barbican = False
 
     @property
     def salt_api(self):
@@ -72,7 +73,7 @@
         public_allocation_end = public_net["end"].encode("ascii")
         tempest_test_target = self.target_name.encode("ascii") + "*"
 
-        return {
+        pillar = {
             'classes': ['service.runtest.tempest',
                         'service.runtest.tempest.public_net',
                         'service.runtest.tempest.services.manila.glance'],
@@ -139,6 +140,11 @@
                             'run_snapshot_tests': True,
                         }}}}}
 
+        if self.barbican:
+            pillar['classes'].append('service.runtest.tempest.barbican')
+
+        return pillar
+
     def fetch_arficats(self, username=None, file_format='xml'):
         with self.underlay.remote(node_name=self.target_name,
                                   username=None) as tgt:
@@ -192,6 +198,10 @@
                 f.write(container_inspect)
 
     def prepare(self):
+        barbican_pillar = "nova:controller:barbican:enabled"
+        result = self.__salt_api.get_pillar(tgt=self.control_name,
+                                            pillar=barbican_pillar)
+        self.barbican = result[0].get(self.control_name, False)
         self.store_runtest_model()
         cirros_pillar = ("salt-call --out=newline_values_only "
                          "pillar.get "
@@ -280,6 +290,19 @@
                         "  --property hw:mem_page_size=any'")},
             )
 
+        if self.barbican:
+            commands.append({
+                'description': "Configure barbican",
+                'node_name': self.master_name,
+                'cmd': ("set -ex;" +
+                        salt_call_cmd +
+                        " state.sls barbican.client && " +
+                        salt_call_cmd +
+                        " state.sls runtest.test_accounts && " +
+                        salt_call_cmd +
+                        " state.sls runtest.barbican_sign_image")},
+            )
+
         self.__salt_api.execute_commands(commands=commands,
                                          label="Prepare for Tempest")