topology_lib_ip.library
¶
topology_lib_ip communication library implementation.
Functions¶
interface()
: Configure a interface.remove_ip()
: Remove an IP address from an interface.add_route()
: Add a new static route.add_link_type_vlan()
: Add a new virtual link with the type set to VLAN.remove_link_type_vlan()
: Delete a virtual link.sub_interface()
: Configure a subinterface.show_interface()
: Show the configured parameters and stats of an interface.
-
topology_lib_ip.library.
interface
(enode, portlbl, addr=None, up=None, shell=None)¶ Configure a interface.
All parameters left as
None
are ignored and thus no configuration action is taken for that parameter (left “as-is”).Parameters: - enode (topology.platforms.base.BaseNode) – Engine node to communicate with.
- portlbl (str) – Port label to configure. Port label will be mapped to real port automatically.
- addr (str) – IPv4 or IPv6 address to add to the interface:
- IPv4 address and netmask to assign to the interface in the form
'192.168.20.20/24'
. - IPv6 address and subnets to assign to the interface in the form'2001::1/120'
. - up (bool) – Bring up or down the interface.
- shell (str) – Shell name to execute commands.
If
None
, use the Engine Node default shell.
-
topology_lib_ip.library.
remove_ip
(enode, portlbl, addr, shell=None)¶ Remove an IP address from an interface.
All parameters left as
None
are ignored and thus no configuration action is taken for that parameter (left “as-is”).Parameters: - enode (topology.platforms.base.BaseNode) – Engine node to communicate with.
- portlbl (str) – Port label to configure. Port label will be mapped to real port automatically.
- addr (str) – IPv4 or IPv6 address to remove from the interface:
- IPv4 address to remove from the interface in the form
'192.168.20.20'
or'192.168.20.20/24'
. - IPv6 address to remove from the interface in the form'2001::1'
or'2001::1/120'
. - shell (str) – Shell name to execute commands.
If
None
, use the Engine Node default shell.
-
topology_lib_ip.library.
add_route
(enode, route, via, shell=None)¶ Add a new static route.
Parameters: - enode (topology.platforms.base.BaseNode) – Engine node to communicate with.
- route (str) – Route to add, an IP in the form
'192.168.20.20/24'
or'2001::0/24'
or'default'
. - via (str) – Via for the route as an IP in the form
'192.168.20.20/24'
or'2001::0/24'
. - shell (str or None) – Shell name to execute commands. If
None
, use the Engine Node default shell.
-
topology_lib_ip.library.
add_link_type_vlan
(enode, portlbl, name, vlan_id, shell=None)¶ Add a new virtual link with the type set to VLAN.
Creates a new vlan device {name} on device {port}. Will raise an exception if value is already assigned.
Parameters: - enode (topology.platforms.base.BaseNode) – Engine node to communicate with.
- portlbl (str) – Port label to configure. Port label will be mapped automatically.
- name (str) – specifies the name of the new virtual device.
- vlan_id (str) – specifies the VLAN identifier.
- shell (str) – Shell name to execute commands. If
None
, use the Engine Node default shell.
-
topology_lib_ip.library.
remove_link_type_vlan
(enode, name, shell=None)¶ Delete a virtual link.
Deletes a vlan device with the name {name}. Will raise an expection if the port is not already present.
Parameters:
-
topology_lib_ip.library.
sub_interface
(enode, portlbl, subint, addr=None, up=None, shell=None)¶ Configure a subinterface.
All parameters left as
None
are ignored and thus no configuration action is taken for that parameter (left “as-is”). Sub interfaces can only be configured if the device exists. If you want to enable the sub interface, it will enable the interface as well.Parameters: - enode (topology.platforms.base.BaseNode) – Engine node to communicate with.
- portlbl (str) – Port label to configure. Port label will be mapped to real port automatically.
- subint (str) – The suffix of the interface.
- addr (str) – IPv4 or IPv6 address to add to the interface:
- IPv4 address and netmask to assign to the interface in the form
'192.168.20.20/24'
. - IPv6 address and subnets to assign to the interface in the form'2001::1/120'
. - up (bool) – Bring up or down the interface.
- shell (str) – Shell name to execute commands.
If
None
, use the Engine Node default shell.
-
topology_lib_ip.library.
show_interface
(enode, dev, shell=None)¶ Show the configured parameters and stats of an interface.
Parameters: - enode (topology.platforms.base.BaseNode) – Engine node to communicate with.
- dev (str) – Unix network device name. Ex 1, 2, 3..
Return type: Returns: A combined dictionary as returned by both
topology_lib_ip.parser._parse_ip_addr_show()
topology_lib_ip.parser._parse_ip_stats_link_show()