"""
return msg
+ def get_test_show_channel_r_model_diff_target_id(self):
+ return (0, [{
+ 'Mode': 'Host',
+ 'AID': '32',
+ 'defClock': 'Auto',
+ 'MCS': 'N/A',
+ 'Ch': '0',
+ 'BID': '33',
+ 'curClock': '---',
+ 'Width': '---',
+ 'Type': 'FIBRE',
+ }, {
+ 'Mode': 'Host',
+ 'AID': '0',
+ 'defClock': 'Auto',
+ 'MCS': '0',
+ 'Ch': '1',
+ 'BID': '1',
+ 'curClock': '---',
+ 'Width': 'iSCSI',
+ 'Type': 'NETWORK',
+ }, {
+ 'Mode': 'Host',
+ 'AID': '0',
+ 'defClock': 'Auto',
+ 'MCS': '1',
+ 'Ch': '2',
+ 'BID': '1',
+ 'curClock': '---',
+ 'Width': 'iSCSI',
+ 'Type': 'NETWORK',
+ }, {
+ 'Mode': 'Drive',
+ 'AID': '---',
+ 'defClock': '6.0 Gbps',
+ 'MCS': 'N/A',
+ 'Ch': '3',
+ 'BID': '---',
+ 'curClock': '6.0 Gbps',
+ 'Width': 'SAS',
+ 'Type': 'SAS',
+ }, {
+ 'Mode': 'Host',
+ 'AID': '0',
+ 'defClock': 'Auto',
+ 'MCS': '2',
+ 'Ch': '4',
+ 'BID': '1',
+ 'curClock': '---',
+ 'Width': 'iSCSI',
+ 'Type': 'NETWORK',
+ }, {
+ 'Mode': 'Host',
+ 'AID': '48',
+ 'defClock': 'Auto',
+ 'MCS': 'N/A',
+ 'Ch': '5',
+ 'BID': '49',
+ 'curClock': '---',
+ 'Width': '---',
+ 'Type': 'FIBRE',
+ }])
+
def get_test_show_channel_r_model(self):
return (0, [{
'Mode': 'Host',
'WWNN': self.fake_target_wwnns[0],
}])
+ def get_test_show_wwn_with_diff_target_id(self):
+ return (0, [{
+ 'ID': 'AID:32',
+ 'WWPN': self.fake_target_wwpns[0],
+ 'CH': '0',
+ 'WWNN': self.fake_target_wwnns[0],
+ }, {
+ 'ID': 'BID:33',
+ 'WWPN': self.fake_target_wwpns[2],
+ 'CH': '0',
+ 'WWNN': self.fake_target_wwnns[1],
+ }, {
+ 'ID': 'AID:48',
+ 'WWPN': self.fake_target_wwpns[1],
+ 'CH': '5',
+ 'WWNN': self.fake_target_wwnns[0],
+ }, {
+ 'ID': 'BID:49',
+ 'WWPN': self.fake_target_wwpns[3],
+ 'CH': '5',
+ 'WWNN': self.fake_target_wwnns[1],
+ }])
+
def get_test_show_wwn(self):
return (0, [{
'ID': 'AID:112',
self.assertDictMatch(
properties, self.cli_data.test_fc_properties_zoning_r_model)
+ @mock.patch.object(common_cli.LOG, 'info', mock.Mock())
+ def test_initialize_connection_with_zoning_r_model_diff_target_id(self):
+
+ test_volume = self.cli_data.test_volume
+ test_connector = self.cli_data.test_connector_fc
+ test_initiator_wwpns = test_connector['wwpns']
+ test_partition_id = self.cli_data.fake_partition_id[0]
+ test_all_target_wwpns = self.cli_data.fake_target_wwpns[:]
+ test_all_target_wwpns[1] = self.cli_data.fake_target_wwpns[2]
+ test_all_target_wwpns[2] = self.cli_data.fake_target_wwpns[1]
+ test_lookup_map = self.cli_data.fake_lookup_map_r_model
+
+ mock_commands = {
+ 'ShowChannel':
+ self.cli_data.get_test_show_channel_r_model_diff_target_id(),
+ 'ShowMap': self.cli_data.get_test_show_map(),
+ 'CreateMap': SUCCEED,
+ 'ShowWWN': self.cli_data.get_test_show_wwn_with_diff_target_id(),
+ }
+ self._driver_setup(mock_commands)
+ self.driver.fc_lookup_service = mock.Mock()
+ get_device_mapping_from_network = (
+ self.driver.fc_lookup_service.get_device_mapping_from_network
+ )
+ get_device_mapping_from_network.return_value = test_lookup_map
+
+ properties = self.driver.initialize_connection(
+ test_volume, test_connector)
+
+ get_device_mapping_from_network.assert_has_calls(
+ [mock.call(test_connector['wwpns'], test_all_target_wwpns)])
+
+ expect_cli_cmd = [
+ mock.call('ShowChannel'),
+ mock.call('ShowMap'),
+ mock.call('ShowWWN'),
+ mock.call('CreateMap', 'part', test_partition_id, '5', '48', '0',
+ 'wwn=%s' % test_initiator_wwpns[0]),
+ mock.call('CreateMap', 'part', test_partition_id, '0', '33', '0',
+ 'wwn=%s' % test_initiator_wwpns[0]),
+ mock.call('CreateMap', 'part', test_partition_id, '5', '48', '0',
+ 'wwn=%s' % test_initiator_wwpns[1]),
+ mock.call('CreateMap', 'part', test_partition_id, '0', '33', '0',
+ 'wwn=%s' % test_initiator_wwpns[1]),
+ ]
+ self._assert_cli_has_calls(expect_cli_cmd)
+
+ self.assertDictMatch(
+ properties, self.cli_data.test_fc_properties_zoning_r_model)
+
@mock.patch.object(common_cli.LOG, 'info', mock.Mock())
def test_terminate_connection(self):