def setUp(self):
     super(TestVmwareDriver, self).setUp()
     self.cluster_dvs_mapping = {"ClusterComputeResource": "test_dvs"}
     self.fake_visdk = self.useFixture(stubs.FakeVmware())
     self.session = self.fake_visdk.session
     self.useFixture(stubs.CacheFixture())
     self.useFixture(
         fixtures.MonkeyPatch(
             'networking_vsphere.drivers.vc_driver.'
             'VCNetworkDriver.is_valid_switch', fake_is_valid_switch))
     self.useFixture(
         fixtures.MonkeyPatch(
             'networking_vsphere.drivers.vc_driver.'
             'VCNetworkDriver.get_unused_portgroups',
             fake_get_unused_portgroups))
     self.useFixture(
         fixtures.MonkeyPatch(
             'networking_vsphere.drivers.vc_driver.'
             'VCNetworkDriver.delete_portgroup', fake_delete_portgroup))
     self.useFixture(
         fixtures.MonkeyPatch(
             'networking_vsphere.drivers.vc_driver.'
             'VCNetworkDriver.create_network', fake_create_network))
     self.vc_driver = vmware_driver.VCNetworkDriver()
     self.vc_driver.state = constants.DRIVER_RUNNING
     self.vc_driver.add_cluster("ClusterComputeResource", "test_dvs")
 def setUp(self):
     super(TestVmwareDriver, self).setUp()
     self.cluster_dvs_mapping = {"ClusterComputeResource": "test_dvs"}
     self.fake_visdk = self.useFixture(stubs.FakeVmware())
     self.session = self.fake_visdk.session
     self.useFixture(stubs.CacheFixture())
     mock.patch(
         'networking_vsphere.drivers.vc_driver.'
         'VCNetworkDriver.is_valid_switch',
         return_value=fake_vmware_api._db_content["HostSystem"].values()
     ).start()
     mock.patch(
         'networking_vsphere.drivers.vc_driver.'
         'VCNetworkDriver.get_unused_portgroups',
         return_value=[]).start()
     mock.patch('networking_vsphere.drivers.vc_driver.'
                'VCNetworkDriver.delete_portgroup').start()
     mock.patch('networking_vsphere.drivers.vc_driver.'
                'VCNetworkDriver.create_network').start()
     self.vc_driver = vmware_driver.VCNetworkDriver()
     self.vc_driver.state = constants.DRIVER_RUNNING
     self.vc_driver.add_cluster("ClusterComputeResource", "test_dvs")
     self.LOG = vmware_driver.LOG