Exemplo n.º 1
0
def delete_bridge(bridge, dev):
    if device_exists(bridge):
        if interface_in_bridge(bridge, dev):
            processutils.execute('brctl', 'delif', bridge, dev)

        ip_lib.set(bridge, state='down')
        processutils.execute('brctl', 'delbr', bridge)
Exemplo n.º 2
0
def create_veth_pair(dev1_name, dev2_name, mtu):
    """Create a pair of veth devices with the specified names,
    deleting any previous devices with those names.
    """
    for dev in [dev1_name, dev2_name]:
        _delete_net_dev(dev)

    ip_lib.add(dev1_name, 'veth', peer=dev2_name)
    for dev in [dev1_name, dev2_name]:
        ip_lib.set(dev, state='up')
        ip_lib.set(dev, promisc='on')
        _update_device_mtu(dev, mtu)
Exemplo n.º 3
0
def set_interface_state(interface_name, port_state):
    ip_lib.set(interface_name, state=port_state, check_exit_code=[0, 2, 254])
Exemplo n.º 4
0
def _set_device_mtu(dev, mtu):
    """Set the device MTU."""
    ip_lib.set(dev, mtu=mtu, check_exit_code=[0, 2, 254])
Exemplo n.º 5
0
def _ip_cmd_set(*args, **kwargs):
    ip_lib.set(*args, **kwargs)