salt.modules.openvswitch module

Support for Open vSwitch - module with basic Open vSwitch commands.

Suitable for setting up Openstack Neutron.

codeauthor

Jiri Kotlin <jiri.kotlin@ultimum.io>

salt.modules.openvswitch.bridge_create(br, may_exist=True)

Creates a new bridge.

Parameters
  • br -- A string - bridge name

  • may_exist -- Bool, if False - attempting to create a bridge that exists returns False.

Returns

True on success, else False.

New in version 2016.3.0.

CLI Example: .. code-block:: bash

salt '*' openvswitch.bridge_create br0

salt.modules.openvswitch.bridge_delete(br, if_exists=True)

Deletes bridge and all of its ports.

Parameters
  • br -- A string - bridge name

  • if_exists -- Bool, if False - attempting to delete a bridge that does not exist returns False.

Returns

True on success, else False.

New in version 2016.3.0.

CLI Example: .. code-block:: bash

salt '*' openvswitch.bridge_delete br0

salt.modules.openvswitch.bridge_exists(br)

Tests whether bridge exists as a real or fake bridge.

Returns

True if Bridge exists, else False.

New in version 2016.3.0.

CLI Example: .. code-block:: bash

salt '*' openvswitch.bridge_exists br0

salt.modules.openvswitch.bridge_list()

Lists all existing real and fake bridges.

Returns

List of bridges (or empty list), False on failure.

New in version 2016.3.0.

CLI Example: .. code-block:: bash

salt '*' openvswitch.bridge_list

salt.modules.openvswitch.interface_get_options(port)

Port's interface's optional parameters.

Parameters

port -- A string - port name.

Returns

String containing optional parameters of port's interface, False on failure.

New in version 2016.3.0.

CLI Example: .. code-block:: bash

salt '*' openvswitch.interface_get_options tap0

salt.modules.openvswitch.interface_get_type(port)

Type of port's interface.

Parameters

port -- A string - port name.

Returns

String - type of interface or empty string, False on failure.

New in version 2016.3.0.

CLI Example: .. code-block:: bash

salt '*' openvswitch.interface_get_type tap0

salt.modules.openvswitch.port_add(br, port, may_exist=False, internal=False)

Creates on bridge a new port named port.

Returns

True on success, else False.

Parameters
  • br -- A string - bridge name

  • port -- A string - port name

  • may_exist -- Bool, if False - attempting to create a port that exists returns False.

  • internal -- A boolean to create an internal interface if one does not exist.

New in version 2016.3.0.

CLI Example: .. code-block:: bash

salt '*' openvswitch.port_add br0 8080

salt.modules.openvswitch.port_create_gre(br, port, id, remote)

Generic Routing Encapsulation - creates GRE tunnel between endpoints.

Parameters
  • br -- A string - bridge name.

  • port -- A string - port name.

  • id -- An integer - unsigned 32-bit number, tunnel's key.

  • remote -- A string - remote endpoint's IP address.

Returns

True on success, else False.

New in version 2016.3.0.

CLI Example: .. code-block:: bash

salt '*' openvswitch.port_create_gre br0 gre1 5001 192.168.1.10

salt.modules.openvswitch.port_create_vlan(br, port, id, internal=False)

Isolate VM traffic using VLANs.

Parameters
  • br -- A string - bridge name.

  • port -- A string - port name.

  • id -- An integer in the valid range 0 to 4095 (inclusive), name of VLAN.

  • internal -- A boolean to create an internal interface if one does not exist.

Returns

True on success, else False.

New in version 2016.3.0.

CLI Example: .. code-block:: bash

salt '*' openvswitch.port_create_vlan br0 tap0 100

salt.modules.openvswitch.port_create_vxlan(br, port, id, remote, dst_port=None)

Virtual eXtensible Local Area Network - creates VXLAN tunnel between endpoints.

Parameters
  • br -- A string - bridge name.

  • port -- A string - port name.

  • id -- An integer - unsigned 64-bit number, tunnel's key.

  • remote -- A string - remote endpoint's IP address.

  • dst_port -- An integer - port to use when creating tunnelport in the switch.

Returns

True on success, else False.

New in version 2016.3.0.

CLI Example: .. code-block:: bash

salt '*' openvswitch.port_create_vxlan br0 vx1 5001 192.168.1.10 8472

salt.modules.openvswitch.port_get_tag(port)

Lists tags of the port.

Parameters

port -- A string - port name.

Returns

List of tags (or empty list), False on failure.

New in version 2016.3.0.

CLI Example: .. code-block:: bash

salt '*' openvswitch.port_get_tag tap0

salt.modules.openvswitch.port_list(br)

Lists all of the ports within bridge.

Parameters

br -- A string - bridge name.

Returns

List of bridges (or empty list), False on failure.

New in version 2016.3.0.

CLI Example: .. code-block:: bash

salt '*' openvswitch.port_list br0

salt.modules.openvswitch.port_remove(br, port, if_exists=True)

Deletes port.

Parameters
  • br -- A string - bridge name (If bridge is None, port is removed from whatever bridge contains it)

  • port -- A string - port name.

  • if_exists -- Bool, if False - attempting to delete a por that does not exist returns False. (Default True)

Returns

True on success, else False.

New in version 2016.3.0.

CLI Example: .. code-block:: bash

salt '*' openvswitch.port_remove br0 8080