autonet_cumulus.tasks.interface¶
Module Contents¶
Functions¶
|
Returns the VLAN ID portion of the SVI name. |
|
|
|
Parses the summary string from an interface and returns |
|
Parses the data from the |
|
Determine the type of interface represented by the interface name |
|
Parses the summary string from the interface to determine master |
|
Generates the base command for interface configuration. |
|
Parses a list of CIDR notated addresses into a list of |
|
Parses the interface data and builds a |
|
Parses the interface data and builds a |
|
Parses the interface name and data and returns a populated |
|
Parses the results of several commands to generate a complete list |
|
Generate a list of commands to configure an interface for bridging. |
|
Generate a list of commands to configure an interface for routing. |
|
Generate a list of commands that will configure basic interface |
|
Generate a list of commands required to create an interface |
|
Generate a list of commands required to update an interface. |
|
Generate a list of commands required to create an interface. |
|
Generate a list of commands required to update an interface's |
|
Create a list of commands to destroy or reset and interface, as |
- autonet_cumulus.tasks.interface.parse_svi_name(name: str) int¶
Returns the VLAN ID portion of the SVI name.
- Parameters:
name – The SVI interface name.
- Returns:
- autonet_cumulus.tasks.interface.parse_speed(speed: str) Union[Tuple[int, str], Tuple[None, None]]¶
- autonet_cumulus.tasks.interface.parse_summary(summary: str) Tuple[Optional[str], Optional[str]]¶
Parses the summary string from an interface and returns a tuple that represents the master interface and its state or
None, None, if there is no master interface.- Parameters:
summary –
- Returns:
- autonet_cumulus.tasks.interface.parse_vrf_names(show_int_data: dict) [str]¶
Parses the data from the
show interfacecommand and returns a list of vrf names present.- Parameters:
show_int_data – The data returned from
show interface- Returns:
- autonet_cumulus.tasks.interface.get_interface_type(int_name, int_data)¶
Determine the type of interface represented by the interface name or in the case of some many virtual interface types, the interface data object. Command will return a string value that can be used in the NETd command string. If the interface data indicates the interface does not exist at all, then None is returned.
- Parameters:
int_name – The interface name.
int_data – The interface data object.
- Returns:
- autonet_cumulus.tasks.interface.get_interface_master(summary: str) Optional[str]¶
Parses the summary string from the interface to determine master device name. If the string is parsed successfully the master device name is returned, otherwise None is returned.
- Parameters:
summary – Interface summary string.
- Returns:
- autonet_cumulus.tasks.interface.get_base_command(int_name: str, int_type: str, action: str = 'add') str¶
Generates the base command for interface configuration.
- Parameters:
int_name – The interface name.
int_type – The interface type.
action – The action to take, add or del.
- Returns:
- autonet_cumulus.tasks.interface.get_interface_addresses(addresses: [str], virtual: bool = False, virtual_type: Optional[str] = None) [autonet.core.objects.interfaces.InterfaceAddress]¶
Parses a list of CIDR notated addresses into a list of :py:class`InterfaceAddress` objects.
- Parameters:
addresses –
virtual –
virtual_type –
- Returns:
- autonet_cumulus.tasks.interface.get_route_attributes(int_data: dict, vrf_list: [str], subint_data: dict = None) autonet.core.objects.interfaces.InterfaceRouteAttributes¶
Parses the interface data and builds a
InterfaceRouteAttributesobject. In the case of an SVI with an EVPN anycast gateway the -v0 interface’s data can be passed via thesubint_dataargument.- Parameters:
int_data – The interface data from show interface.
vrf_list – A list of VRF names.
subint_data – The interface data that corresponds to the data passed to the
int_dataargument.
- Returns:
- autonet_cumulus.tasks.interface.get_bridge_attributes(int_data: dict) autonet.core.objects.interfaces.InterfaceBridgeAttributes¶
Parses the interface data and builds a
InterfaceBridgeAttributesobject. :param int_data: The interface data fromshow interface. :return:
- autonet_cumulus.tasks.interface.get_interface(int_name: str, int_data: dict, subint_data: dict = None, vrf_list: [str] = None) autonet.core.objects.interfaces.Interface¶
Parses the interface name and data and returns a populated
Interfaceobject. In the case of SVIs, the optionalsubint_datawould be used to pass in the interface data for the -v0 subinterface that is used for EVPN anycast gateways.- Parameters:
int_name – The interface name.
int_data – The interface data from
show interface.subint_data – The interface data that corresponds to the data passed to the
int_dataargument.vrf_list – A list of VRF names.
- Returns:
- autonet_cumulus.tasks.interface.get_interfaces(show_int_data: dict, int_name: str = None) [autonet.core.objects.interfaces.Interface]¶
Parses the results of several commands to generate a complete list of
Interfaceobjects. Ifinterface_nameis provided then only oneInterfaceobject is returned.- Parameters:
show_int_data – Data from the
show interfacecommand.int_name – Filter results to only include the provided interface.
- autonet_cumulus.tasks.interface.generate_bridge_commands(attributes: autonet.core.objects.interfaces.InterfaceBridgeAttributes, add_base: str, del_base: str) [str]¶
Generate a list of commands to configure an interface for bridging.
- Parameters:
attributes – An
InterfaceBridgeAttributesobject.add_base – The base command returned from
get_base_command()for configuration adds.del_base – The base command returned from
get_base_command()for configuration deletes.
- Returns:
- autonet_cumulus.tasks.interface.generate_route_commands(attributes: autonet.core.objects.interfaces.InterfaceRouteAttributes, add_base: str, del_base: str) [str]¶
Generate a list of commands to configure an interface for routing.
- Parameters:
attributes – An
InterfaceRouteAttributesobject.add_base – The base command returned from
get_base_command()for configuration adds.del_base – The base command returned from
get_base_command()for configuration deletes.
- Returns:
- autonet_cumulus.tasks.interface.generate_basic_interface_commands(interface: autonet.core.objects.interfaces.Interface, add_base: str, del_base: str) [str]¶
Generate a list of commands that will configure basic interface attributes such as MTU and description.
- Parameters:
interface – An
Interfaceobject.add_base – The base command returned from
get_base_command()for configuration adds.del_base – The base command returned from
get_base_command()for configuration deletes.
- Returns:
- autonet_cumulus.tasks.interface.generate_create_interface_commands(interface: autonet.core.objects.interfaces.Interface, int_type: str) [str]¶
Generate a list of commands required to create an interface configuration from unconfigured state.
- Parameters:
interface – An
Interfaceobject.int_type – An interface type returned from :py:func`get_interface_type`.
- Returns:
- autonet_cumulus.tasks.interface.generate_update_interface_commands(interface: autonet.core.objects.interfaces.Interface, int_type: str, update: bool = False) [str]¶
Generate a list of commands required to update an interface.
- Parameters:
interface – An
interfaceobject.int_type – An interface type returned from :py:func`get_interface_type`.
update – Indicate that the interface is to be updated instead of overwritten.
- Returns:
- autonet_cumulus.tasks.interface.generate_create_commands(interface: autonet.core.objects.interfaces.Interface, int_type: str) [str]¶
Generate a list of commands required to create an interface.
- Parameters:
interface – An
Interfaceobject.int_type – The type of interface, vlan, bond, vrf, etc.
- Returns:
- autonet_cumulus.tasks.interface.generate_update_commands(interface: autonet.core.objects.interfaces.Interface, int_type: str, update: bool = False) [str]¶
Generate a list of commands required to update an interface’s configuration.
- Parameters:
interface – An
Interfaceobject.int_type – The type of interface, vlan, bond, vrf, etc.
update – When True, unset interface properties will be ignored instead of overwritten with default values.
- Returns:
- autonet_cumulus.tasks.interface.generate_delete_commands(int_name: str, int_type: str) [str]¶
Create a list of commands to destroy or reset and interface, as appropriate.
- Parameters:
int_name – The interface name.
int_type – The interface type.
- Returns: