def test_update(self): parser = get_vnx_parser('VNXConsistencyGroup') data = { parser.NAME.key: 'test cg name', parser.LUN_LIST.key: [1, 5, 7], parser.STATE.key: 'Offline' } cg = VNXConsistencyGroup() cg.update(data) assert_that(cg.name, equal_to('test cg name')) assert_that(cg.lun_list, only_contains(1, 5, 7)) assert_that(cg.state, equal_to('Offline'))
def test_update(self): parser = get_parser_config('VNXConsistencyGroup') data = { parser.NAME.key: 'test cg name', parser.LUN_LIST.key: [1, 5, 7], parser.STATE.key: 'Offline' } cg = VNXConsistencyGroup() cg.update(data) self.assertEqual('test cg name', cg.name) self.assertEqual([1, 5, 7], cg.lun_list) self.assertEqual('Offline', cg.state)
def test_parse(self): output = """ Name: test cg name Name: another cg """ cgs = VNXConsistencyGroup.parse_all(output) assert_that(len(cgs), equal_to(2)) names = [cg.name for cg in cgs] assert_that(names, has_item('test cg name')) assert_that(names, has_item('another cg'))
def test_parse(self): output = """ Name: test cg name Name: another cg """ cgs = VNXConsistencyGroup.parse_all(output) self.assertEqual(2, len(cgs)) names = [cg.name for cg in cgs] assert_that(names, has_item('test cg name')) assert_that(names, has_item('another cg'))
def test_list_consistency_group(self): cg_list = VNXConsistencyGroup.get(t_cli()) assert_that(len(cg_list), equal_to(2)) assert_that(cg_list.name, only_contains('another cg', 'test cg name'))
def test_cg_empty_member_property(self): cg = VNXConsistencyGroup(name='cg0', cli=t_cli()) assert_that(len(cg.lun_list), equal_to(0))
def f(): cg = VNXConsistencyGroup(name="cg2", cli=t_cli()) cg.create_snap('cg1_snap')
def create_cg(self, name, members=None): return VNXConsistencyGroup.create(self._cli, name=name, members=members)
def test_has_member(self): cg = VNXConsistencyGroup('test_cg', t_cli()) lun = VNXLun(lun_id=1) assert_that(cg.has_member(lun), equal_to(True)) assert_that(cg.has_member(7), equal_to(False))
def f(): cg = VNXConsistencyGroup(name="test_cg", cli=t_cli()) with cg.with_no_poll(): cg.add_member(1, 2, 3)
def delete_cg(self, name): self._delete_resource(VNXConsistencyGroup(name, self._cli))
def test_update_consistency_group_list_member(self): cg_list = VNXConsistencyGroup.get(t_cli()) cg = cg_list[1] name = cg.name cg.update() assert_that(cg.name, equal_to(name))
def f(): cg = VNXConsistencyGroup('test_cg', t_cli()) m1 = VNXLun(name='m1', cli=t_cli()) m2 = VNXLun(name='m2', cli=t_cli()) cg.add_member(m1, m2)
def test_properties(self): cg = VNXConsistencyGroup(name="test_cg", cli=t_cli()) assert_that(cg.name, equal_to('test_cg')) assert_that(cg.lun_list.lun_id, only_contains(1, 3)) assert_that(cg.state, equal_to('Ready')) assert_that(cg.existed, equal_to(True))
def f(): cg = VNXConsistencyGroup(name="cg1", cli=t_cli()) cg.add_member(1)
def f(): VNXConsistencyGroup.create(cli=t_cli(), name='cg0')
def f(): cg = VNXConsistencyGroup(cli=t_cli(), name='cg0') cg.delete()
def get_cg(self, name=None): return VNXConsistencyGroup.get(self._cli, name)
def test_create_cg_snap_success(self): cg = VNXConsistencyGroup(name="cg1", cli=t_cli()) snap = cg.create_snap('cg1_snap') assert_that(snap._name, equal_to('cg1_snap')) assert_that(snap.source_luns, only_contains(1)) assert_that(snap.source_cg, equal_to('cg1'))
def remove_cg(self, name): self._remove_resource(VNXConsistencyGroup(name, self._cli))
def test_list_consistency_group(self): assert_that(len(VNXConsistencyGroup.get(t_cli())), equal_to(2))