text
stringlengths
0
828
``'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'``.
:param str shell: Shell name to execute commands.
If ``None``, use the Engine Node default shell.
""""""
assert portlbl
assert ip_interface(addr)
port = enode.ports[portlbl]
cmd = 'ip addr del {addr} dev {port}'.format(addr=addr, port=port)
response = enode(cmd, shell=shell)
assert not response"
1999,"def add_route(enode, route, via, shell=None):
""""""
Add a new static route.
:param enode: Engine node to communicate with.
:type enode: topology.platforms.base.BaseNode
:param str route: Route to add, an IP in the form ``'192.168.20.20/24'``
or ``'2001::0/24'`` or ``'default'``.
:param str via: Via for the route as an IP in the form
``'192.168.20.20/24'`` or ``'2001::0/24'``.
:param shell: Shell name to execute commands. If ``None``, use the Engine
Node default shell.
:type shell: str or None
""""""
via = ip_address(via)
version = '-4'
if (via.version == 6) or \
(route != 'default' and ip_network(route).version == 6):
version = '-6'
cmd = 'ip {version} route add {route} via {via}'.format(
version=version, route=route, via=via
)
response = enode(cmd, shell=shell)
assert not response"
2000,"def 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.
:param enode: Engine node to communicate with.
:type enode: topology.platforms.base.BaseNode
:param str portlbl: Port label to configure. Port label will be mapped
automatically.
:param str name: specifies the name of the new virtual device.
:param str vlan_id: specifies the VLAN identifier.
:param str shell: Shell name to execute commands. If ``None``, use the
Engine Node default shell.
""""""
assert name
if name in enode.ports:
raise ValueError('Port {name} already exists'.format(name=name))
assert portlbl
assert vlan_id
port = enode.ports[portlbl]
cmd = 'ip link add link {dev} name {name} type vlan id {vlan_id}'.format(
dev=port, name=name, vlan_id=vlan_id)
response = enode(cmd, shell=shell)
assert not response, 'Cannot add virtual link {name}'.format(name=name)
enode.ports[name] = name"
2001,"def 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.
:param enode: Engine node to communicate with.
:type enode: topology.platforms.base.BaseNode
:param str name: specifies the name of the new
virtual device.
:param str shell: Shell name to execute commands. If ``None``, use the
Engine Node default shell.
""""""
assert name
if name not in enode.ports:
raise ValueError('Port {name} doesn\'t exists'.format(name=name))
cmd = 'ip link del link dev {name}'.format(name=name)
response = enode(cmd, shell=shell)
assert not response, 'Cannot remove virtual link {name}'.format(name=name)
del enode.ports[name]"
2002,"def show_interface(enode, dev, shell=None):
""""""
Show the configured parameters and stats of an interface.
:param enode: Engine node to communicate with.