ns1.ipam¶
A collection of classes that produce IPAM Objects.
-
class
ns1.ipam.Address(config, prefix=None, status=None, network=None, scope_group=None, id=None, tags=None)¶ Bases:
objectCreate a new high level Address object
Parameters: - config (ns1.config.Config) – config object
- prefix (str) – cidr prefix
- status (str) – planned, assigned
- network (Network) – Network Object the address will be part of
- scope_group (Scopegroup) – Scopegroup Object that will be associated with the address
- tags (dict) – tags of the address
-
create(callback=None, errback=None, parent=True, **kwargs)¶ Create a new Address. Pass a list of keywords and their values to configure. For the list of keywords available for address configuration,see
ns1.rest.ipam.Addresses.INT_FIELDSandns1.rest.ipam.Addresses.PASSTHRU_FIELDS
-
delete(callback=None, errback=None)¶ Delete the address and all child addresses
-
load(callback=None, errback=None, reload=False)¶ Load address data from the API.
-
reload(callback=None, errback=None)¶ Reload address data from the API.
-
reserve(scopegroup_id, mac, options=None, callback=None, errback=None)¶ Add scope group reservation. Pass a single Address object and a MAC address as a string
-
update(callback=None, errback=None, parent=True, **kwargs)¶ Update address configuration. Pass a list of keywords and their values to update. For the list of keywords available for address configuration, see
ns1.rest.ipam.Addresses.INT_FIELDSandns1.rest.ipam.Addresses.PASSTHRU_FIELDS
-
exception
ns1.ipam.AddressException¶ Bases:
exceptions.Exception
-
class
ns1.ipam.DHCPOptionValue(key, value, always_send=None)¶ Create the DHCPOptionValue class that can be used as value with
ns1.ipam.DHCPOptions:param key str option name :param value any option value :param always_send bool indicates whether this option be sent back in lease or not
-
generate_option(address_family)¶ Generates dhcp option value with a proper format
:param address_family str one of dhcpv4 or dhcpv6 family name
-
-
class
ns1.ipam.DHCPOptions(address_family, options, server_options=None)¶ Create the DHCP options class that can be used by the IPAM API
Parameters: -
AF= ['dhcpv4', 'dhcpv6']¶
-
OPTIONS= {'dhcpv4': ['bootfile-name', 'domain-name', 'domain-name-servers', 'host-name', 'routers', 'tftp-server-name', 'time-servers', 'vendor-class-identifier'], 'dhcpv6': ['dns-servers']}¶
-
update(address_family, options, server_options=None)¶
-
-
exception
ns1.ipam.DHCPOptionsException¶ Bases:
exceptions.Exception
-
class
ns1.ipam.Lease(config)¶ Bases:
objectCreate a new high level Lease object
Parameters: config (ns1.config.Config) – config object -
load(scope_group_id=None, scope_id=None, limit=None, offset=None, callback=None, errback=None, reload=False)¶ Load Lease data from the API.
-
reload(callback=None, errback=None)¶ Reload Lease data from the API.
-
-
exception
ns1.ipam.LeaseException¶ Bases:
exceptions.Exception
-
class
ns1.ipam.Network(config, name=None, id=None, tags=None)¶ Bases:
objectCreate a new high level Network object
Parameters: - config (ns1.config.Config) – config object
- name (str) – network name
- id (int) – id of an existing Network
- tags (dict) – tags of the network
-
create(callback=None, errback=None, **kwargs)¶ Create a new Network. Pass a list of keywords and their values to configure. For the list of keywords available for network configuration, see
ns1.rest.ipam.Networks.INT_FIELDSandns1.rest.ipam.Networks.PASSTHRU_FIELDS
-
delete(callback=None, errback=None)¶ Delete the Network and all associated addresses
-
load(callback=None, errback=None, reload=False)¶ Load network data from the API.
-
new_address(prefix, status, callback=None, errback=None, **kwargs)¶ Create a new address space in this Network
Parameters: Returns: The newly created Address object
-
reload(callback=None, errback=None)¶ Reload network data from the API.
-
update(callback=None, errback=None, **kwargs)¶ Update Network configuration. Pass a list of keywords and their values to update. For the list of keywords available for zone configuration, see
ns1.rest.ipam.Networks.INT_FIELDSandns1.rest.ipam.Networks.PASSTHRU_FIELDS
-
exception
ns1.ipam.NetworkException¶ Bases:
exceptions.Exception
-
class
ns1.ipam.Optiondef(config, space, key)¶ Bases:
objectCreate a new high level Optiondef object
Parameters: - config (ns1.config.Config) – config object
- space (str) – dhcpv4 or dhcpv6
- key (str) – option key
-
create(callback=None, errback=None, **kwargs)¶ Create a new Optiondef. Pass a list of keywords and their values to configure. For the list of keywords available for address configuration, see
ns1.rest.ipam.Optiondef.INT_FIELDSandns1.rest.ipam.Optiondef.PASSTHRU_FIELDS
-
delete(callback=None, errback=None)¶ Delete the Optiondef
-
load(callback=None, errback=None, reload=False)¶ Load Optiondef data from the API.
-
reload(callback=None, errback=None)¶ Reload OptionDef data from the API.
-
exception
ns1.ipam.OptiondefException¶ Bases:
exceptions.Exception
-
class
ns1.ipam.Reservation(config, scopegroup_id, address_id, reservation_id=None, options=None, mac=None, tags=None)¶ Bases:
objectCreate a new high level Reservation object
Parameters: - config (ns1.config.Config) – config object
- scopegroup_id (int) – id of the scope group
- address_id (int) – id of the address the reservation is associated with
- reservation_id (int) – id of the reservation
- options (list) – dhcp options of the reservation
- mac (str) – mac address of the reservation
- tags (dict) – tags of the reservation
-
create(callback=None, errback=None, **kwargs)¶ Create a new Reservation. Pass a list of keywords and their values to configure. For the list of keywords available for address configuration, see
ns1.rest.ipam.Reservations.INT_FIELDSandns1.rest.ipam.Reservations.PASSTHRU_FIELDS
-
delete(callback=None, errback=None)¶ Delete the Reservation
-
load(callback=None, errback=None, reload=False)¶ Load Reservation data from the API.
-
reload(callback=None, errback=None)¶ Reload Reservation data from the API.
-
update(options, callback=None, errback=None, parent=True, **kwargs)¶ Update reservation configuration. Pass a list of keywords and their values to update. For the list of keywords available for address configuration, see
ns1.rest.ipam.Reservations.INT_FIELDSandns1.rest.ipam.Reservations.PASSTHRU_FIELDS
-
exception
ns1.ipam.ReservationException¶ Bases:
exceptions.Exception
-
class
ns1.ipam.Scope(config, scopegroup_id, address_id, scope_id=None, options=None, tags=None)¶ Bases:
objectCreate a new high level Scope object
Parameters: - config (ns1.config.Config) – config object
- scopegroup_id (int) – id of the scope group
- address_id (int) – id of the address the scope is associated with
- scope_id (int) – id of the scope
- options (DHCPOptions) – DHCPOptions object that contains the settings for the scope
- tags (dict) – tags of the scope
-
create(callback=None, errback=None, **kwargs)¶ Create a new Scope. Pass a list of keywords and their values to configure. For the list of keywords available for address configuration, see
ns1.rest.ipam.Scope.INT_FIELDSandns1.rest.ipam.Reservations.PASSTHRU_FIELDS
-
delete(callback=None, errback=None)¶ Delete the Scope
-
load(callback=None, errback=None, reload=False)¶ Load Reservation data from the API.
-
reload(callback=None, errback=None)¶ Reload Scope data from the API.
-
update(address_id, options, callback=None, errback=None, **kwargs)¶ Update Scope configuration. Pass a list of keywords and their values to update. For the list of keywords available for address configuration, see
ns1.rest.ipam.Scopes.INT_FIELDSandns1.rest.ipam.Scopes.PASSTHRU_FIELDS
-
exception
ns1.ipam.ScopeException¶ Bases:
exceptions.Exception
-
class
ns1.ipam.Scopegroup(config, name=None, service_def_id=None, id=None, tags=None)¶ Bases:
objectCreate a new high level Scopegroup object
Parameters: - config (ns1.config.Config) – config object
- name (str) – Name of the scope group
- service_group_id (int) – id of the service group the scope group is associated with
- id (int) – id of the scope group
- tags (dict) – tags of the scopegroup
-
create(dhcp4, dhcp6, callback=None, errback=None, **kwargs)¶ Parameters: - dhcp4 (DHCPOptions) – DHCPOptions object that contains the settings for dhcp4
- dhcp6 (DHCPOptions) – DHCPOptions object that contains the settings for dhcp6
Create a new Scope Group. Pass a list of keywords and their values to configure. For the list of keywords available for address configuration, see
ns1.rest.ipam.Scopegroups.INT_FIELDSandns1.rest.ipam.Scopegroups.PASSTHRU_FIELDS. For the list of settings seens1.ipan.Scopegroup.SETTINGS. Note that if enabled is True, then valid_lifetime_secs must be set to a value greater than 0.
-
create_scope(address_id, callback=None, errback=None)¶ Add scope group scope. Pass a single Address ID
-
delete(callback=None, errback=None)¶ Delete the Scopegroup and all child addresses
-
load(callback=None, errback=None, reload=False)¶ Load Scopegroup data from the API.
-
reload(callback=None, errback=None)¶ Reload Scopegroup data from the API.
-
reservations¶
-
reserve(address_id, mac, options=None, callback=None, errback=None)¶ Parameters: - address_id (int) – id of the Address to reserve
- options (DHCPOptions) – DHCPOptions object that contains the settings for the address
- str (mac) – MAC address of the reservation
Add scope group reservation. Pass a single Address ID and a MAC address as a string
-
scopes¶
-
update(callback=None, errback=None, **kwargs)¶ Update scope group configuration. Pass a list of keywords and their values to update. For the list of keywords available for address configuration, see
ns1.rest.ipam.Scopegroups.INT_FIELDSandns1.rest.ipam.Scopegroups.PASSTHRU_FIELDS
-
exception
ns1.ipam.ScopegroupException¶ Bases:
exceptions.Exception