pyaoscx.dns module

class pyaoscx.dns.Dns(session, vrf_name, domain_name=None, domain_list=None, domain_servers=None, host_v4_address_mapping=None, host_v6_address_mapping=None, uri=None)

Bases: pyaoscx.pyaoscx_module.PyaoscxModule

Provide configuration management for DNS on AOS-CX devices. As it is a
special module, behaves differently.
apply()
Main method used to either create a new DNS or update an existing DNS,
configuring it inside the Vrf object. Checks whether the DNS exists in the switch. Calls self.update() if DNS configuration is being updated.
Returns:Boolean, True if object was created or modified.
base_uri_vrf = 'system/vrf'
create()

Method not implemented.

delete()

Perform DELETE call to delete DNS.

delete_dns(domain_name=None, domain_list=None, domain_servers=None, host_v4_address_mapping=None, host_v6_address_mapping=None)

Delete DNS client configuration within a Vrf object.

Parameters:
  • domain_name – If value is not None, it is deleted.
  • domain_list – If value is not None, it is deleted.
  • domain_servers – If value is not None, it is deleted.
  • host_v4_address_mapping – If value is not None, it is deleted.
  • host_v6_address_mapping – If value is not None, it is deleted.
Returns:

Returns True if modified.

delete_mgmt_nameservers()

Delete primary and secondary name servers on a mgmt interface.

Returns:Return True if coinfig was modified.
classmethod from_response(session, response_data)

Not applicable for DNS.

classmethod from_uri(session, uri)

Not applicable for DNS.

get(depth=None, selector=None)
Perform a GET call to retrieve data for a DNS inside the VRF table
entry and fill the object with the incoming attributes.
Parameters:
  • depth – Integer deciding how many levels into the API JSON that references will be returned.
  • selector – Alphanumeric option to select specific information to return.
Returns:

Returns True if there is not an exception raised.

classmethod get_all(session)

Method not required for DNS.

get_info_format()

Not applicable for DNS.

get_uri()

Not applicable for DNS.

modified

Return boolean with whether this object has been modified.

setup_dns(domain_name=None, domain_list=None, domain_servers=None, host_v4_address_mapping=None, host_v6_address_mapping=None)

Setup DNS client configuration within a Vrf object.

Parameters:
  • domain_name – Domain name used for name resolution by the DNS client, if ‘dns_domain_list’ is not configured.
  • domain_list – dict of DNS Domain list names to be used for address resolution, keyed by the resolution priority order. Example: { 0: “hpe.com” 1: “arubanetworks.com” }
  • domain_servers – dict of DNS Name servers to be used for address resolution, keyed by the resolution priority order. Example: { 0: “4.4.4.10” 1: “4.4.4.12” }
  • host_v4_address_mapping – dict of static host address configurations and the IPv4 address associated with them. Example: { “host1”: “5.5.44.5” “host2”: “2.2.44.2” }
  • host_v6_address_mapping – dict of static host address configurations and the IPv6 address associated with them. Example: { “host1”: “2001:0db8:85a3:0000:0000:8a2e:0370:7334” }
Returns:

Returns True if modified.

setup_mgmt_nameservers(primary=None, secondary=None)

Setup primary and secondary name servers on a mgmt interface.

Parameters:
  • primary – Primary nameservers on mgmt interface, a IPv4 address. Example: ‘10.10.2.10’.
  • secondary – Secondary nameservers on mgmt interface, a IP address. Example: ‘10.10.2.10’.
Returns:

Return True if coinfig was modified.

update()

Perform a PUT call to apply changes to an existing DNS.

Returns:True if Object was modified and a PUT request was made.
was_modified()

Getter method for the __modified attribute.

Returns:Boolean True if the object was recently modified.