def test_vmax_get_iscsi_properties_auth(self): vol = deepcopy(self.data.test_volume) backup_conf = self.common.configuration configuration = tpfo.FakeConfiguration( None, 'ISCSITests', 1, 1, san_ip='1.1.1.1', san_login='******', vmax_array=self.data.array, vmax_srp='SRP_1', san_password='******', san_rest_port=8443, use_chap_auth=True, chap_username='******', chap_password='******', vmax_port_groups=[self.data.port_group_name_i]) self.driver.configuration = configuration ip_and_iqn = [{'ip': self.data.ip, 'iqn': self.data.initiator}, {'ip': self.data.ip, 'iqn': self.data.iqn}] host_lun_id = self.data.iscsi_device_info['hostlunid'] ref_properties = { 'target_portals': ( [t['ip'] + ':3260' for t in ip_and_iqn]), 'target_iqns': ( [t['iqn'].split(',')[0] for t in ip_and_iqn]), 'target_luns': [host_lun_id] * len(ip_and_iqn), 'target_discovered': True, 'target_iqn': ip_and_iqn[0]['iqn'].split(',')[0], 'target_portal': ip_and_iqn[0]['ip'] + ':3260', 'target_lun': host_lun_id, 'volume_id': self.data.test_volume.id, 'auth_method': 'CHAP', 'auth_username': '******', 'auth_password': '******'} iscsi_properties = self.driver.vmax_get_iscsi_properties( vol, ip_and_iqn, True, host_lun_id, None, None) self.assertEqual(ref_properties, iscsi_properties) self.driver.configuration = backup_conf
def setUp(self): self.data = tpd.PowerMaxData() super(PowerMaxISCSITest, self).setUp() volume_utils.get_max_over_subscription_ratio = mock.Mock() configuration = tpfo.FakeConfiguration( None, 'ISCSITests', 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 = iscsi.PowerMaxISCSIDriver(configuration=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 setUp(self): self.data = tpd.PowerMaxData() self.reference_cinder_conf = tpfo.FakeConfiguration( None, 'ProvisionTests', 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], load_balance=True, load_balance_real_time=True, load_data_format='avg', load_look_back=60, load_look_back_real_time=10, port_group_load_metric='PercentBusy', port_load_metric='PercentBusy') self.reference_perf_conf = { 'load_balance': True, 'load_balance_rt': True, 'perf_registered': True, 'rt_registered': True, 'collection_interval': 5, 'data_format': 'Average', 'look_back': 60, 'look_back_rt': 10, 'port_group_metric': 'PercentBusy', 'port_metric': 'PercentBusy' } super(PowerMaxPerformanceTest, self).setUp() volume_utils.get_max_over_subscription_ratio = mock.Mock() rest.PowerMaxRest._establish_rest_session = mock.Mock( return_value=tpfo.FakeRequestsSession()) driver = iscsi.PowerMaxISCSIDriver( configuration=self.reference_cinder_conf) self.driver = driver self.common = self.driver.common self.performance = self.driver.performance self.rest = self.common.rest
def test_vmax_get_iscsi_properties_auth(self): vol = deepcopy(self.data.test_volume) backup_conf = self.common.configuration configuration = tpfo.FakeConfiguration( None, 'ISCSITests', 1, 1, san_ip='1.1.1.1', san_login='******', vmax_array=self.data.array, vmax_srp='SRP_1', san_password='******', san_rest_port=8443, use_chap_auth=True, chap_username='******', chap_password='******', vmax_port_groups=[self.data.port_group_name_i]) self.driver.configuration = configuration ip_and_iqn = [{'ip': self.data.ip, 'iqn': self.data.initiator}, {'ip': self.data.ip, 'iqn': self.data.iqn}] host_lun_id = self.data.iscsi_device_info['hostlunid'] iscsi_properties = self.driver.vmax_get_iscsi_properties( self.data.array, vol, ip_and_iqn, True, host_lun_id, None, None) self.assertIn('auth_method', iscsi_properties.keys()) self.assertIn('auth_username', iscsi_properties.keys()) self.assertIn('auth_password', iscsi_properties.keys()) self.assertEqual('CHAP', iscsi_properties['auth_method']) self.assertEqual('auth_username', iscsi_properties['auth_username']) self.assertEqual('auth_secret', iscsi_properties['auth_password']) self.driver.configuration = backup_conf