Ejemplo n.º 1
0
 def mockFabricObj(self):
     fabric_obj = Fabric(name='fab01')
     fabric_obj.uuid = FAB_UUID1
     fabric_obj.fq_name = [DGSC, 'fab01']
     cred = UserCredentials(username='******',
                            password='******')
     credentials = DeviceCredential(credential=cred)
     fabric_credentials = DeviceCredentialList(
         device_credential=[credentials])
     fabric_obj.set_fabric_credentials(fabric_credentials)
     fabric_obj.set_annotations(KeyValuePairs([
         KeyValuePair(key='cli_sync_input',
                      value=mock_job_template_input_schema)]))
     return fabric_obj
Ejemplo n.º 2
0
 def mockFabric(self):
     try:
         fabric_obj = Fabric(name='fab01')
         fabric_obj.uuid = FAB_UUID1
         fabric_obj.fq_name = [DGSC, 'fab01']
         cred = UserCredentials(username='******',
                                password='******')
         credentials = DeviceCredential(credential=cred)
         fabric_credentials = DeviceCredentialList(
             device_credential=[credentials])
         fabric_obj.set_fabric_credentials(fabric_credentials)
         fabric_obj.set_annotations(KeyValuePairs([
             KeyValuePair(key='cli_sync_input',
                          value=mock_job_template_input_schema)]))
         self._vnc_lib.fabric_create(fabric_obj)
     except RefsExistError:
         logger.info("Fabric {} already exists".format('fab01'))
     except Exception as ex:
         logger.error("ERROR creating fabric {}: {}".format('fab01', ex))