示例#1
0
 def test_hash(self):
     ports = {
         VNXHbaPort.create(VNXSPEnum.SP_A, 1),
         VNXHbaPort.create(VNXSPEnum.SP_B, 1),
         VNXHbaPort.create(VNXSPEnum.SP_A, 1)
     }
     assert_that(len(ports), equal_to(2))
示例#2
0
 def test_hash(self):
     ports = {
         VNXHbaPort.create(VNXSPEnum.SP_A, 1),
         VNXHbaPort.create(VNXSPEnum.SP_B, 1),
         VNXHbaPort.create(VNXSPEnum.SP_A, 1)
     }
     assert_that(len(ports), equal_to(2))
示例#3
0
 def test_hash(self):
     ports = {
         VNXHbaPort.create(VNXSPEnum.SP_A, 1),
         VNXHbaPort.create(VNXSPEnum.SP_B, 1),
         VNXHbaPort.create(VNXSPEnum.SP_A, 1)
     }
     self.assertEqual(2, len(ports))
示例#4
0
 def hba_port_set(self):
     return {
         VNXHbaPort.create(VNXSPEnum.SP_A, 1),
         VNXHbaPort.create(VNXSPEnum.SP_B, 1),
         VNXHbaPort.create(VNXSPEnum.SP_A, 4),
         VNXHbaPort.create(VNXSPEnum.SP_A, 3, vport_id=1),
         VNXHbaPort.create(VNXSPEnum.SP_A, 6, vport_id=0),
         VNXHbaPort.create(VNXSPEnum.SP_B, 4, vport_id=0),
     }
示例#5
0
 def hba_port_set(self):
     return {
         VNXHbaPort.create(VNXSPEnum.SP_A, 1),
         VNXHbaPort.create(VNXSPEnum.SP_B, 1),
         VNXHbaPort.create(VNXSPEnum.SP_A, 4),
         VNXHbaPort.create(VNXSPEnum.SP_A, 3, vport_id=1),
         VNXHbaPort.create(VNXSPEnum.SP_A, 6, vport_id=0),
         VNXHbaPort.create(VNXSPEnum.SP_B, 4, vport_id=0),
     }
示例#6
0
 def test_hba_equal_hba_port(self):
     hba = test_hba()
     h_port = VNXHbaPort.create('a', 3, vport_id=1)
     assert_that(hba, equal_to(h_port))
示例#7
0
 def test_as_tuple(self):
     port = VNXHbaPort.create(VNXSPEnum.SP_A, 1)
     assert_that(port.as_tuple(), only_contains(VNXSPEnum.SP_A, 1))
示例#8
0
 def test_get_sp_index(self):
     port = VNXHbaPort.create('spb', '5')
     assert_that(port.get_sp_index(), equal_to('b'))
     assert_that(port.port_id, equal_to(5))
示例#9
0
 def f():
     port = VNXHbaPort.create('A', 'a1')
     assert_that(port.is_valid(), equal_to(False))
     assert_that(port.port_id, none())
示例#10
0
 def test_set_sp(self):
     port = VNXHbaPort.create('A', 3)
     assert_that(port.sp, equal_to(VNXSPEnum.SP_A))
示例#11
0
 def test_set_sp_error(self):
     port = VNXHbaPort.create('Z', 3)
     self.assertEqual(False, port.is_valid())
     self.assertIsNone(port.sp)
示例#12
0
 def test_repr(self):
     port = VNXHbaPort.create(VNXSPEnum.SP_B, 3)
     ret = port.__repr__()
     assert_that(ret, contains_string('"sp": "VNXSPEnum.SP_B"'))
     assert_that(ret, contains_string('"existed": true'))
示例#13
0
 def test_as_tuple(self):
     port = VNXHbaPort.create(VNXSPEnum.SP_A, 1)
     assert_that(port.as_tuple(), only_contains(VNXSPEnum.SP_A, 1))
示例#14
0
 def test_equal(self):
     spa_1 = VNXHbaPort.create(VNXSPEnum.SP_A, 1)
     spa_1_dup = VNXHbaPort.create(VNXSPEnum.SP_A, 1)
     spa_2 = VNXHbaPort.create(VNXSPEnum.SP_A, 2)
     assert_that(spa_1_dup, equal_to(spa_1))
     assert_that(spa_1, is_not(equal_to(spa_2)))
示例#15
0
 def test_get_sp_index(self):
     port = VNXHbaPort.create('spb', '5')
     assert_that(port.get_sp_index(), equal_to('b'))
     assert_that(port.port_id, equal_to(5))
示例#16
0
 def test_create_tuple_input(self):
     inputs = ('a', 5)
     port = VNXHbaPort.create(*inputs)
     assert_that(port.sp, equal_to(VNXSPEnum.SP_A))
     assert_that(port.port_id, equal_to(5))
示例#17
0
 def f():
     port = VNXHbaPort.create('A', 'a1')
     assert_that(port.is_valid(), equal_to(False))
     assert_that(port.port_id, none())
示例#18
0
 def test_set_sp(self):
     port = VNXHbaPort.create('A', 3)
     self.assertEqual(VNXSPEnum.SP_A, port.sp)
示例#19
0
 def test_connection_port_equal_hba_port(self):
     c_port = VNXConnectionPort(sp='a', port_id=4, cli=t_cli())
     h_port = VNXHbaPort.create('a', 4, vport_id=0)
     assert_that(c_port, equal_to(h_port))
示例#20
0
 def f():
     port = VNXHbaPort.create('A', 'a1')
     self.assertEqual(False, port.is_valid())
     self.assertIsNone(port.port_id)
示例#21
0
 def test_hba_equal_hba_port(self):
     hba = test_hba()
     h_port = VNXHbaPort.create('a', 3, vport_id=1)
     assert_that(hba, equal_to(h_port))
示例#22
0
 def test_set_sp_error(self):
     port = VNXHbaPort.create('Z', 3)
     assert_that(port.is_valid(), equal_to(False))
     assert_that(port.sp, none())
示例#23
0
 def test_create_tuple_input(self):
     inputs = ('a', 5)
     port = VNXHbaPort.create(*inputs)
     self.assertEqual(VNXSPEnum.SP_A, port.sp)
     self.assertEqual(5, port.port_id)
示例#24
0
 def test_create_tuple_input(self):
     inputs = ('a', 5)
     port = VNXHbaPort.create(*inputs)
     assert_that(port.sp, equal_to(VNXSPEnum.SP_A))
     assert_that(port.port_id, equal_to(5))
示例#25
0
 def test_get_sp_index(self):
     port = VNXHbaPort.create('spb', '5')
     self.assertEqual('b', port.get_sp_index())
     self.assertEqual(5, port.port_id)
示例#26
0
 def test_equal(self):
     spa_1 = VNXHbaPort.create(VNXSPEnum.SP_A, 1)
     spa_1_dup = VNXHbaPort.create(VNXSPEnum.SP_A, 1)
     spa_2 = VNXHbaPort.create(VNXSPEnum.SP_A, 2)
     assert_that(spa_1_dup, equal_to(spa_1))
     assert_that(spa_1, is_not(equal_to(spa_2)))
示例#27
0
 def test_equal(self):
     spa_1 = VNXHbaPort.create(VNXSPEnum.SP_A, 1)
     spa_1_dup = VNXHbaPort.create(VNXSPEnum.SP_A, 1)
     spa_2 = VNXHbaPort.create(VNXSPEnum.SP_A, 2)
     self.assertEqual(spa_1, spa_1_dup)
     self.assertEqual(False, spa_1 == spa_2)
示例#28
0
 def test_repr(self):
     port = VNXHbaPort.create(VNXSPEnum.SP_B, 3)
     ret = port.__repr__()
     assert_that(ret, contains_string('"sp": "VNXSPEnum.SP_B"'))
     assert_that(ret, contains_string('"existed": true'))
示例#29
0
 def test_as_tuple(self):
     port = VNXHbaPort.create(VNXSPEnum.SP_A, 1)
     self.assertEqual(('SP A', 1), port.as_tuple())
示例#30
0
 def test_connection_port_equal_hba_port(self):
     c_port = VNXConnectionPort(sp='a', port_id=4, cli=t_cli())
     h_port = VNXHbaPort.create('a', 4, vport_id=0)
     assert_that(c_port, equal_to(h_port))
示例#31
0
 def test_set_sp(self):
     port = VNXHbaPort.create('A', 3)
     assert_that(port.sp, equal_to(VNXSPEnum.SP_A))
示例#32
0
 def test_repr(self):
     port = VNXHbaPort.create(VNXSPEnum.SP_B, 3)
     self.assertEqual(port.__repr__(),
                      '<VNXPort {sp: SP B, port_id: 3, '
                      'vport_id: 0, host_initiator_list: ()}>')
示例#33
0
 def test_set_sp_error(self):
     port = VNXHbaPort.create('Z', 3)
     assert_that(port.is_valid(), equal_to(False))
     assert_that(port.sp, none())