def setUp(self): self.data = tpd.PowerMaxData() super(PowerMaxFCTest, self).setUp() volume_utils.get_max_over_subscription_ratio = mock.Mock() self.configuration = tpfo.FakeConfiguration( None, 'FCTests', 1, 1, san_ip='1.1.1.1', san_login='******', vmax_array=self.data.array, vmax_srp='SRP_1', san_password='******', san_api_port=8443, vmax_port_groups=[self.data.port_group_name_i]) rest.PowerMaxRest._establish_rest_session = mock.Mock( return_value=tpfo.FakeRequestsSession()) driver = fc.PowerMaxFCDriver(configuration=self.configuration) self.driver = driver self.common = self.driver.common self.masking = self.common.masking self.utils = self.common.utils self.utils.get_volumetype_extra_specs = (mock.Mock( return_value=self.data.vol_type_extra_specs))
def test_build_initiator_target_map(self): ref_target_map = {'123456789012345': ['543210987654321'], '123456789054321': ['123450987654321']} with mock.patch.object(fczm_utils, 'create_lookup_service', return_value=tpfo.FakeLookupService()): driver = fc.PowerMaxFCDriver(configuration=self.configuration) with mock.patch.object(driver.common, 'get_target_wwns_from_masking_view', return_value=(self.data.target_wwns, [])): targets, target_map = driver._build_initiator_target_map( self.data.test_volume, self.data.connector) self.assertEqual(ref_target_map, target_map)