5.6.5.13. 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, id=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)

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, id=None, subnet=None, **args)

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)

Create multiple logical ports in a transaction

createphysicalnetwork(type='vlan', id=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)

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, name, vhost='', systemid='%', bridge='%', **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)

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, cidr, id=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_ip, remote_ip, ...}] Per host configuration, will union with public info when used
Returns:

A dictionary of information of the subnet.

createsubnets(subnets)

Create multiple subnets in a transaction.

deletelogicalnetwork(id)

Delete logical network

deletelogicalnetworks(networks)

Delete logical networks

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

Delete logical port

deletelogicalports(ports)

Delete multiple logical ports

deletephysicalnetwork(id)

Delete physical network with specified ID

Parameters:id – Physical network ID
Returns:{"status": "OK"}
deletephysicalnetworks(networks)

Delete multiple physical networks with a transaction

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

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)

Delete multiple physical ports in a transaction

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

Delete subnet

deletesubnets(subnets)

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, **kwargs)

Update logical network attributes of the ID

updatelogicalnetworks(networks)

Update multiple logical networks in a transaction

updatelogicalport(id, **kwargs)

Update attributes of the specified logical port

updatelogicalports(ports)

Update multiple logcial ports

updatephysicalnetwork(id, **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)

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, vhost='', systemid='%', bridge='%', **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)

Update multiple physical ports with a transaction

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

Update subnet attributes

updatesubnets(subnets)

Update multiple subnets