Merge ~adam-collard/maas-ci/+git/system-tests:reserved-ip-ranges into ~maas-committers/maas-ci/+git/system-tests:master

Proposed by Adam Collard
Status: Merged
Approved by: Adam Collard
Approved revision: 479be697e6cc4cea8bb3ae6c0de09180846eacd3
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~adam-collard/maas-ci/+git/system-tests:reserved-ip-ranges
Merge into: ~maas-committers/maas-ci/+git/system-tests:master
Diff against target: 83 lines (+29/-6)
3 files modified
config.yaml.sample (+7/-4)
systemtests/api.py (+12/-2)
systemtests/region.py (+10/-0)
Reviewer Review Type Date Requested Status
Björn Tillenius Approve
MAAS Lander Approve
Review via email: mp+409146@code.launchpad.net

Commit message

Reserve ranges specified in config.

Description of the change

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b reserved-ip-ranges lp:~adam-collard/maas-ci/+git/system-tests into -b master lp:~maas-committers/maas-ci/+git/system-tests

STATUS: FAILED
LOG: http://maas-ci.internal:8080/job/system-tests-tester/22/consoleText
COMMIT: 7f3c5c056104b6c5c8d62df7844cd800caeced0d

review: Needs Fixing
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b reserved-ip-ranges lp:~adam-collard/maas-ci/+git/system-tests into -b master lp:~maas-committers/maas-ci/+git/system-tests

STATUS: SUCCESS
COMMIT: 479be697e6cc4cea8bb3ae6c0de09180846eacd3

review: Approve
Revision history for this message
Björn Tillenius (bjornt) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/config.yaml.sample b/config.yaml.sample
index 3c00237..fc4655d 100644
--- a/config.yaml.sample
+++ b/config.yaml.sample
@@ -11,8 +11,12 @@ networks:
11 start: 10.5.33.011 start: 10.5.33.0
12 end: 10.5.33.25512 end: 10.5.33.255
13 reserved:13 reserved:
14 start: 10.5.32.114 - start: 10.5.32.1
15 end: 10.5.32.25515 end: 10.5.32.20
16 comment: Reserved for foo
17 - start: 10.5.32.31
18 end: 10.5.32.255
19 comment: Reserved for bar
16# The MAAS deployment. Currently only one container is created that has20# The MAAS deployment. Currently only one container is created that has
17# both the region and rack in it. In the future we want to extend this21# both the region and rack in it. In the future we want to extend this
18# so that you can specify multiple containers, creating a HA setup, or22# so that you can specify multiple containers, creating a HA setup, or
@@ -52,8 +56,7 @@ machines:
52 power_username: ...56 power_username: ...
53 power_password: ...57 power_password: ...
54 mac_address: ec:b1:d7:7f:ef:3458 mac_address: ec:b1:d7:7f:ef:34
55 osystem: windows # This parameter is optional, ubuntu is the default value.59 osystem: windows # This parameter is optional, ubuntu is the default.
56
5760
5861
59# If you want to test installing maas from a snap62# If you want to test installing maas from a snap
diff --git a/systemtests/api.py b/systemtests/api.py
index ab6276d..eac9d7b 100644
--- a/systemtests/api.py
+++ b/systemtests/api.py
@@ -81,9 +81,19 @@ class AuthenticatedAPIClient:
81 )81 )
82 return result82 return result
8383
84 def create_ip_range(self, start: str, end: str, range_type: str) -> dict[str, Any]:84 def create_ip_range(
85 self, start: str, end: str, range_type: str, comment: Optional[str] = None
86 ) -> dict[str, Any]:
87 comment_arg = [f"comment={comment}"] if comment else []
85 ip_range: dict[str, Any] = self.execute(88 ip_range: dict[str, Any] = self.execute(
86 ["ipranges", "create", "type=dynamic", f"start_ip={start}", f"end_ip={end}"]89 [
90 "ipranges",
91 "create",
92 f"type={range_type}",
93 f"start_ip={start}",
94 f"end_ip={end}",
95 ]
96 + comment_arg
87 )97 )
88 return ip_range98 return ip_range
8999
diff --git a/systemtests/region.py b/systemtests/region.py
index 3ef0ab2..85be256 100644
--- a/systemtests/region.py
+++ b/systemtests/region.py
@@ -76,6 +76,13 @@ class MAASRegion:
76 client.create_ip_range(76 client.create_ip_range(
77 network["dynamic"]["start"], network["dynamic"]["end"], "dynamic"77 network["dynamic"]["start"], network["dynamic"]["end"], "dynamic"
78 )78 )
79 for reserved in network.get("reserved", []):
80 client.create_ip_range(
81 reserved["start"],
82 reserved["end"],
83 "reserved",
84 reserved.get("comment"),
85 )
79 client.enable_dhcp(dhcp_fabric, dhcp_vlan, primary_controller)86 client.enable_dhcp(dhcp_fabric, dhcp_vlan, primary_controller)
8087
81 # Wait for the task to complete and create the dhcpd.conf file.88 # Wait for the task to complete and create the dhcpd.conf file.
@@ -101,6 +108,9 @@ class MAASRegion:
101 for ip_range in ip_ranges:108 for ip_range in ip_ranges:
102 if ip_range["start_ip"] == network["dynamic"]["start"]:109 if ip_range["start_ip"] == network["dynamic"]["start"]:
103 client.delete_ip_range(ip_range["id"])110 client.delete_ip_range(ip_range["id"])
111 for reserved in network.get("reserved", []):
112 if ip_range["start_ip"] == reserved["start"]:
113 client.delete_ip_range(ip_range["id"])
104 # Wait for the task to complete and create the dhcpd.conf file.114 # Wait for the task to complete and create the dhcpd.conf file.
105 for _ in range(10):115 for _ in range(10):
106 if not self.is_dhcp_enabled():116 if not self.is_dhcp_enabled():

Subscribers

People subscribed via source and target branches

to all changes: