def test__switch_static_to_already_used_ip_address(self):
interface = factory.make_Interface(INTERFACE_TYPE.PHYSICAL)
subnet = factory.make_Subnet(vlan=interface.vlan)
static_ip = factory.make_StaticIPAddress(
alloc_type=IPADDRESS_TYPE.STICKY,
ip=factory.pick_ip_in_Subnet(subnet),
subnet=subnet, interface=interface)
other_interface = factory.make_Interface(INTERFACE_TYPE.PHYSICAL)
used_ip_address = factory.pick_ip_in_Subnet(
subnet, but_not=[static_ip.ip])
factory.make_StaticIPAddress(
alloc_type=IPADDRESS_TYPE.STICKY,
ip=used_ip_address,
subnet=subnet, interface=other_interface)
with ExpectedException(StaticIPAddressUnavailable):
interface.update_ip_address(
static_ip, INTERFACE_LINK_TYPE.STATIC, subnet,
ip_address=used_ip_address)
评论列表
文章目录