Fix ranges creation, for multipe similar subnets
Change-Id: I7a0e2146da3e5c2fec3a7934a8c472eec74758ef
diff --git a/_modules/maasng.py b/_modules/maasng.py
index 65c5a0f..ace6c90 100644
--- a/_modules/maasng.py
+++ b/_modules/maasng.py
@@ -957,7 +957,7 @@
return ret
-def create_fabric(name, fabric_id, description, update=False):
+def create_fabric(name, description=None, fabric_id=None, update=False):
"""
Create new fabric.
@@ -977,6 +977,7 @@
data['description'] = description
maas = _create_maas_client()
+ json_res = None
try:
if update:
json_res = json.loads(
@@ -1246,7 +1247,7 @@
return ipranges
-def create_iprange(type_range, start_ip, end_ip, comment=None):
+def create_iprange(type_range, start_ip, end_ip, subnet=None, comment=None):
"""
Create ip range
@@ -1265,6 +1266,9 @@
}
if comment:
data['comment'] = comment
+ if subnet:
+ subnet_id = list_subnets()[subnet]['id']
+ data['subnet'] = str(subnet_id)
maas = _create_maas_client()
_name = "Type:{}: {}-{}".format(type_range, start_ip, end_ip)
try: