コード例 #1
0
ファイル: check.py プロジェクト: zone1511/f5test2
    def clean_storage(self, ctx):
        has_restjavad = None
        with EmapiInterface(device=self.device,
                            username=self.options.admin_username,
                            password=self.options.admin_password,
                            port=self.options.ssl_port,
                            address=self.address) as rstifc:
            try:
                if ctx.version < "bigip 11.5.0":
                    has_restjavad = rstifc.api.get(DeviceResolver.URI)
            except EmapiResourceError:
                LOG.warning("This pre 11.5.0 device hasn't had latest"
                            " REST Framework upgrades")
                pass

        self.call("rm -rf /var/log/rest*")
        self.call("find /var/log -name '*.gz' -exec rm {} \;")
#         # Remove all files that are: blabla.1.blabla or blabla.1
#         self.call("find /var/log -regex '.*[.][1-9].*' -exec rm '{}' \\;")
        self.call(WIPE_STORAGE)

        # Because of a bug where restjavad not knowing about icrd, BZ504333.
        if self.sshifc.version.product.is_bigip:
            self.call("bigstart restart icrd")

        with EmapiInterface(device=self.device,
                            username=self.options.admin_username,
                            password=self.options.admin_password,
                            port=self.options.ssl_port,
                            address=self.address) as rstifc:
            if has_restjavad:
                wait_args(rstifc.api.get, func_args=[DeviceResolver.URI],
                          progress_message="Waiting for restjavad...",
                          timeout=300,
                          timeout_message="restjavad never came back up after {0}s")
コード例 #2
0
    def traffic(self, ip):
        # generate traffic via Apache Bench
        LOG.info("Generating traffic via ab...")
        clients = self.get_config().get_devices(
            kind=F5D.KIND_CLOUD_VCENTER_CLIENT)
        for client in clients:
            with SSHInterface(device=client) as sshifc:

                wait_args(
                    SCMD.ssh.generic,
                    func_args=[PING % ip, sshifc],
                    condition=lambda x: PING_ERROR not in x.stdout,
                    progress_cb=lambda _: "Waiting until %s is ping-able" % ip,
                    timeout=30)

                for i in range(TRAFFIC_ATTEMPTS):
                    try:
                        resp = SCMD.ssh.generic(TRAFFIC % ip, ifc=sshifc)
                        self.assertFalse(
                            resp.stderr,
                            "Failed to generate traffic:\n %s" % resp)
                        break
                    except:
                        if i >= TRAFFIC_ATTEMPTS - 1:
                            raise
コード例 #3
0
ファイル: basic_triggers.py プロジェクト: xiaotdl/nosest
    def test_100_tenant(self):
        """
        1) Delete Tenant
        2) Wait until graphs deleted from BIG-IQ and BIG-IPs
        3) Add back fvTenant
        """
        apicifc = self.get_data('apicifc')
        trigger_xmls = self.get_data('trigger_xmls')

        for graph, _ in trigger_xmls:
            # Get partition name on BIG-IP for this tenant
            tenant_name = graph.get('name')
            vdev = ACMD.system.get_vdev(Tenant.TENANT_DN % tenant_name,
                                        ifc=apicifc)
            partition_number = vdev.get('id')
            ctx_name = vdev.get('ctxName')
            ip_partition_name = "apic-{0}-{1}-{2}".format(tenant_name,
                                                          ctx_name,
                                                          partition_number)

            LOG.info("Deleting fvTenant: {}".format(tenant_name))
            apicifc.api.delete(Tenant.URI % tenant_name)
            self.set_data('trigger', True, overwrite=True)

            LOG.info("Waiting until partition is removed from BIG-IPs:"
                     " %s" % ip_partition_name)
            for bigip in self.get_data('devices'):
                r = self.get_icontrol_rest(device=bigip).api
                wait_args(r.get, func_args=[Folders.URI],
                          condition=lambda x: ip_partition_name not in [item.name for item in x['items']],
                          progress_cb=lambda x: "{0}".format([item.name for item in x['items']]))

        self.set_data('redeploy', False, overwrite=True)
コード例 #4
0
ファイル: nsx.py プロジェクト: pombredanne/f5test2
 def setup(self):
     LOG.debug('Removing the load balancer service on NSX edge id = {0}'.format(self.edge_id))
     wait_args(lambda: self.nsx_rst_api.put(LoadBalancer.URI % self.edge_id, payload=self.pay_load),
               condition=lambda _: self.check_lb_state,
               progress_cb=lambda x: "Waiting to remove load balancer on nsx edge, id={0}".format(self.edge_id),
               timeout=20, interval=4,
               timeout_message="load balancer was not removed on edge, id={0}".format(self.edge_id))
コード例 #5
0
ファイル: nsx.py プロジェクト: pombredanne/f5test2
 def setup(self):
     LOG.debug("Check for service instance id = {0} on NSX".format(self.service_intance_id))
     wait_args(self.wait_on_remove,
               condition=lambda x: x,
               progress_cb=lambda x: "checking for service instance id={0}".format(self.service_intance_id),
               timeout=20, interval=4,
               timeout_message="Service instance, id={0} was not removed on edge".format(self.service_intance_id))
     LOG.debug("service instance id = {0} deleted on NSX".format(self.service_intance_id))
コード例 #6
0
ファイル: nsx.py プロジェクト: pombredanne/f5test2
 def setup(self):
     try:
         self.nsx_rst_api.delete(Edges.ITEM_URI % self.edge_id)
     except NetxResourceError:
         pass
     wait_args(self.check, func_args=[self.nsx_rst_api.get(Edges.URI)],
               condition=lambda x: x,
               progress_cb=lambda x: "Waiting for edge, id={0} to be deleted".format(self.edge_id),
               timeout=20, interval=4,
               timeout_message="edge, id={0} could not be deleted".format(self.edge_id))
コード例 #7
0
ファイル: nsx.py プロジェクト: zc0nf/f5test2
    def setup(self):
        LOG.debug("Inserting load balancer service on nsx edge, id={0}".format(
            self.edge_id))
        template = LoadBalancer().from_file(self.template_dir,
                                            self.lb_template_name,
                                            fmt=self.template_format)
        gsi = template.loadBalancer.globalServiceInstance

        if self.specs.service_instance_id:
            gsi.serviceInstanceId = self.specs.service_instance_id

        gsi.name = self.instance_name

        if self.specs.service_id:
            gsi.serviceId = self.specs.service_id

        if self.specs.service_name:
            gsi.serviceName = self.specs.service_name

        if self.specs.template_id:
            gsi.instanceTemplateId = self.specs.template_id
            gsi.instanceTemplateUniqueId = self.specs.template_id

        if self.specs.typed_attributes:
            gsi.instanceTemplateTypedAttributes = self.specs.typed_attributes

        gsi.runtimeNicInfo = []
        if self.specs.nic_interfaces:
            for ifc in self.specs.nic_interfaces:
                vnic_payload = ServiceInstances().from_file(
                    self.template_dir,
                    self.vnics_template_name,
                    fmt=self.template_format)
                vnic_payload.runtimeNicInfo.label = ifc.label
                vnic_payload.runtimeNicInfo.index = ifc.index
                vnic_payload.runtimeNicInfo.network.objectId = ifc.network.object_id
                vnic_payload.runtimeNicInfo.connectivityType = ifc.connectivity_type
                vnic_payload.runtimeNicInfo.ipAllocationType = ifc.ip_allocation_type
                if ifc.ip_allocation_type == "IP_POOL":
                    vnic_payload.runtimeNicInfo.ipPool.objectId = ifc.ippool.object_id
                elif ifc.ip_allocation_type == "DHCP":
                    vnic_payload.runtimeNicInfo.pop("ipPool")
                gsi.runtimeNicInfo.append(vnic_payload.runtimeNicInfo)

        wait_args(
            self.retry_insert_lb,
            func_args=[template],
            condition=lambda state: state,
            progress_cb=lambda state: "Waiting to PUT global service instance",
            timeout=60,
            interval=5,
            timeout_message="Failed to insert loadbalancer service after {0}s")

        return True
コード例 #8
0
ファイル: nsx.py プロジェクト: zc0nf/f5test2
 def setup(self):
     LOG.debug("Check for service instance id = {0} on NSX".format(
         self.service_intance_id))
     wait_args(
         self.wait_on_remove,
         condition=lambda x: x,
         progress_cb=lambda x: "checking for service instance id={0}".
         format(self.service_intance_id),
         timeout=20,
         interval=4,
         timeout_message="Service instance, id={0} was not removed on edge".
         format(self.service_intance_id))
     LOG.debug("service instance id = {0} deleted on NSX".format(
         self.service_intance_id))
コード例 #9
0
ファイル: nsx.py プロジェクト: zc0nf/f5test2
 def setup(self):
     try:
         self.nsx_rst_api.delete(Edges.ITEM_URI % self.edge_id)
     except NetxResourceError:
         pass
     wait_args(
         self.check,
         func_args=[self.nsx_rst_api.get(Edges.URI)],
         condition=lambda x: x,
         progress_cb=lambda x: "Waiting for edge, id={0} to be deleted".
         format(self.edge_id),
         timeout=20,
         interval=4,
         timeout_message="edge, id={0} could not be deleted".format(
             self.edge_id))
コード例 #10
0
ファイル: nsx.py プロジェクト: zc0nf/f5test2
 def setup(self):
     LOG.debug(
         'Removing the load balancer service on NSX edge id = {0}'.format(
             self.edge_id))
     wait_args(
         lambda: self.nsx_rst_api.put(LoadBalancer.URI % self.edge_id,
                                      payload=self.pay_load),
         condition=lambda _: self.check_lb_state,
         progress_cb=lambda x:
         "Waiting to remove load balancer on nsx edge, id={0}".format(
             self.edge_id),
         timeout=20,
         interval=4,
         timeout_message="load balancer was not removed on edge, id={0}".
         format(self.edge_id))
コード例 #11
0
ファイル: system.py プロジェクト: jonozzz/nosest
 def wait_for_availability(self, resource):
     stats_link = resource.selfLink + '/stats'
     return wait_args(self.api.get, func_args=[stats_link],
                      condition=lambda x: x.entries.get('health.summary.available', {}).get('value') == 1,
                      progress_cb=lambda x: 'Pending health check...',
                      timeout=HEALTH_CHECK_TIMEOUT,
                      timeout_message="Object %s not available after {0} seconds" % resource.selfLink)
コード例 #12
0
ファイル: adccore.py プロジェクト: jonozzz/nosest
    def setup(self):
        super(RefreshAdcCurrentConfig, self).setup()
        LOG.info("refresh current config on {0}".format(
            str(self.device.get_discover_address())))
        machine_id = get_machine_id(self.device)

        existing_discovery_task = filter_search_for_item(
            base_uri=DeviceDiscovery.URI,
            search_key='deviceReference/link',
            search_value='*' + machine_id)

        module_list = [{'module': CM_GLOBAL_ADC_NAME}]
        payload = DeviceDiscovery(moduleList=module_list, status='STARTED')
        self.set_uri(existing_discovery_task)
        self.api.patch(self.uri, payload=payload)
        resp = wait_args(
            self.api.get,
            func_args=[self.uri],
            condition=lambda x: x.status in DeviceDiscovery.FINAL_STATUSES,
            interval=10,
            timeout=self.timeout,
            timeout_message='Re-discovery did not complete in {0} seconds')
        if resp.status == DeviceDiscovery.FAIL_STATE:
            raise TaskError(
                "Re-discovery failed for {0} for ADC service".format(
                    self.device.get_discover_address()))
コード例 #13
0
ファイル: system.py プロジェクト: jonozzz/nosest
 def setup(self):
     LOG.info("device discovery on {0}".format(str(self.device.get_discover_address())))
     temp_modules = []
     if self.services_list:
         for service in self.services_list:
             temp_modules.append({'module': service})
         payload = DeviceDiscovery(moduleList=temp_modules)
         if self.discover_task:
             LOG.debug("patching existing discover task")
             payload.status = 'STARTED'
             resp = self.api.patch(DeviceDiscovery.ITEM_URI % self.discover_task.id, payload=payload)
         else:
             LOG.debug("posting new discover task")
             payload.deviceReference = self.device_reference
             resp = self.api.post(DeviceDiscovery.URI, payload=payload)
         self.set_uri(resp)
         resp = wait_args(self.api.get, func_args=[self.uri],
                          condition=lambda x: x.status in DeviceDiscovery.FINAL_STATUSES,
                          interval=10,
                          timeout=self.timeout,
                          timeout_message='Discovery did not complete in {0} seconds')
         if resp.status == DeviceDiscovery.FAIL_STATE:
             raise AddServiceException("Device Discovery failed for {0}: {1}".format(self.device.get_discover_address(),
                                                                                     resp.errorMessage),
                                       address=self.device.get_discover_address(), service=self.services_list)
     else:
         LOG.info("empty services list")
コード例 #14
0
ファイル: misc.py プロジェクト: xiaotdl/nosest
    def setup(self):

        v = ICMD.system.get_version(device=self.device)
        LOG.info('Rest Health stage for: %s|%s', self.device, v)

        if v.product.is_bigiq or v.product.is_iworkflow or \
           v.product.is_bigip and (v >= 'bigip 11.5.1'):
            timeout = self.specs.timeout_each if self.specs.timeout_each else self.timeout
            interval = self.specs.check_interval if self.specs.timeout_each else self.interval
            apis = self.specs.rest_apis

            if apis and isinstance(apis, list):
                if v >= 'bigip 11.5.1' and v < 'bigip 12.0':  # unclear intermittent /mgmt/tm/ not available on 11.6.x
                    apis2 = []
                    for api in apis:
                        if not api.startswith('/mgmt/tm/'):
                            apis2.append(api)
                        else:
                            LOG.warning(
                                "11.6.x detected. Ignoring check for '%s'" %
                                api)
                    apis = apis2

                with EmapiInterface(device=self.device,
                                    auth=AUTH.BASIC) as rstifc:

                    def wait_available(uri):
                        return rstifc.api.get(uri) == {}

                    for api in apis:
                        if api.endswith("/available"):
                            wait_args(wait_available,
                                      func_args=[api],
                                      timeout=timeout,
                                      interval=interval,
                                      timeout_message=
                                      "api %s not available after {0}s" % api)
                        else:
                            wait_args(rstifc.api.get,
                                      func_args=[api],
                                      timeout=timeout,
                                      interval=interval,
                                      timeout_message=
                                      "api %s not available after {0}s" % api)
            else:
                LOG.info('Rest Health stage skipping - no REST.')
コード例 #15
0
ファイル: nsx.py プロジェクト: pombredanne/f5test2
    def setup(self):   
        LOG.debug("Inserting load balancer service on nsx edge, id={0}".format(self.edge_id))
        template = LoadBalancer().from_file(self.template_dir, self.lb_template_name, fmt=self.template_format)
        gsi = template.loadBalancer.globalServiceInstance
        
        if self.specs.service_instance_id:
            gsi.serviceInstanceId = self.specs.service_instance_id
        
        gsi.name = self.instance_name
        
        if self.specs.service_id:
            gsi.serviceId = self.specs.service_id
        
        if self.specs.service_name:
            gsi.serviceName = self.specs.service_name
            
        if self.specs.template_id:
            gsi.instanceTemplateId = self.specs.template_id
            gsi.instanceTemplateUniqueId = self.specs.template_id
        
        if self.specs.typed_attributes:
            gsi.instanceTemplateTypedAttributes = self.specs.typed_attributes
        
        gsi.runtimeNicInfo = []
        if self.specs.nic_interfaces:
            for ifc in self.specs.nic_interfaces:
                vnic_payload = ServiceInstances().from_file(self.template_dir, self.vnics_template_name, fmt=self.template_format)
                vnic_payload.runtimeNicInfo.label = ifc.label
                vnic_payload.runtimeNicInfo.index = ifc.index
                vnic_payload.runtimeNicInfo.network.objectId = ifc.network.object_id
                vnic_payload.runtimeNicInfo.connectivityType = ifc.connectivity_type
                vnic_payload.runtimeNicInfo.ipAllocationType = ifc.ip_allocation_type
                if ifc.ip_allocation_type == "IP_POOL":
                    vnic_payload.runtimeNicInfo.ipPool.objectId = ifc.ippool.object_id
                elif ifc.ip_allocation_type == "DHCP":
                    vnic_payload.runtimeNicInfo.pop("ipPool")
                gsi.runtimeNicInfo.append(vnic_payload.runtimeNicInfo)

        wait_args(self.retry_insert_lb, func_args=[template], condition=lambda state: state,
                  progress_cb=lambda state: "Waiting to PUT global service instance",
                  timeout=60, interval=5,
                  timeout_message="Failed to insert loadbalancer service after {0}s")
            
        return True
コード例 #16
0
 def wait_for_availability(self, resource):
     stats_link = resource.selfLink + '/stats'
     return wait_args(
         self.api.get,
         func_args=[stats_link],
         condition=lambda x: x.entries.get('health.summary.available', {}
                                           ).get('value') == 1,
         timeout=self.health_timeout,
         timeout_message="Object %s not available after {0} seconds" %
         resource.selfLink)
コード例 #17
0
 def setup(self):
     """ Get the current status of the secure storage master key, and
         return if it is setup or not.
     """
     resp = self.api.get(SecureStorageInterface.URI)
     LOG.debug("Secure Storage Master Key Enabled Status: " + str(resp.isMkSet))
     return resp.isMkSet if not self.wait_for_it else wait_args(self.api.get, func_args=[SecureStorageInterface.URI],
                                                                condition=lambda x: x.isMkSet is True,
                                                                interval=5,
                                                                timeout=self.timeout,
                                                                timeout_message='Master Storage still not set after {0} seconds')
コード例 #18
0
 def bigiq_special_selfip_handling(self, tree, ctx):
     "Because the use of tmsh has become frown upon starting with 4.2"
     v = ctx.version
     if v.product.is_bigiq and v >= 'bigiq 4.2.0':
         # XXX: Because sometimes user 'a' set via tmsh is not picked up.
         self.call('bigstart restart restjavad')
         with EmapiInterface(username=OUR_ADMIN_USERNAME,
                             password=OUR_ADMIN_PASSWORD,
                             port=self.options.ssl_port,
                             address=self.address) as rstifc:
             payload = O(selfIpAddresses=[])
             for self_ip in enumerate_stamps(tree, SelfIP, include_common=False):
                 # XXX: BIGIQ 4.2 API only supports untagged.
                 for iface in self_ip.vlan.untagged:
                     payload.selfIpAddresses.append(O(address=str(self_ip.address),
                                                      vlan=self_ip.vlan.name,
                                                      iface=iface))
             LOG.debug('EasySetup payload: %s', payload)
             wait_args(rstifc.api.patch, func_args=(EasySetup.URI, payload),
                       timeout=180, interval=5,
                       timeout_message="Can't patch selfIPs ready after {0}s")
コード例 #19
0
ファイル: system.py プロジェクト: jonozzz/nosest
    def setup(self):
        if self.machineid:
            LOG.info("remove device trust for {0}".format(str(self.device.get_discover_address())))
            payload = DeviceRemoveTrust(deviceReference={'link': 'https://localhost' + MachineIdResolver.ITEM_URI % self.machineid})
            resp = self.api.post(DeviceRemoveTrust.URI, payload=payload)
            self.set_uri(resp.id)
            resp = wait_args(self.api.get, func_args=[self.uri],
                             condition=lambda x: x.status in DeviceRemoveTrust.FINAL_STATUSES,
                             timeout=self.timeout,
                             timeout_message='Failed to remove device trust in {0} sec')

            if resp.status == DeviceRemoveTrust.FAIL_STATE:
                raise RemoveTrustException("Failed to remove trust for {0} resp:{1}".format(self.device.get_discover_address(), resp),
                                           address=self.device.get_discover_address())
コード例 #20
0
ファイル: system.py プロジェクト: jonozzz/nosest
    def prep(self):
        super(Discover, self).prep()
        self.uri = DeviceResolver.DEVICES_URI % DEFAULT_CM_DEVICE_GROUP
        LOG.info('Waiting for REST framework to come up...')

        def is_up(*args):
            try:
                return self.api.get(*args)
            except EmapiResourceError as e:
                if 'Authorization failed' in e.msg:
                    raise StopWait(e)
                raise
        self.resp = wait_args(is_up, func_args=[self.uri],
                              timeout=self.discover_timeout)

        if not self.services_list:
            self.import_config = False
コード例 #21
0
    def setup(self):
        LOG.info("Preparing to Discover DSC Clusters")
        payload = DscGroupTask()

        resp = self.api.post(DscGroupTask.URI, payload)
        self.set_uri(resp)
        resp = wait_args(
            self.api.get,
            func_args=[self.uri],
            condition=lambda x: x.status in CmTask.FINAL_STATUSES,
            interval=10,
            timeout=DSC_DISCOVER_TIMEOUT,
            timeout_message=
            'DSC Cluster Discovery did not complete in {0} seconds')
        if resp.status == CmTask.FAIL_STATE:
            raise DiscoverDscClustersException(
                "DSC Cluster Discovery failed with state {0}".format(
                    resp.status))

        return resp
コード例 #22
0
ファイル: system.py プロジェクト: xiaotdl/nosest
    def setup(self):
        """Uploads DP."""

        # Populate device packages in APIC.
        resp = self.ifc.api.get(DevicePackage.URI)
        pre_dns = [x.get('dn') for x in resp]

        headers = {'Content-Type': 'multipart/form-data'}
        payload = AttrDict()

        LOG.debug("Uploading...")
        if self.f:
            # The file object needs to have the 'name' attr for the POST to
            # work. SFTPFile Object does not have the 'name' attr.
            if not hasattr(self.f, 'name'):
                setattr(self.f, 'name', 'foo')
            payload.name = self.f
            self.ifc.api.post(DevicePackage.UPLOAD_URI,
                              headers=headers,
                              payload=payload)

        else:
            with open(self.path, "r") as f:
                payload.name = f
                self.ifc.api.post(DevicePackage.UPLOAD_URI,
                                  headers=headers,
                                  payload=payload)

        post_dp = wait_args(self.ifc.api.get,
                            func_args=[DevicePackage.URI],
                            condition=lambda x: len(x) > len(pre_dns),
                            progress_cb=lambda x: "items: %s" % len(x))

        for item in post_dp:
            if item.get('dn') not in pre_dns:
                return item

        return post_dp
コード例 #23
0
ファイル: system.py プロジェクト: jonozzz/nosest
    def setup(self):

        remove_modules = []
        if self.services_list:
            for module in self.services_list:
                remove_modules.append({'module': module})
        else:
            for module in self.current_modules:
                remove_modules.append({"module": module})
        if remove_modules:
            LOG.info("removing services {0} for {1}".format(remove_modules, self.device.get_discover_address()))
            payload = DeviceRemoveMgmtAuthority(deviceReference={'link': 'https://localhost' + MachineIdResolver.ITEM_URI % self.machineid},
                                                moduleList=remove_modules)
            resp = self.api.post(DeviceRemoveMgmtAuthority.URI, payload=payload)
            self.set_uri(resp.id)
            resp = wait_args(self.api.get, func_args=[self.uri],
                             condition=lambda x: x.status in DeviceRemoveMgmtAuthority.FINAL_STATUSES,
                             timeout=self.timeout,
                             timeout_message='Remove Management Authority did not complete in {0} seconds')
            if resp.status == DeviceRemoveMgmtAuthority.FAIL_STATE:
                raise RemoveServiceException("Remove Mgmt Authority failed on {0} for services {1} resp:{2}".format(self.device.get_discover_address(),
                                                                                                                    remove_modules, resp),
                                             address=self.device.get_discover_address(), service=remove_modules)
コード例 #24
0
    def wait_for_available(self, version):
        """1. Wait for a list of apis
        """
        with EmapiInterface(username=self.options.admin_username,
                            password=self.options.admin_password,
                            port=self.options.ssl_port, auth=AUTH.BASIC,
                            address=self.address) as rstifc:
            v = version
            if v.product.is_bigip and (v >= 'bigip 11.5.1'):
                LOG.debug('Waiting for REST workers to come up...')

                def wait_available(uri):
                    return rstifc.api.get(uri) == {}
                if v < 'bigip 11.6.0' or v >= 'bigip 12.0.0':  # not working on 11.6.x with a different admin user than admin
                    wait_args(wait_available, func_args=[AuthzRoles.AVAILABLE_URI],
                              timeout=240, interval=10,
                              timeout_message="BP AuthzRoles.AVAILABLE_URI not available after {0}s")
                    wait_args(wait_available, func_args=[Echo.AVAILABLE_URI],
                              timeout=240, interval=10,
                              timeout_message="BP Echo.AVAILABLE_URI not available after {0}s")
                    wait_args(rstifc.api.get, func_args=[Echo.URI], timeout=180,
                              timeout_message="BP Echo.URI not available after {0}s")
コード例 #25
0
    def complete_recover_graphs(self, original_xmls, apicifc, bigips):
        '''
        Delete all graphs and Device Clusters
        Create Device Cluster and Graphs
        '''
        try:
            LOG.info("Deleting graphs and device clusters...")
            for graph, ldevvip in reversed(original_xmls):
                vdev = ACMD.system.get_vdev(Tenant.TENANT_DN %
                                            graph.get('name'),
                                            ifc=self.apicifc)
                self.apicifc.api.delete(ManagedObject.URI % graph.get('dn'))

                if vdev is not None:
                    partition_number = vdev.get('id')
                    ctx_name = vdev.get('ctxName')
                    tenant_name = graph.get('name')
                    ip_partition_name = "apic-{0}-{1}-{2}".format(
                        tenant_name, ctx_name, partition_number)

                    LOG.info("Waiting until partition is removed from BIG-IPs:"
                             " %s" % ip_partition_name)
                    for bigip in self.get_data('devices'):
                        r = self.get_icontrol_rest(device=bigip).api
                        wait_args(r.get,
                                  func_args=[Folders.URI],
                                  condition=lambda x: ip_partition_name not in
                                  [item.name for item in x['items']],
                                  progress_cb=lambda x: "{0}".format(
                                      [item.name for item in x['items']]))

                if ldevvip is not None:
                    self.apicifc.api.delete(ManagedObject.URI %
                                            ldevvip.get('dn'))
                    ldevvip_name = ldevvip.get('name')
                    LOG.info(
                        "Waiting until Device Group gets removed from BIG-IPs: "
                        "{0}".format(ldevvip_name))

                    for bigip in bigips:
                        rstifc = self.get_icontrol_rest(device=bigip)
                        wait(lambda: rstifc.api.get(DeviceGroup.URI),
                             condition=lambda x: ldevvip_name not in
                             [y.name for y in x['items']],
                             progress_cb=lambda x: "Device Groups: {0}".format(
                                 [y.name for y in x['items']]),
                             stabilize=5)

            LOG.info("Re-deploying graphs...")
            for graph, ldevvip in original_xmls:
                if ldevvip is not None:
                    substrs = ldevvip.get('dn').split('/')
                    for substr in substrs:
                        if 'tn-' in substr:
                            ldevvip_tenant = "uni/{}".format(substr)

                    self.apicifc.api.post(ManagedObject.URI %
                                          ldevvip.get('dn'),
                                          payload=ldevvip)
                    ldevvip.wait(ifc=apicifc, tenant=ldevvip_tenant)

                self.apicifc.api.post(ManagedObject.URI % graph.get('dn'),
                                      payload=graph)
                graph.wait_graph(self.apicifc, graph.get('name'))
        except:
            raise