5.6.5.14. vlcp.service.sdn.viperflow

Note

This document is generated from the source file.

View Source on GitHub

exception vlcp.service.sdn.viperflow.UpdateConflictException(desc='db update conflict')
__init__(desc='db update conflict')

Initialize self. See help(type(self)) for accurate signature.

class vlcp.service.sdn.viperflow.ViperFlow(server)

Standard network model for L2 SDN

__init__(server)

Constructor

createlogicalnetwork(physicalnetwork: str, id: (<class 'str'>, None) = None, **kwargs)

Create logical network

Parameters:
  • physicalnetwork – physical network ID that contains this logical network
  • id – logical network ID. If ommited an UUID is generated.
  • **kwargs

    customized options for logical network creation. Common options include:

    vni/vxlan
    Specify VNI / VLAN tag for VXLAN / VLAN network. If omitted, an unused VNI / VLAN tag is picked automatically.
    mtu
    MTU value for this network. You can use 1450 for VXLAN networks.
Returns:

A dictionary of information of the created logical port

createlogicalnetworks(networks: [{'physicalnetwork': <class 'str'>, '?id': <class 'str'>, '?vni': (<class 'int'>, extra(<class 'str'>)), '?vxlan': (<class 'int'>, extra(<class 'str'>)), '?mtu': (<class 'int'>, extra(<class 'str'>)), '?dns_nameservers': ([extra(<class 'str'>)], None), '?domain_name': (<class 'str'>, None), '?ntp_servers': ([extra(<class 'str'>)], None), '?lease_time': ((<class 'int'>, extra(<class 'str'>)), extra(<class 'str'>), None), '?extra_dhcp_options': extra([tuple_(((<class 'int'>, extra(<class 'str'>)), <class 'object'>))])}])

Create multiple logical networks in a transaction.

Parameters:networks – a list of createlogicalnetwork parameters.
Returns:a list of dictionaries for the created logical networks.
createlogicalport(logicalnetwork: str, id: (<class 'str'>, None) = None, subnet: (<class 'str'>, None) = None, **kwargs)

Create logical port

Parameters:
  • logicalnetwork – logical network containing this port
  • id – logical port id. If omitted an UUID is created.
  • subnet – subnet containing this port
  • **kwargs

    customized options for creating logical ports. Common options are:

    mac_address
    port MAC address
    ip_address
    port IP address
Returns:

a dictionary for the logical port

createlogicalports(ports: [{'?id': <class 'str'>, 'logicalnetwork': <class 'str'>, '?subnet': <class 'str'>, '?mac_address': extra(<class 'str'>), '?ip_address': extra(<class 'str'>), '?hostname': (<class 'str'>, None), '?extra_dhcp_options': extra([tuple_(((<class 'int'>, extra(<class 'str'>)), <class 'object'>))])}])

Create multiple logical ports in a transaction

createphysicalnetwork(type: str = 'vlan', id: (<class 'str'>, None) = None, **kwargs)

Create physical network.

Parameters:
  • type – Network type, usually one of vlan, vxlan, local, native
  • id – Specify the created physical network ID. If omitted or None, an UUID is generated.
  • **kwargs

    extended creation parameters. Look for the document of the corresponding driver. Common options include:

    vnirange
    list of [start,end] ranges like [[1000,2000]]. Both start and end are included. It specifies the usable VNI ranges for VXLAN network.
    vlanrange
    list of [start,end] ranges like [[1000,2000]]. Both start and end are included. It specifies the usable VLAN tag ranges for VLAN network.
Returns:

A dictionary of information of the created physical network.

createphysicalnetworks(networks: [{'?id': <class 'str'>, 'type': <class 'str'>, '?vnirange': [tuple_((<class 'int'>, <class 'int'>))], '?vlanrange': [tuple_((<class 'int'>, <class 'int'>))]}])

Create multiple physical networks in a transaction.

Parameters:networks – each should be a dictionary contains all the parameters in createphysicalnetwork
Returns:A list of dictionaries of information of the created physical networks.
createphysicalport(physicalnetwork: str, name: str, vhost: str = '', systemid: str = '%', bridge: str = '%', **kwargs)

Create physical port

Parameters:
  • physicalnetwork – physical network this port is in.
  • name – port name of the physical port, should match the name in OVSDB
  • vhost – only match ports for the specified vHost
  • systemid – only match ports on this systemid; or ‘%’ to match all systemids.
  • bridge – only match ports on bridges with this name; or ‘%’ to match all bridges.
  • **kwargs – customized creation options, check the driver document
Returns:

A dictionary containing information of the created physical port.

createphysicalports(ports: [{'physicalnetwork': <class 'str'>, 'name': <class 'str'>, '?vhost': <class 'str'>, '?systemid': <class 'str'>, '?bridge': <class 'str'>}])

Create multiple physical ports in a transaction

Parameters:ports – A list of dictionaries, each contains all parameters for createphysicalport
Returns:A list of dictionaries of information of the created physical ports
createsubnet(logicalnetwork: str, cidr: extra(<class 'str'>), id: (<class 'str'>, None) = None, **kwargs)

Create a subnet for the logical network.

Parameters:
  • logicalnetwork – The logical network is subnet is in.
  • cidr – CIDR of this subnet like "10.0.1.0/24"
  • id – subnet ID. If omitted, an UUID is generated.
  • **kwargs

    customized creating options. Common options are:

    gateway
    Gateway address for this subnet
    allocated_start
    First IP of the allowed IP range.
    allocated_end
    Last IP of the allowed IP range.
    host_routes
    A list of [dest_cidr, via] like [["192.168.1.0/24", "192.168.2.3"],["192.168.3.0/24","192.168.2.4"]]. This creates static routes on the subnet.
    isexternal
    This subnet can forward packet to external physical network
    pre_host_config
    A list of [{systemid, bridge, cidr, local_address, gateway, ...}] Per host configuration, will union with public info when used
Returns:

A dictionary of information of the subnet.

createsubnets(subnets: [{'?id': <class 'str'>, 'logicalnetwork': <class 'str'>, 'cidr': extra(<class 'str'>), '?gateway': extra(<class 'str'>), '?allocated_start': extra(<class 'str'>), '?allocated_end': extra(<class 'str'>), '?host_routes': [tuple_((extra(<class 'str'>), extra(<class 'str'>)))], '?isexternal': <class 'bool'>, '?pre_host_config': [{'?systemid': <class 'str'>, '?bridge': <class 'str'>, '?vhost': <class 'str'>, '?cidr': extra(<class 'str'>), '?local_address': extra(<class 'str'>), '?gateway': extra(<class 'str'>)}], '?mtu': (<class 'int'>, extra(<class 'str'>)), '?dns_nameservers': ([extra(<class 'str'>)], None), '?domain_name': (<class 'str'>, None), '?ntp_servers': ([extra(<class 'str'>)], None), '?lease_time': ((<class 'int'>, extra(<class 'str'>)), extra(<class 'str'>), None), '?extra_dhcp_options': extra([tuple_(((<class 'int'>, extra(<class 'str'>)), <class 'object'>))])}])

Create multiple subnets in a transaction.

deletelogicalnetwork(id: str)

Delete logical network

deletelogicalnetworks(networks: [{'id': <class 'str'>}])

Delete logical networks

Parameters:networks – a list of {"id":id}
Returns:{"status": "OK"}
deletelogicalport(id: str)

Delete logical port

deletelogicalports(ports: [{'id': <class 'str'>}])

Delete multiple logical ports

deletephysicalnetwork(id: str)

Delete physical network with specified ID

Parameters:id – Physical network ID
Returns:{"status": "OK"}
deletephysicalnetworks(networks: [{'id': <class 'str'>}])

Delete multiple physical networks with a transaction

Parameters:networks – a list of {"id": <id>} dictionaries.
Returns:{"status": "OK"}
deletephysicalport(name: str, vhost: str = '', systemid: str = '%', bridge: str = '%')

Delete a physical port

Parameters:
  • name – physical port name.
  • vhost – physical port vHost.
  • systemid – physical port systemid.
  • bridge – physcial port bridge.
Returns:

{"status": "OK"}

deletephysicalports(ports: [{'name': <class 'str'>, '?vhost': <class 'str'>, '?systemid': <class 'str'>, '?bridge': <class 'str'>}])

Delete multiple physical ports in a transaction

Delete a physical port
Parameters:ports – a list of deletephysicalport parameters
Returns:{"status": "OK"}
deletesubnet(id: str)

Delete subnet

deletesubnets(subnets: [{'id': <class 'str'>}])

Delete multiple subnets

listlogicalnetworks(id=None, physicalnetwork=None, **kwargs)

Query logical network information

Parameters:
  • id – If specified, only return the logical network with the specified ID.
  • physicalnetwork – If specified, only return logical networks in this physical network.
  • **kwargs – customized filters, only return a logical network if the attribute value of this logical network matches the specified value.
Returns:

A list of dictionaries each stands for a matched logical network

listlogicalports(id=None, logicalnetwork=None, **kwargs)

Query logical port

Parameters:
  • id – If specified, returns only logical port with this ID.
  • logicalnetwork – If specified, returns only logical ports in this network.
  • **kwargs – customzied filters
Returns:

return matched logical ports

listphysicalnetworks(id=None, **kwargs)

Query physical network information

Parameters:
  • id – If specified, only return the physical network with the specified ID.
  • **kwargs – customized filters, only return a physical network if the attribute value of this physical network matches the specified value.
Returns:

A list of dictionaries each stands for a matched physical network

listphysicalports(name=None, physicalnetwork=None, vhost='', systemid='%', bridge='%', **kwargs)

Query physical port information

Parameters:
  • name – If specified, only return the physical port with the specified name.
  • physicalnetwork – If specified, only return physical ports in that physical network
  • vhost – If specified, only return physical ports for that vHost.
  • systemid – If specified, only return physical ports for that systemid.
  • bridge – If specified, only return physical ports for that bridge.
  • **kwargs – customized filters, only return a physical network if the attribute value of this physical network matches the specified value.
Returns:

A list of dictionaries each stands for a matched physical network

listsubnets(id=None, logicalnetwork=None, **kwargs)

Query subnets

Parameters:
  • id – if specified, only return subnet with this ID
  • logicalnetwork – if specified, only return subnet in the network
  • **kwargs – customized filters
Returns:

A list of dictionaries each stands for a matched subnet.

load(container)

Load module

updatelogicalnetwork(id: str, **kwargs)

Update logical network attributes of the ID

updatelogicalnetworks(networks: [{'id': <class 'str'>, '?vni': (<class 'int'>, extra(<class 'str'>)), '?vxlan': (<class 'int'>, extra(<class 'str'>)), '?mtu': (<class 'int'>, extra(<class 'str'>)), '?dns_nameservers': ([extra(<class 'str'>)], None), '?domain_name': (<class 'str'>, None), '?ntp_servers': ([extra(<class 'str'>)], None), '?lease_time': ((<class 'int'>, extra(<class 'str'>)), extra(<class 'str'>), None), '?extra_dhcp_options': extra([tuple_(((<class 'int'>, extra(<class 'str'>)), <class 'object'>))])}])

Update multiple logical networks in a transaction

updatelogicalport(id: str, **kwargs)

Update attributes of the specified logical port

updatelogicalports(ports: [{'id': <class 'str'>, '?mac_address': extra(<class 'str'>), '?ip_address': extra(<class 'str'>), '?hostname': (<class 'str'>, None), '?extra_dhcp_options': extra([tuple_(((<class 'int'>, extra(<class 'str'>)), <class 'object'>))])}])

Update multiple logcial ports

updatephysicalnetwork(id: str, **kwargs)

Update physical network with the specified ID.

Parameters:
  • id – physical network ID
  • **kwargs – attributes to be updated, usually the same attributes for creating.
Returns:

A dictionary of information of the updated physical network.

updatephysicalnetworks(networks: [{'id': <class 'str'>, '?vnirange': [tuple_((<class 'int'>, <class 'int'>))], '?vlanrange': [tuple_((<class 'int'>, <class 'int'>))]}])

Update multiple physical networks in a transaction

Parameters:networks – a list of dictionaries, each contains parameters of updatephysicalnetwork
Returns:A list of dictionaries of information of the updated physical network.
updatephysicalport(name: str, vhost: str = '', systemid: str = '%', bridge: str = '%', **args)

Update physical port

Parameters:
  • name – Update physical port with this name.
  • vhost – Update physical port with this vHost.
  • systemid – Update physical port with this systemid.
  • bridge – Update physical port with this bridge name.
  • **kwargs – Attributes to be updated
Returns:

Updated result as a dictionary.

updatephysicalports(ports: [{'name': <class 'str'>, '?vhost': <class 'str'>, '?systemid': <class 'str'>, '?bridge': <class 'str'>}])

Update multiple physical ports with a transaction

Parameters:ports – a list of updatephysicalport parameters
Returns:Updated result as a list of dictionaries.
updatesubnet(id: str, **kwargs)

Update subnet attributes

updatesubnets(subnets: [{'id': <class 'str'>, '?cidr': extra(<class 'str'>), '?gateway': extra(<class 'str'>), '?allocated_start': extra(<class 'str'>), '?allocated_end': extra(<class 'str'>), '?host_routes': [tuple_((extra(<class 'str'>), extra(<class 'str'>)))], '?pre_host_config': [{'?systemid': <class 'str'>, '?bridge': <class 'str'>, '?vhost': <class 'str'>, '?cidr': extra(<class 'str'>), '?local_address': extra(<class 'str'>), '?gateway': extra(<class 'str'>)}], '?mtu': (<class 'int'>, extra(<class 'str'>)), '?dns_nameservers': ([extra(<class 'str'>)], None), '?domain_name': (<class 'str'>, None), '?ntp_servers': ([extra(<class 'str'>)], None), '?lease_time': ((<class 'int'>, extra(<class 'str'>)), extra(<class 'str'>), None), '?extra_dhcp_options': extra([tuple_(((<class 'int'>, extra(<class 'str'>)), <class 'object'>))])}])

Update multiple subnets