Skip to content

Commit 67bf93f

Browse files
committed
TPT-4708: Expose NodeBalancer backend IPv6 prefix
1 parent 6761293 commit 67bf93f

7 files changed

Lines changed: 25 additions & 3 deletions

File tree

‎linode_api4/objects/nodebalancer.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ class NodeBalancer(Base):
269269
"locks": Property(unordered=True),
270270
"type": Property(),
271271
"backend_connectivity": Property(),
272+
"backend_ipv6_prefix": Property(),
272273
}
273274

274275
# create derived objects

‎test/fixtures/linode_instances_123_nodebalancers.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"label": "balancer12345",
1111
"type": "premium",
1212
"backend_connectivity": "ipv6",
13+
"backend_ipv6_prefix": "2600:3c22:1:20:0:3039::/96",
1314
"region": "us-east",
1415
"tags": [
1516
"example tag",

‎test/fixtures/nodebalancers.json‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"tags": ["something"],
1414
"locks": ["cannot_delete_with_subresources"],
1515
"type": "premium",
16-
"backend_connectivity": "ipv6"
16+
"backend_connectivity": "ipv6",
17+
"backend_ipv6_prefix": "2600:3c22:1:20:0:3039::/96"
1718
},
1819
{
1920
"created": "2018-01-01T00:01:01",
@@ -28,7 +29,8 @@
2829
"tags": [],
2930
"locks": [],
3031
"type": "premium",
31-
"backend_connectivity": "ipv6"
32+
"backend_connectivity": "ipv6",
33+
"backend_ipv6_prefix": null
3234
}
3335
],
3436
"results": 2,

‎test/fixtures/nodebalancers_123456.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
"cannot_delete_with_subresources"
1616
],
1717
"type": "premium",
18-
"backend_connectivity": "ipv6"
18+
"backend_connectivity": "ipv6",
19+
"backend_ipv6_prefix": "2600:3c22:1:20:0:3039::/96"
1920
}

‎test/integration/models/nodebalancer/test_nodebalancer.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ def test_create_nb(test_linode_client, e2e_test_firewall):
115115
assert 5 == nb.client_udp_sess_throttle
116116
assert nb.type == "premium"
117117
assert nb.backend_connectivity == "ipv6"
118+
assert nb.backend_ipv6_prefix is None or isinstance(
119+
nb.backend_ipv6_prefix, str
120+
)
118121

119122
nb.delete()
120123

‎test/unit/linode_client_test.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,6 +1601,7 @@ def test_create_with_type_and_backend_connectivity(self):
16011601
"label": "my-premium-nb",
16021602
"type": "premium",
16031603
"backend_connectivity": "ipv6",
1604+
"backend_ipv6_prefix": "2600:3c22:1:20:0:3039::/96",
16041605
"region": "us-east",
16051606
}
16061607
) as m:
@@ -1634,6 +1635,10 @@ def test_create_with_type_and_backend_connectivity(self):
16341635
self.assertEqual(nb.id, 1234)
16351636
self.assertEqual(nb.type, "premium")
16361637
self.assertEqual(nb.backend_connectivity, "ipv6")
1638+
self.assertEqual(
1639+
nb.backend_ipv6_prefix, "2600:3c22:1:20:0:3039::/96"
1640+
)
1641+
self.assertNotIn("backend_ipv6_prefix", m.call_data)
16371642

16381643
def test_create_with_vpc_backend_connectivity(self):
16391644
"""

‎test/unit/objects/nodebalancers_test.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ def test_get(self):
188188
self.assertEqual(nb._populated, True)
189189
self.assertEqual(nb.type, "premium")
190190
self.assertEqual(nb.backend_connectivity, "ipv6")
191+
self.assertEqual(nb.backend_ipv6_prefix, "2600:3c22:1:20:0:3039::/96")
191192

192193
def test_update(self):
193194
"""
@@ -244,6 +245,7 @@ def test_type_and_backend_connectivity_not_in_put(self):
244245
self.assertEqual(m.call_url, "/nodebalancers/123456")
245246
self.assertNotIn("type", m.call_data)
246247
self.assertNotIn("backend_connectivity", m.call_data)
248+
self.assertNotIn("backend_ipv6_prefix", m.call_data)
247249
self.assertEqual(m.call_data["label"], "new-label")
248250

249251
def test_firewalls(self):
@@ -258,6 +260,13 @@ def test_firewalls(self):
258260
self.assertEqual(m.call_url, firewalls_url)
259261
self.assertEqual(len(result), 1)
260262

263+
def test_backend_ipv6_prefix_null(self):
264+
"""
265+
Test that a NodeBalancer can have a null backend IPv6 prefix.
266+
"""
267+
nb = NodeBalancer(self.client, 123457)
268+
self.assertIsNone(nb.backend_ipv6_prefix)
269+
261270
def test_config_rebuild(self):
262271
"""
263272
Test that you can rebuild the cofig of a node balancer.

0 commit comments

Comments
 (0)