Skip to content

Commit beaa902

Browse files
committed
test
1 parent fd5aec1 commit beaa902

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

test/integration/models/linode/interfaces/test_interfaces.py

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
LinodeInterfacePublicIPv6RangeOptions,
1515
LinodeInterfacePublicOptions,
1616
LinodeInterfaceVLANOptions,
17+
LinodeInterfaceVPCIPv4AddressOptions,
1718
LinodeInterfaceVPCIPv4Options,
1819
LinodeInterfaceVPCIPv4RangeOptions,
1920
LinodeInterfaceVPCOptions,
@@ -69,6 +70,13 @@ def __assert_vpc(iface: LinodeInterface):
6970

7071
assert len(iface.vpc.ipv4.ranges) == 0
7172

73+
slaac_entry = iface.vpc.ipv6.slaac[0]
74+
assert ipaddress.ip_address(
75+
slaac_entry.address
76+
) in ipaddress.ip_network(slaac_entry.range)
77+
assert not iface.vpc.ipv6.is_public
78+
assert len(iface.vpc.ipv6.ranges) == 0
79+
7280
def __assert_vlan(iface: LinodeInterface):
7381
__assert_base(iface)
7482

@@ -145,19 +153,18 @@ def linode_interface_vpc(
145153
vpc=LinodeInterfaceVPCOptions(
146154
subnet_id=subnet.id,
147155
ipv4=LinodeInterfaceVPCIPv4Options(
148-
# TODO (Enhanced Interfaces): Not currently working as expected
149-
# addresses=[
150-
# LinodeInterfaceVPCIPv4AddressOptions(
151-
# address="auto",
152-
# primary=True,
153-
# nat_1_1_address="any",
154-
# )
155-
# ],
156+
addresses=[
157+
LinodeInterfaceVPCIPv4AddressOptions(
158+
address="auto",
159+
primary=True,
160+
nat_1_1_address=None,
161+
)
162+
],
156163
ranges=[
157164
LinodeInterfaceVPCIPv4RangeOptions(
158165
range="/29",
159166
)
160-
]
167+
],
161168
),
162169
),
163170
), instance, vpc, subnet
@@ -256,7 +263,7 @@ def test_linode_interface_create_vpc(linode_interface_vpc):
256263
assert iface.version
257264

258265
assert iface.default_route.ipv4
259-
assert not iface.default_route.ipv6
266+
assert iface.default_route.ipv6
260267

261268
assert iface.vpc.vpc_id == vpc.id
262269
assert iface.vpc.subnet_id == subnet.id
@@ -267,6 +274,16 @@ def test_linode_interface_create_vpc(linode_interface_vpc):
267274

268275
assert iface.vpc.ipv4.ranges[0].range.split("/")[1] == "29"
269276

277+
assert iface.default_route.ipv6
278+
ipv6 = iface.vpc.ipv6
279+
assert ipv6 and ipv6.is_public is False
280+
281+
if ipv6.slaac:
282+
assert ipv6.ranges == [] and len(ipv6.slaac) == 1
283+
assert ipv6.slaac[0].range and ipv6.slaac[0].address
284+
elif ipv6.ranges:
285+
assert ipv6.slaac == [] and len(ipv6.ranges) > 0
286+
270287

271288
def test_linode_interface_update_vpc(linode_interface_vpc):
272289
iface, instance, vpc, subnet = linode_interface_vpc

0 commit comments

Comments
 (0)