def uuid_reserve(qty=1, get_mac=False): try: conf = _spoke_config(_salt_config('config')) uuid = SpokeHostUUID() result = uuid.modify(qty, get_mac) except error.SpokeError as e: result = common.handle_error(e) return result
def uuid_reserve(qty=1, get_mac=False): try: from spoke.lib.host import SpokeHostUUID uuid = SpokeHostUUID() result = uuid.modify(qty, get_mac) except error.SpokeError as e: result = common.handle_error(e) return result
def test_increment_and_get_multiple_next_free_uuid_and_mac(self): """Get next 4 free uuids and macs; return uuids as list of integers.""" next_uuid = SpokeHostUUID() result = next_uuid.modify(4, get_mac=True) expected_data = ([1, 2, 3, 4], [ '02:00:00:01:00:00', '02:00:00:02:00:00', '02:00:00:03:00:00', '02:00:00:04:00:00' ]) self.assertEquals(result['data'], expected_data)
def test_increment_and_get_multiple_next_free_uuid_and_mac(self): """Get next 4 free uuids and macs; return uuids as list of integers.""" next_uuid = SpokeHostUUID() result = next_uuid.modify(4, get_mac=True) expected_data = ([1, 2, 3, 4], ['02:00:00:01:00:00', '02:00:00:02:00:00', '02:00:00:03:00:00', '02:00:00:04:00:00']) self.assertEquals(result['data'], expected_data)
def test_increment_and_get_multiple_next_free_uuid(self): """Get next 4 free uuids; return uuids as list of integers.""" next_uuid = SpokeHostUUID() result = next_uuid.modify(4) expected_data = [1, 2, 3, 4] self.assertEquals(result['data'], expected_data)
def test_update_and_get_next_free_uuid_mac(self): """Get next free uuid and mac; return as tuple.""" next_uuid = SpokeHostUUID() result = next_uuid.modify(get_mac=True) expected_data = ([1], ['02:00:00:01:00:00']) self.assertEquals(result['data'], expected_data)
def test_update_and_get_next_free_uuid(self): """Get next free uuid; return uuid as list.""" next_uuid = SpokeHostUUID() result = next_uuid.modify() expected_data = [1] self.assertEquals(result['data'], expected_data)