You've already forked ansible-netbox-inventory
test: ipv6 end-to-end scenarios
vm01 gains a primary IPv6 next to its IPv4, one standalone IPv6 address joins the dataset; covers ip_version on both sources, combination with filters, the IPv6-preferring behaviour of netbox's combined primary IP, and the invalid value error path.
This commit is contained in:
21
e2e/seed.py
21
e2e/seed.py
@@ -192,13 +192,13 @@ def seed(url: str, admin_token: str) -> dict[str, str]:
|
||||
},
|
||||
)
|
||||
|
||||
# give vm01 a primary IP: interface -> assigned address -> primary_ip4
|
||||
# give vm01 primary IPs: interface -> assigned addresses -> primary_ip4/6
|
||||
eth0 = api.ensure(
|
||||
"virtualization/interfaces",
|
||||
{"virtual_machine_id": vm01["id"], "name": "eth0"},
|
||||
{"virtual_machine": vm01["id"], "name": "eth0"},
|
||||
)
|
||||
vm01_ip = api.ensure(
|
||||
vm01_ip4 = api.ensure(
|
||||
"ipam/ip-addresses",
|
||||
{"address": "192.0.2.20/24"},
|
||||
{
|
||||
@@ -208,12 +208,27 @@ def seed(url: str, admin_token: str) -> dict[str, str]:
|
||||
"assigned_object_id": eth0["id"],
|
||||
},
|
||||
)
|
||||
api.patch("virtualization/virtual-machines", vm01["id"], {"primary_ip4": vm01_ip["id"]})
|
||||
vm01_ip6 = api.ensure(
|
||||
"ipam/ip-addresses",
|
||||
{"address": "2001:db8::20/64"},
|
||||
{
|
||||
"address": "2001:db8::20/64",
|
||||
"dns_name": "vm01-v6.example.com",
|
||||
"assigned_object_type": "virtualization.vminterface",
|
||||
"assigned_object_id": eth0["id"],
|
||||
},
|
||||
)
|
||||
api.patch(
|
||||
"virtualization/virtual-machines",
|
||||
vm01["id"],
|
||||
{"primary_ip4": vm01_ip4["id"], "primary_ip6": vm01_ip6["id"]},
|
||||
)
|
||||
|
||||
standalone_addresses = [
|
||||
{"address": "192.0.2.10/24", "dns_name": "web.example.com", "tenant": customer1["id"]},
|
||||
{"address": "192.0.2.11/24", "vrf": internal["id"]},
|
||||
{"address": "192.0.2.12/24", "dns_name": "web.example.com"},
|
||||
{"address": "2001:db8::10/64", "dns_name": "v6.example.com"},
|
||||
{
|
||||
"address": "192.0.2.13/24",
|
||||
"dns_name": "db.other.org",
|
||||
|
||||
Reference in New Issue
Block a user