def test_lua_recovery_dupe_itls(self, mock_adapter, mock_lua_result, mock_lua_xml): itls = [ fc.ITL('AABBCCDDEEFF0011', '00:11:22:33:44:55:66:EE', 238), fc.ITL('AABBCCDDEEFF0011', '00:11:22:33:44:55:66:EE', 238) ] mock_lua_result.return_value = ('OK', 'hdisk1', 'udid') status, devname, udid = fc.lua_recovery(mock_adapter, 'vios_uuid', itls, device_id='foo') # Validate value unpack self.assertEqual('OK', status) self.assertEqual('hdisk1', devname) self.assertEqual('udid', udid) # Validate method invocations self.assertEqual(1, mock_adapter.read.call_count) self.assertEqual(1, mock_lua_result.call_count) mock_lua_xml.assert_called_with({itls[0]}, mock_adapter, vendor='OTHER', device_id='foo')
def test_itl(self): """Tests the ITL class.""" itl = fc.ITL('AABBCCDDEEFF0011', '00:11:22:33:44:55:66:EE', 238) self.assertEqual('aabbccddeeff0011', itl.initiator) self.assertEqual('00112233445566ee', itl.target) self.assertEqual('ee000000000000', itl.lun) # Test Lun-ID length for max 8 bytes itl = fc.ITL('AABBC11', '00:11:22:33:44:55:66:EE', 1074872357) self.assertEqual('4011402500000000', itl.lun) self.assertEqual(16, len(itl.lun))
def test_lua_recovery(self, mock_adapter, mock_lua_result): itls = [fc.ITL('AABBCCDDEEFF0011', '00:11:22:33:44:55:66:EE', 238)] mock_lua_result.return_value = ('OK', 'hdisk1', 'udid') status, devname, udid = fc.lua_recovery(mock_adapter, 'vios_uuid', itls) # Validate value unpack self.assertEqual('OK', status) self.assertEqual('hdisk1', devname) self.assertEqual('udid', udid) # Validate method invocations self.assertEqual(1, mock_adapter.read.call_count) self.assertEqual(1, mock_lua_result.call_count)
def test_build_itls(self): """Tests that the ITL combinations can be built out.""" i_wwpns = ['0011223344556677', '0011223344556678'] t_wwpns = ['1111223344556677', '1111223344556678', '1111223344556679'] all_itls = fc.build_itls(i_wwpns, t_wwpns, 238) self.assertEqual(6, len(all_itls)) combos = [fc.ITL(i_wwpns[0], t_wwpns[0], 238), fc.ITL(i_wwpns[0], t_wwpns[1], 238), fc.ITL(i_wwpns[0], t_wwpns[2], 238), fc.ITL(i_wwpns[1], t_wwpns[0], 238), fc.ITL(i_wwpns[1], t_wwpns[1], 238), fc.ITL(i_wwpns[1], t_wwpns[2], 238)] self.assertListEqual(combos, all_itls)