@@ -46,19 +46,21 @@ class OptiondefException(Exception):
4646
4747
4848class Network (object ):
49- def __init__ (self , config , name = None , id = None ):
49+ def __init__ (self , config , name = None , id = None , tags = None ):
5050 """
5151 Create a new high level Network object
5252
5353 :param ns1.config.Config config: config object
5454 :param str name: network name
5555 :param int id: id of an existing Network
56+ :param dict tags: tags of the network
5657 """
5758 self ._rest = Networks (config )
5859 self .config = config
5960 self .name = name
6061 self .id = id
6162 self .report = {}
63+ self .tags = tags
6264 self .data = None
6365
6466 def __repr__ (self ):
@@ -88,6 +90,9 @@ def success(result, *args):
8890 self .name = result ["name" ]
8991 self .report = self ._rest .report (self .id )
9092
93+ if "tags" in result :
94+ self .tags = result ["tags" ]
95+
9196 if callback :
9297 return callback (self )
9398 else :
@@ -186,6 +191,7 @@ def __init__(
186191 network = None ,
187192 scope_group = None ,
188193 id = None ,
194+ tags = None ,
189195 ):
190196 """
191197 Create a new high level Address object
@@ -195,6 +201,7 @@ def __init__(
195201 :param str status: planned, assigned
196202 :param Network network: Network Object the address will be part of
197203 :param Scopegroup scope_group: Scopegroup Object that will be associated with the address
204+ :param dict tags: tags of the address
198205 """
199206 self ._rest = Addresses (config )
200207 self .config = config
@@ -206,6 +213,7 @@ def __init__(
206213 self .children = []
207214 self .report = {}
208215 self .data = None
216+ self .tags = tags
209217
210218 def __repr__ (self ):
211219 return "<Address address=%s>" % self .prefix
@@ -237,6 +245,10 @@ def success(result, *args):
237245 # self.scope_group = Scopegroup(config=self.config, id=result['scope_group_id']) NYI
238246 self .report = self ._rest .report (self .id )
239247 children = self ._rest .retrieve_children (self .id )
248+
249+ if "tags" in result :
250+ self .tags = result ["tags" ]
251+
240252 self .children = [
241253 Address (self .config , id = child ["id" ])
242254 for child in children
@@ -390,14 +402,17 @@ def success(result, *args):
390402
391403
392404class Scopegroup (object ):
393- def __init__ (self , config , name = None , service_def_id = None , id = None ):
405+ def __init__ (
406+ self , config , name = None , service_def_id = None , id = None , tags = None
407+ ):
394408 """
395409 Create a new high level Scopegroup object
396410
397411 :param ns1.config.Config config: config object
398412 :param str name: Name of the scope group
399413 :param int service_group_id: id of the service group the scope group is associated with
400414 :param int id: id of the scope group
415+ :param dict tags: tags of the scopegroup
401416 """
402417 self ._rest = Scopegroups (config )
403418 self .config = config
@@ -407,6 +422,7 @@ def __init__(self, config, name=None, service_def_id=None, id=None):
407422 self .name = name
408423 self .dhcp_service_id = service_def_id
409424 self .data = None
425+ self .tags = tags
410426
411427 def __repr__ (self ):
412428 return "<Scopegroup scope_group=%s>" % self .name
@@ -436,6 +452,9 @@ def success(result, *args):
436452 self .dhcp6 = result ["dhcpv6" ]
437453 self .dhcp_service_id = result .get ("dhcp_service_id" )
438454
455+ if "tags" in result :
456+ self .tags = result ["tags" ]
457+
439458 if callback :
440459 return callback (self )
441460 else :
@@ -480,7 +499,7 @@ def success(result, *args):
480499 self .id , callback = success , errback = errback , ** kwargs
481500 )
482501
483- def create (self , dhcp4 , dhcp6 , callback = None , errback = None ):
502+ def create (self , dhcp4 , dhcp6 , callback = None , errback = None , ** kwargs ):
484503 """
485504 :param DHCPOptions dhcp4: DHCPOptions object that contains the settings for dhcp4
486505 :param DHCPOptions dhcp6: DHCPOptions object that contains the settings for dhcp6
@@ -518,6 +537,7 @@ def success(result, *args):
518537 dhcp_service_id = self .dhcp_service_id ,
519538 callback = success ,
520539 errback = errback ,
540+ ** kwargs
521541 )
522542
523543 def reserve (
@@ -582,6 +602,7 @@ def __init__(
582602 reservation_id = None ,
583603 options = None ,
584604 mac = None ,
605+ tags = None ,
585606 ):
586607 """
587608 Create a new high level Reservation object
@@ -592,6 +613,7 @@ def __init__(
592613 :param int reservation_id: id of the reservation
593614 :param list options: dhcp options of the reservation
594615 :param str mac: mac address of the reservation
616+ :param dict tags: tags of the reservation
595617 """
596618 self ._rest = Reservations (config )
597619 self .config = config
@@ -600,6 +622,7 @@ def __init__(
600622 self .address_id = address_id
601623 self .mac = mac
602624 self .data = None
625+ self .tags = tags
603626
604627 if options is None :
605628 options = DHCPOptions ("dhcpv4" , {})
@@ -642,6 +665,9 @@ def success(result, *args):
642665 self .mac = result ["mac" ]
643666 self .options = result ["options" ]
644667
668+ if "tags" in result :
669+ self .tags = result ["tags" ]
670+
645671 if callback :
646672 return callback (self )
647673 else :
@@ -818,7 +844,13 @@ def success(result, *args):
818844
819845class Scope (object ):
820846 def __init__ (
821- self , config , scopegroup_id , address_id , scope_id = None , options = None
847+ self ,
848+ config ,
849+ scopegroup_id ,
850+ address_id ,
851+ scope_id = None ,
852+ options = None ,
853+ tags = None ,
822854 ):
823855 """
824856 Create a new high level Scope object
@@ -828,12 +860,14 @@ def __init__(
828860 :param int address_id: id of the address the scope is associated with
829861 :param int scope_id: id of the scope
830862 :param DHCPOptions options: DHCPOptions object that contains the settings for the scope
863+ :param dict tags: tags of the scope
831864 """
832865 self ._rest = Scopes (config )
833866 self .config = config
834867 self .scopegroup_id = scopegroup_id
835868 self .address_id = address_id
836869 self .id = scope_id
870+ self .tags = tags
837871
838872 if options is None :
839873 options = DHCPOptions ("dhcpv4" , {})
@@ -876,6 +910,9 @@ def success(result, *args):
876910 self .address_id = result ["address_id" ]
877911 self .options = result ["options" ]
878912
913+ if "tags" in result :
914+ self .tags = result ["tags" ]
915+
879916 if callback :
880917 return callback (self )
881918 else :
@@ -919,6 +956,7 @@ def success(result, *args):
919956 self .options ,
920957 callback = success ,
921958 errback = errback ,
959+ ** kwargs
922960 )
923961
924962 def update (
0 commit comments