3.2. Function Module List¶
VLCP function modules are classes that can be loaded to / unloaded from the server dynamically.
With different modules loaded, VLCP can provide very different functions. Users may decide which
functions they would like to use by configurating server.startup
configuration.
3.2.1. Server Start/Stop and Modules¶
When VLCP server starts, all startup modules in server.startup
are loaded into
server and started. They each start their own routines to provide their services.
Some modules have dependencies on other modules, the dependencies are automatically
started first.
The server.startup
configuration is a tuple of loading paths of modules.
A module is actually a Python class derived from vlcp.service.module.Module
.
The loading path of a module is the full path of the Python module file contains the
class, followed by a dot and the class name, like vlcp.service.connection.httpserver.HttpServer
.
The module name of a module is the lower-cased class name, like httpserver
.
VLCP modules with the same module name cannot be loaded or used together.
Server stop when all the routines stop, this is usually when:
- All connections and server sockets are closed, and all pended jobs are done
- The server receives an end signal (SIGINT, SIGTERM) and stops all the routines
- All modules are unloaded
3.2.2. Module API¶
Modules provide functions through a lot of methods, the most important one of which is the Module API. Module APIs are methods exposed by the module to be called from other modules, or directly from the end user.
Parameters for Module APIs are always provided with keyword-arguments: arguments positions do not matter.
3.2.2.1. Call Module API from WebAPI¶
A management module webapi exposes all module APIs through a management HTTP service. Through this management function, you can call module APIs with curl:
curl -g -d 'param1=value1¶m2=value2' \
'http://localhost:8081/modulename/apiname'
The URL path of the request should be /modulename/apiname, where modulename is the module name i.e. the lower-cased class name, and apiname is the API name i.e. the lower-cased method name.
By default, the management API supports HTTP GET (with query string), HTTP POST (with standard form data), and HTTP POST with JSON-format POST data. Though use the HTTP GET/POST format is usually the easiest way to call the API in Shell command-line, when integrating with other systems JSON-format POST may be more convient.
`` quoted expression is a VLCP-specified extension. Some APIs need data types other than strings for its parameters. When a string parameter is quoted by ``, VLCP recognizes it as a literal expression in Python. You may use numbers, string, tuples, list, dictionary, sets and any combinations of them in a quoted expression:
curl -g -d 'complexparam=`[1,2,{"name":("value",set(1,2,3))}]`' \
'http://localhost:8081/modulename/apiname'
Make sure to surround the `` expression with ‘’ to prevent it from excuting as a shell command.
Also notice that ‘[]’ have special meanings in curl, that is why we use -g
option to turn it off.
The return value of the module API is formatted with JSON-format, return with {"result": <data...>}
format. If any error occurs, the HTTP request returns a 4xx or 5xx HTTP status, with a JSON body
{"error": "<errormessage>"}
. Exception details can be found in system logs.
3.2.2.2. Call Module API from Debugging Console¶
When using debugging console module console, you can use callapi() method to call module APIs easily in the debugging console as other modules. This method accepts keyword-arguments. for example:
for m in callapi(container, "objectdb", "getonce",key="xx"):
yield m
will call objectdb module api getonce.
Note
debugging console module will also start telnet server on localhost:9923 you can choose telnet it when server run in daemon mode.
3.2.2.3. Module API Discovery¶
Every module supports a special API discovery
. When discovery is called, a list of supported endpoints
and their descriptions are returned. With an extra parameter details=true
, it also returns information
for arguments and their default values. For example, you can call:
curl -g 'http://localhost:8081/viperflow/discover?details=true' | python -m json.tool
To view the API details of module viperflow.
3.2.3. Dynamic Load / Unload / Reload Modules¶
If manager module is loaded, you can use its APIs to load, unload or reload modules on the fly. When reloading modules, the files containing VLCP module classes are reloaded to use the latest code on disk, so it is possible to upgrade modules without stopping the service.
Note
This should be considered as an advanced feature. Not all modules are strictly tested against reloading. Use this function with caution.
3.2.4. All Module List¶
These are modules currently shipped with VLCP and vlcp-docker-plugin.
Note
This is a generated list. Not all module APIs are designed to be used by end users directly. Lots of them are providing services for other modules.
- scriptmodule
- httpserver
- jsonrpcserver
- openflowserver
- redisdb
- zookeeperdb
- console
- objectdb
- redisnotifier
- manager
- webapi
- arpresponder
- dhcpserver
- icmpresponder
- ioprocessing
- l2switch
- l3router
- openflowmanager
- openflowportmanager
- ovsdbmanager
- ovsdbportmanager
- networklocaldriver
- networknativedriver
- networkvlandriver
- networkvxlandriver
- viperflow
- vrouterapi
- vtepcontroller
- vxlancast
- vxlanvtep
- autoload
- knowledge
- remotecall
- session
- static
- dockerplugin
3.2.4.1. scriptmodule¶
Loading Path | vlcp.scripts.script.ScriptModule |
Class Reference | vlcp.scripts.script.ScriptModule |
Dependencies | (None) |
Base script module
3.2.4.2. httpserver¶
Loading Path | vlcp.service.connection.httpserver.HttpServer |
Class Reference | vlcp.service.connection.httpserver.HttpServer |
Dependencies | (None) |
Create HTTP server on specified URLs, vHosts are supported.
API List
-
httpserver/getservers (vhost=None)
Return current servers
Parameters: vhost – return only servers of vhost if specified. ‘’ to return only default servers. None for all servers.
-
httpserver/stoplisten (vhost=None)
Stop listen on current servers
Parameters: vhost – return only servers of vhost if specified. ‘’ to return only default servers. None for all servers.
-
httpserver/startlisten (vhost=None)
Start listen on current servers
Parameters: vhost – return only servers of vhost if specified. ‘’ to return only default servers. None for all servers.
-
httpserver/updateconfig ()
Reload configurations, remove non-exist servers, add new servers, and leave others unchanged
-
httpserver/getconnections (vhost=None)
Return accepted connections, optionally filtered by vhost
3.2.4.3. jsonrpcserver¶
Loading Path | vlcp.service.connection.jsonrpcserver.JsonRPCServer |
Class Reference | vlcp.service.connection.jsonrpcserver.JsonRPCServer |
Dependencies | (None) |
Create JsonRPC server on specified URLs, vHosts are supported.
API List
-
jsonrpcserver/getservers (vhost=None)
Return current servers
Parameters: vhost – return only servers of vhost if specified. ‘’ to return only default servers. None for all servers.
-
jsonrpcserver/stoplisten (vhost=None)
Stop listen on current servers
Parameters: vhost – return only servers of vhost if specified. ‘’ to return only default servers. None for all servers.
-
jsonrpcserver/startlisten (vhost=None)
Start listen on current servers
Parameters: vhost – return only servers of vhost if specified. ‘’ to return only default servers. None for all servers.
-
jsonrpcserver/updateconfig ()
Reload configurations, remove non-exist servers, add new servers, and leave others unchanged
-
jsonrpcserver/getconnections (vhost=None)
Return accepted connections, optionally filtered by vhost
3.2.4.4. openflowserver¶
Loading Path | vlcp.service.connection.openflowserver.OpenflowServer |
Class Reference | vlcp.service.connection.openflowserver.OpenflowServer |
Dependencies | (None) |
Create OpenFlow server on specified URLs, vHosts are supported.
API List
-
openflowserver/getservers (vhost=None)
Return current servers
Parameters: vhost – return only servers of vhost if specified. ‘’ to return only default servers. None for all servers.
-
openflowserver/stoplisten (vhost=None)
Stop listen on current servers
Parameters: vhost – return only servers of vhost if specified. ‘’ to return only default servers. None for all servers.
-
openflowserver/startlisten (vhost=None)
Start listen on current servers
Parameters: vhost – return only servers of vhost if specified. ‘’ to return only default servers. None for all servers.
-
openflowserver/updateconfig ()
Reload configurations, remove non-exist servers, add new servers, and leave others unchanged
-
openflowserver/getconnections (vhost=None)
Return accepted connections, optionally filtered by vhost
3.2.4.5. redisdb¶
Loading Path | vlcp.service.connection.redisdb.RedisDB |
Class Reference | vlcp.service.connection.redisdb.RedisDB |
Dependencies | (None) |
Create redis clients to connect to redis server
API List
-
redisdb/getservers (vhost=None)
Return current servers
Parameters: vhost – return only servers of vhost if specified. ‘’ to return only default servers. None for all servers.
-
redisdb/stoplisten (vhost=None)
Stop listen on current servers
Parameters: vhost – return only servers of vhost if specified. ‘’ to return only default servers. None for all servers.
-
redisdb/startlisten (vhost=None)
Start listen on current servers
Parameters: vhost – return only servers of vhost if specified. ‘’ to return only default servers. None for all servers.
-
redisdb/updateconfig ()
Reload configurations, remove non-exist servers, add new servers, and leave others unchanged
-
redisdb/getconnections (vhost=None)
Return accepted connections, optionally filtered by vhost
-
redisdb/getclient (vhost='')
Return a tuple of
(redisclient, encoder, decoder)
for specified vhost
-
redisdb/get (key, timeout=None, vhost='')
Get value from key
-
redisdb/set (key, value, timeout=None, vhost='')
Set value to key, with an optional timeout
-
redisdb/delete (key, vhost='')
Delete a key from the storage
-
redisdb/mget (keys, vhost='')
Get multiple values from multiple keys
-
redisdb/mgetwithcache (keys, vhost='', cache=None)
Get multiple values, cached when possible
-
redisdb/mset (kvpairs, timeout=None, vhost='')
Set multiple values on multiple keys
-
redisdb/update (key, updater, timeout=None, vhost='')
Update in-place with a custom function
Parameters: - key – key to update
- updater –
func(k,v)
, should return a new value to update, or return None to delete. The function may be call more than once. - timeout – new timeout
Returns: the updated value, or None if deleted
-
redisdb/mupdate (keys, updater, timeout=None, vhost='')
Update multiple keys in-place with a custom function, see update. Either all success, or all fail.
-
redisdb/updateall (keys, updater, timeout=None, vhost='')
Update multiple keys in-place, with a function
updater(keys, values)
which returns(updated_keys, updated_values)
.Either all success or all fail
-
redisdb/updateallwithtime (keys, updater, timeout=None, vhost='')
Update multiple keys in-place, with a function
updater(keys, values, timestamp)
which returns(updated_keys, updated_values)
.Either all success or all fail.
Timestamp is a integer standing for current time in microseconds.
-
redisdb/listallkeys (vhost='')
Return all keys in the KVDB. For management purpose.
3.2.4.6. zookeeperdb¶
Loading Path | vlcp.service.connection.zookeeperdb.ZooKeeperDB |
Class Reference | vlcp.service.connection.zookeeperdb.ZooKeeperDB |
Dependencies | (None) |
Create zookeeper clients to connect to redis server
API List
-
zookeeperdb/getservers (vhost=None)
Return current servers
Parameters: vhost – return only servers of vhost if specified. ‘’ to return only default servers. None for all servers.
-
zookeeperdb/stoplisten (vhost=None)
Stop listen on current servers
Parameters: vhost – return only servers of vhost if specified. ‘’ to return only default servers. None for all servers.
-
zookeeperdb/startlisten (vhost=None)
Start listen on current servers
Parameters: vhost – return only servers of vhost if specified. ‘’ to return only default servers. None for all servers.
-
zookeeperdb/updateconfig ()
Reload configurations, remove non-exist servers, add new servers, and leave others unchanged
-
zookeeperdb/getconnections (vhost=None)
Return accepted connections, optionally filtered by vhost
-
zookeeperdb/getclient (vhost='')
Return a tuple of
(zookeeperclient, encoder, decoder)
for specified vhost
-
zookeeperdb/get (key, timeout=None, vhost='')
Get value from key
-
zookeeperdb/set (key, value, timeout=None, vhost='')
Set value to key, with an optional timeout
-
zookeeperdb/delete (key, vhost='')
Delete a key from the storage
-
zookeeperdb/mget (keys, vhost='')
Get multiple values from multiple keys
-
zookeeperdb/mgetwithcache (keys, vhost='', cache=None)
Get multiple values, cached when possible
-
zookeeperdb/mset (kvpairs, timeout=None, vhost='')
Set multiple values on multiple keys
-
zookeeperdb/update (key, updater, timeout=None, vhost='')
Update in-place with a custom function
Parameters: - key – key to update
- updater –
func(k,v)
, should return a new value to update, or return None to delete. The function may be call more than once. - timeout – new timeout
Returns: the updated value, or None if deleted
-
zookeeperdb/mupdate (keys, updater, timeout=None, vhost='')
Update multiple keys in-place with a custom function, see update.
Either all success, or all fail.
-
zookeeperdb/updateall (keys, updater, timeout=None, vhost='')
Update multiple keys in-place, with a function
updater(keys, values)
which returns(updated_keys, updated_values)
.Either all success or all fail
-
zookeeperdb/updateallwithtime (keys, updater, timeout=None, vhost='')
Update multiple keys in-place, with a function
updater(keys, values, timestamp)
which returns(updated_keys, updated_values)
.Either all success or all fail.
Timestamp is a integer standing for current time in microseconds.
-
zookeeperdb/recycle (keys, vhost='')
Recycle extra versions from the specified keys.
-
zookeeperdb/createnotifier (vhost=None)
Create a new notifier object
-
zookeeperdb/listallkeys (vhost='')
Return all keys in the KVDB. For management purpose.
-
zookeeperdb/status (vhost='')
3.2.4.7. console¶
Loading Path | vlcp.service.debugging.console.Console |
Class Reference | vlcp.service.debugging.console.Console |
Dependencies | (None) |
VLCP debugging console.
Besides the normal functions of Python interactive console, Following variables are provided for debugging purpose:
server, manager, container
Following functions can be used to control VLCP running:
callapi, capture, sendevent, subroutine, execute, breakpoint, syscall, resume, debug, restore_console, console_help
For details call console_help()
3.2.4.8. objectdb¶
Loading Path | vlcp.service.kvdb.objectdb.ObjectDB |
Class Reference | vlcp.service.kvdb.objectdb.ObjectDB |
Dependencies |
Abstract transaction layer for KVDB
API List
-
objectdb/mget (keys, requestid, nostale=False)
Get multiple objects and manage them. Return references to the objects.
-
objectdb/get (key, requestid, nostale=False)
Get an object from specified key, and manage the object. Return a reference to the object or None if not exists.
-
objectdb/mgetonce (keys, nostale=False)
Get multiple objects, return copies of them. Referenced objects are not retrieved.
-
objectdb/getonce (key, nostale=False)
Get a object without manage it. Return a copy of the object, or None if not exists. Referenced objects are not retrieved.
-
objectdb/mwatch (keys, requestid, nostale=False)
Try to return all the references, see
watch()
-
objectdb/watch (key, requestid, nostale=False)
Try to find an object and return a reference. Use
reference.isdeleted()
to test whether the object exists. Usereference.wait(container)
to wait for the object to be existed.
-
objectdb/munwatch (keys, requestid)
Cancel management of keys
-
objectdb/unwatch (key, requestid)
Cancel management of a key
-
objectdb/unwatchall (requestid)
Cancel management for all keys that are managed by requestid
-
objectdb/transact (keys, updater, withtime=False, maxtime=60)
Try to update keys in a transact, with an
updater(keys, values)
, which returns(updated_keys, updated_values)
.The updater may be called more than once. If
withtime = True
, the updater should take three parameters:(keys, values, timestamp)
with timestamp as the server time
-
objectdb/watchlist (requestid=None)
Return a dictionary whose keys are database keys, and values are lists of request ids. Optionally filtered by request id
-
objectdb/walk (keys, walkerdict, requestid, nostale=False)
Recursively retrieve keys with customized functions. walkerdict is a dictionary
key->walker(key, obj, walk, save)
.
-
objectdb/gettimestamp ()
Get a timestamp from database server
-
objectdb/asynctransact (asyncupdater, withtime=False, maxretry=None, maxtime=60)
Read-Write transaction with asynchronous operations.
First, the asyncupdater is called with asyncupdater(last_info, container). last_info is the info from last AsyncTransactionLockException. When asyncupdater is called for the first time, last_info = None.
The async updater should be an async function, and return (updater, keys). The updater should be a valid updater function used in transaction API. keys will be the keys used in the transaction.
The async updater can return None to terminate the transaction without exception.
After the call, a transaction is automatically started with the return values of asyncupdater.
updater can raise AsyncTransactionLockException to restart the transaction from asyncupdater.
Parameters: - asyncupdater – An async updater asyncupdater(last_info, container) which returns (updater, keys)
- withtime – Whether the returned updater need a timestamp
- maxretry – Limit the max retried times
- maxtime – Limit the execution time. The transaction is abandoned if still not completed after maxtime seconds.
-
objectdb/writewalk (keys, walker, withtime=False, maxtime=60)
A read-write transaction with walkers
Parameters: - keys – initial keys used in walk. Provide keys already known to be necessary to optimize the transaction.
- walker –
A walker should be walker(walk, write), where walk is a function walk(key)->value to get a value from the database, and write is a function write(key, value) to save value to the database.
A value can be write to a database any times. A walk called after write is guaranteed to retrieve the previously written value.
- withtime – if withtime=True, an extra timestamp parameter is given to walkers, so walker should be walker(walk, write, timestamp)
- maxtime – max execution time of this transaction
-
objectdb/asyncwritewalk (asyncwalker, withtime=False, maxtime=60)
A read-write transaction with walker factory
Parameters: - asyncwalker –
an async function called as asyncwalker(last_info, container) and returns (keys, walker), which are the same as parameters of writewalk
param keys: initial keys used in walk param walker: A walker should be walker(walk, write), where walk is a function walk(key)->value to get a value from the database, and write is a function write(key, value) to save value to the database. A value can be write to a database any times. A walk called after write is guaranteed to retrieve the previously written value.
raise AsyncTransactionLockException in walkers to restart the transaction
- withtime – if withtime=True, an extra timestamp parameter is given to walkers, so walkers should be walker(key, value, walk, write, timestamp)
- maxtime – max execution time of this transaction
- asyncwalker –
3.2.4.9. redisnotifier¶
Loading Path | vlcp.service.kvdb.redisnotifier.RedisNotifier |
Class Reference | vlcp.service.kvdb.redisnotifier.RedisNotifier |
Dependencies |
Update notification with Redis Pub/Sub
API List
-
redisnotifier/createnotifier ()
Create a new notifier object
3.2.4.10. manager¶
Loading Path | vlcp.service.manage.modulemanager.Manager |
Class Reference | vlcp.service.manage.modulemanager.Manager |
Dependencies | (None) |
Manage module loading/unloading. Optionally reload a module when modified.
API List
-
manager/enableautoreload (enabled=True)
Enable or disable auto reload.
Parameters: enabled – enable if True, disable if False
-
manager/activemodules ()
Return current loaded modules
-
manager/reloadmodules (pathlist)
Reload specified modules.
Parameters: pathlist – list of module path
-
manager/loadmodule (path)
Load specified module
Parameters: path – module path (e.g. vlcp.service.connection.httpserver.HttpServer
)
-
manager/unloadmodule (path)
Unload specified module
Parameters: path – module path (e.g. vlcp.service.connection.httpserver.HttpServer
)
3.2.4.11. webapi¶
Loading Path | vlcp.service.manage.webapi.WebAPI |
Class Reference | vlcp.service.manage.webapi.WebAPI |
Dependencies |
Call module API from web. Free access to any module APIs may create serious security problems, make sure to configure this module properly.
3.2.4.12. arpresponder¶
Loading Path | vlcp.service.sdn.arpresponder.ARPResponder |
Class Reference | vlcp.service.sdn.arpresponder.ARPResponder |
Dependencies |
Send ARP respond
API List
-
arpresponder/createproxyarp (connection, arpentries)
Create ARP respond flow for specified ARP entries, each is a tuple
(ip_address, mac_address, logical_network_id, local)
. When local is True, only respond to ARP request from logical port; when local is False, only respond to ARP request from physical port; respond to both else.
-
arpresponder/removeproxyarp (connection, arpentries)
Remove specified ARP entries.
3.2.4.13. dhcpserver¶
Loading Path | vlcp.service.sdn.dhcpserver.DHCPServer |
Class Reference | vlcp.service.sdn.dhcpserver.DHCPServer |
Dependencies |
DHCP server that responds the DHCP discover/request with static IP address settings
API List
-
dhcpserver/gettablerequest ()
Table requirement for this module
3.2.4.14. icmpresponder¶
Loading Path | vlcp.service.sdn.icmpresponder.ICMPResponder |
Class Reference | vlcp.service.sdn.icmpresponder.ICMPResponder |
Dependencies |
Respond ICMP echo (ping) requests to the gateway
API List
-
icmpresponder/gettablerequest ()
Table requirement for this module
3.2.4.15. ioprocessing¶
Loading Path | vlcp.service.sdn.ioprocessing.IOProcessing |
Class Reference | vlcp.service.sdn.ioprocessing.IOProcessing |
Dependencies |
Ingress and Egress processing
API List
-
ioprocessing/gettablerequest ()
Table requirement for this module
3.2.4.16. l2switch¶
Loading Path | vlcp.service.sdn.l2switch.L2Switch |
Class Reference | vlcp.service.sdn.l2switch.L2Switch |
Dependencies |
L2 switch functions
API List
-
l2switch/gettablerequest ()
Table requirement for this module
3.2.4.17. l3router¶
Loading Path | vlcp.service.sdn.l3router.L3Router |
Class Reference | vlcp.service.sdn.l3router.L3Router |
Dependencies |
L3 connectivities with virtual router.
API List
-
l3router/gettablerequest ()
Table requirement for this module
3.2.4.18. openflowmanager¶
Loading Path | vlcp.service.sdn.ofpmanager.OpenflowManager |
Class Reference | vlcp.service.sdn.ofpmanager.OpenflowManager |
Dependencies |
Manage Openflow Connections
API List
-
openflowmanager/getconnections (datapathid, vhost='')
Return all connections of datapath
-
openflowmanager/getconnection (datapathid, auxiliaryid=0, vhost='')
Get current connection of datapath
-
openflowmanager/waitconnection (datapathid, auxiliaryid=0, timeout=30, vhost='')
Wait for a datapath connection
-
openflowmanager/getdatapathids (vhost='')
Get All datapath IDs
-
openflowmanager/getalldatapathids ()
Get all datapath IDs from any vhost. Return
(vhost, datapathid)
pair.
-
openflowmanager/getallconnections (vhost='')
Get all connections from vhost. If vhost is None, return all connections from any host
-
openflowmanager/getconnectionsbyendpoint (endpoint, vhost='')
Get connection by endpoint address (IP, IPv6 or UNIX socket address)
-
openflowmanager/getconnectionsbyendpointname (name, vhost='', timeout=30)
Get connection by endpoint name (Domain name, IP or IPv6 address)
-
openflowmanager/getendpoints (vhost='')
Get all endpoints for vhost
-
openflowmanager/getallendpoints ()
Get all endpoints from any vhost. Return
(vhost, endpoint)
pairs.
-
openflowmanager/acquiretable (modulename)
Start to acquire tables for a module on module loading.
-
openflowmanager/unacquiretable (modulename)
When module is unloaded, stop acquiring tables for this module.
-
openflowmanager/lastacquiredtables (vhost='')
Get acquired table IDs
3.2.4.19. openflowportmanager¶
Loading Path | vlcp.service.sdn.ofpportmanager.OpenflowPortManager |
Class Reference | vlcp.service.sdn.ofpportmanager.OpenflowPortManager |
Dependencies |
Manage Ports from Openflow Protocol
API List
-
openflowportmanager/getports (datapathid, vhost='')
Return all ports of a specifed datapath
-
openflowportmanager/getallports (vhost=None)
Return all
(datapathid, port, vhost)
tuples, optionally filterd by vhost
-
openflowportmanager/getportbyno (datapathid, portno, vhost='')
Return port with specified OpenFlow portno
-
openflowportmanager/waitportbyno (datapathid, portno, timeout=30, vhost='')
Wait for the specified OpenFlow portno to appear, or until timeout.
-
openflowportmanager/getportbyname (datapathid, name, vhost='')
Return port with specified port name
-
openflowportmanager/waitportbyname (datapathid, name, timeout=30, vhost='')
Wait for a port with the specified port name to appear, or until timeout
-
openflowportmanager/resync (datapathid, vhost='')
Resync with current ports
3.2.4.20. ovsdbmanager¶
Loading Path | vlcp.service.sdn.ovsdbmanager.OVSDBManager |
Class Reference | vlcp.service.sdn.ovsdbmanager.OVSDBManager |
Dependencies |
Manage Openflow Connections
API List
-
ovsdbmanager/getconnection (datapathid, vhost='')
Get current connection of datapath
-
ovsdbmanager/waitconnection (datapathid, timeout=30, vhost='')
Wait for a datapath connection
-
ovsdbmanager/getdatapathids (vhost='')
Get All datapath IDs
-
ovsdbmanager/getalldatapathids ()
Get all datapath IDs from any vhost. Return
(vhost, datapathid)
pair.
-
ovsdbmanager/getallconnections (vhost='')
Get all connections from vhost. If vhost is None, return all connections from any host
-
ovsdbmanager/getbridges (connection)
Get all
(dpid, name, _uuid)
tuple on this connection
-
ovsdbmanager/getbridge (connection, name)
Get datapath ID on this connection with specified name
-
ovsdbmanager/getbridgebyuuid (connection, uuid)
Get datapath ID of bridge on this connection with specified _uuid
-
ovsdbmanager/waitbridge (connection, name, timeout=30)
Wait for bridge with specified name appears and return the datapath-id
-
ovsdbmanager/waitbridgebyuuid (connection, uuid, timeout=30)
Wait for bridge with specified _uuid appears and return the datapath-id
-
ovsdbmanager/getsystemids (vhost='')
Get All system-ids
-
ovsdbmanager/getallsystemids ()
Get all system-ids from any vhost. Return
(vhost, system-id)
pair.
-
ovsdbmanager/getconnectionbysystemid (systemid, vhost='')
-
ovsdbmanager/waitconnectionbysystemid (systemid, timeout=30, vhost='')
Wait for a connection with specified system-id
-
ovsdbmanager/getconnectionsbyendpoint (endpoint, vhost='')
Get connection by endpoint address (IP, IPv6 or UNIX socket address)
-
ovsdbmanager/getconnectionsbyendpointname (name, vhost='', timeout=30)
Get connection by endpoint name (Domain name, IP or IPv6 address)
-
ovsdbmanager/getendpoints (vhost='')
Get all endpoints for vhost
-
ovsdbmanager/getallendpoints ()
Get all endpoints from any vhost. Return
(vhost, endpoint)
pairs.
-
ovsdbmanager/getallbridges (vhost=None)
Get all
(dpid, name, _uuid)
tuple for all connections, optionally filtered by vhost
-
ovsdbmanager/getbridgeinfo (datapathid, vhost='')
Get
(bridgename, systemid, bridge_uuid)
tuple from bridge datapathid
-
ovsdbmanager/waitbridgeinfo (datapathid, timeout=30, vhost='')
Wait for bridge with datapathid, and return
(bridgename, systemid, bridge_uuid)
tuple
3.2.4.21. ovsdbportmanager¶
Loading Path | vlcp.service.sdn.ovsdbportmanager.OVSDBPortManager |
Class Reference | vlcp.service.sdn.ovsdbportmanager.OVSDBPortManager |
Dependencies |
Manage Ports from OVSDB Protocol
API List
-
ovsdbportmanager/getports (datapathid, vhost='')
Return all ports of a specifed datapath
-
ovsdbportmanager/getallports (vhost=None)
Return all
(datapathid, port, vhost)
tuples, optionally filterd by vhost
-
ovsdbportmanager/getportbyid (id, vhost='')
Return port with the specified id. The return value is a pair:
(datapath_id, port)
-
ovsdbportmanager/waitportbyid (id, timeout=30, vhost='')
Wait for port with the specified id. The return value is a pair
(datapath_id, port)
-
ovsdbportmanager/getportbyname (datapathid, name, vhost='')
Return port with specified name
-
ovsdbportmanager/waitportbyname (datapathid, name, timeout=30, vhost='')
Wait for port with specified name
-
ovsdbportmanager/getportbyno (datapathid, portno, vhost='')
Return port with specified portno
-
ovsdbportmanager/waitportbyno (datapathid, portno, timeout=30, vhost='')
Wait for port with specified portno
-
ovsdbportmanager/resync (datapathid, vhost='')
Resync with current ports
3.2.4.22. networklocaldriver¶
Loading Path | vlcp.service.sdn.plugins.networklocaldriver.NetworkLocalDriver |
Class Reference | vlcp.service.sdn.plugins.networklocaldriver.NetworkLocalDriver |
Dependencies | (None) |
Network driver for local networks. Local networks cannot have physical ports; logical networks in local networks do not have external connectivities, only endpoints on the same server can access each other.
3.2.4.23. networknativedriver¶
Loading Path | vlcp.service.sdn.plugins.networknativedriver.NetworkNativeDriver |
Class Reference | vlcp.service.sdn.plugins.networknativedriver.NetworkNativeDriver |
Dependencies | (None) |
Network driver for native networks. Native network is a physical network provides only one logical network capacity. Packets from the logical network is directly forwarded to the physical network.
3.2.4.24. networkvlandriver¶
Loading Path | vlcp.service.sdn.plugins.networkvlandriver.NetworkVlanDriver |
Class Reference | vlcp.service.sdn.plugins.networkvlandriver.NetworkVlanDriver |
Dependencies | (None) |
Network driver for VXLAN networks. When creating a VXLAN type physical network,
you must specify an extra option vlanrange
.
3.2.4.25. networkvxlandriver¶
Loading Path | vlcp.service.sdn.plugins.networkvxlandriver.NetworkVxlanDriver |
Class Reference | vlcp.service.sdn.plugins.networkvxlandriver.NetworkVxlanDriver |
Dependencies | (None) |
Network driver for VXLAN networks. When creating a VXLAN type physical network,
you must specify an extra option vnirange
.
3.2.4.26. viperflow¶
Loading Path | vlcp.service.sdn.viperflow.ViperFlow |
Class Reference | vlcp.service.sdn.viperflow.ViperFlow |
Dependencies |
Standard network model for L2 SDN
API List
-
viperflow/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.
-
viperflow/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.
-
viperflow/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.
-
viperflow/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.
-
viperflow/deletephysicalnetwork (id)
Delete physical network with specified ID
Parameters: id – Physical network ID Returns: {"status": "OK"}
-
viperflow/deletephysicalnetworks (networks)
Delete multiple physical networks with a transaction
Parameters: networks – a list of {"id": <id>}
dictionaries.Returns: {"status": "OK"}
-
viperflow/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
-
viperflow/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.
-
viperflow/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
-
viperflow/updatephysicalport (name, vhost='', systemid='%', bridge='%', **kwargs)
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.
-
viperflow/updatephysicalports (ports)
Update multiple physical ports with a transaction
Parameters: ports – a list of updatephysicalport
parametersReturns: Updated result as a list of dictionaries.
-
viperflow/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"}
-
viperflow/deletephysicalports (ports)
Delete multiple physical ports in a transaction
Delete a physical portParameters: ports – a list of deletephysicalport
parametersReturns: {"status": "OK"}
-
viperflow/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
-
viperflow/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
-
viperflow/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.
-
viperflow/updatelogicalnetwork (id, **kwargs)
Update logical network attributes of the ID
-
viperflow/updatelogicalnetworks (networks)
Update multiple logical networks in a transaction
-
viperflow/deletelogicalnetwork (id)
Delete logical network
-
viperflow/deletelogicalnetworks (networks)
Delete logical networks
Parameters: networks – a list of {"id":id}
Returns: {"status": "OK"}
-
viperflow/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
-
viperflow/createlogicalport (logicalnetwork, id=None, subnet=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
-
viperflow/createlogicalports (ports)
Create multiple logical ports in a transaction
-
viperflow/updatelogicalport (id, **kwargs)
Update attributes of the specified logical port
-
viperflow/updatelogicalports (ports)
Update multiple logcial ports
-
viperflow/deletelogicalport (id)
Delete logical port
-
viperflow/deletelogicalports (ports)
Delete multiple logical ports
-
viperflow/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
-
viperflow/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_address, gateway, ...}]
Per host configuration, will union with public info when used
Returns: A dictionary of information of the subnet.
-
viperflow/createsubnets (subnets)
Create multiple subnets in a transaction.
-
viperflow/updatesubnet (id, **kwargs)
Update subnet attributes
-
viperflow/updatesubnets (subnets)
Update multiple subnets
-
viperflow/deletesubnet (id)
Delete subnet
-
viperflow/deletesubnets (subnets)
Delete multiple subnets
-
viperflow/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.
3.2.4.27. vrouterapi¶
Loading Path | vlcp.service.sdn.vrouterapi.VRouterApi |
Class Reference | vlcp.service.sdn.vrouterapi.VRouterApi |
Dependencies |
Standard network model for L3 SDN
API List
-
vrouterapi/createvirtualrouter (id=None, **kwargs)
Create a virtual router
Parameters: - id – Virtual router id. If omitted, an UUID is generated.
- **kwargs – extra attributes for creation.
Returns: A dictionary of information of the virtual router.
-
vrouterapi/createvirtualrouters (routers)
Create multiple virtual routers in a transaction
-
vrouterapi/updatevirtualrouter (id, **kwargs)
Update virtual router
-
vrouterapi/updatevirtualrouters (routers)
Update multiple virtual routers
-
vrouterapi/deletevirtualrouter (id)
Delete virtual router
-
vrouterapi/deletevirtualrouters (routers)
Delete multiple virtual routers
-
vrouterapi/listvirtualrouters (id=None, **kwargs)
Query virtual router
Parameters: - id – if specified, only return virtual router with this ID
- **kwargs – customized filter
Returns: a list of dictionaries each stands for a matched virtual router.
-
vrouterapi/addrouterinterface (router, subnet, id=None, **kwargs)
Connect virtual router to a subnet
Parameters: - router – virtual router ID
- subnet – subnet ID
- id – router port ID
- **kwargs – customized options
Returns: A dictionary of information of the created router port
-
vrouterapi/addrouterinterfaces (interfaces)
Create multiple router interfaces
-
vrouterapi/removerouterinterface (router, subnet)
Remote a subnet from the router
Parameters: - router – virtual router ID
- subnet – subnet ID
Returns: {"status": "OK"}
-
vrouterapi/removerouterinterfaces (interfaces)
Remote multiple subnets from routers
-
vrouterapi/listrouterinterfaces (id, **kwargs)
Query router ports from a virtual router
Parameters: - id – virtual router ID
- **kwargs – customized filters on router interfaces
Returns: a list of dictionaries each stands for a matched router interface
3.2.4.28. vtepcontroller¶
Loading Path | vlcp.service.sdn.vtepcontroller.VtepController |
Class Reference | vlcp.service.sdn.vtepcontroller.VtepController |
Dependencies |
Controll a physical switch which supports OVSDB hardware_vtep protocol.
API List
-
vtepcontroller/listphysicalports (physicalswitch=None)
Get physical ports list from this controller, grouped by physical switch name
Parameters: physicalswitch – physicalswitch name. Return all switches if is None. Returns: dictionary: {physicalswitch: [physicalports]} e.g. {‘ps1’: [‘port1’, ‘port2’]}
-
vtepcontroller/listphysicalswitches (physicalswitch=None)
Get physical switch info
Parameters: physicalswitch – physicalswitch name. Return all switches if is None. Returns: dictionary: {physicalswitch: {key: value}} keys include: management_ips, tunnel_ips, description, switch_fault_status
-
vtepcontroller/updatelogicalswitch (physicalswitch, physicalport, vlanid, logicalnetwork, vni, logicalports)
Bind VLAN on physicalport to specified logical network, and update logical port vxlan info
Parameters: - physicalswitch – physical switch name, should be the name in PhysicalSwitch table of OVSDB vtep database
- physicalport – physical port name, should be the name in OVSDB vtep database
- vlanid – the vlan tag used for this logicalswitch
- logicalnetwork – the logical network id, will also be the logical switch id
- vni – the VXLAN VNI of the logical network
- logicalports – a list of logical port IDs. The VXLAN info of these ports will be updated.
-
vtepcontroller/unbindlogicalswitch (physicalswitch, physicalport, vlanid, logicalnetwork)
Remove bind of a physical port
Parameters: - physicalswitch – physical switch name, should be the name in PhysicalSwitch table of OVSDB vtep database
- physicalport – physical port name, should be the name in OVSDB vtep database
- vlanid – the vlan tag used for this logicalswitch
- logicalnetwork – the logical network id, will also be the logical switch id
-
vtepcontroller/unbindphysicalport (physicalswitch, physicalport)
Remove all bindings for a physical port
Parameters: - physicalswitch – physical switch name, should be the name in PhysicalSwitch table of OVSDB vtep database
- physicalport – physical port name, should be the name in OVSDB vtep database
3.2.4.29. vxlancast¶
Loading Path | vlcp.service.sdn.vxlancast.VXLANCast |
Class Reference | vlcp.service.sdn.vxlancast.VXLANCast |
Dependencies |
VXLAN single-cast and broadcast functions
3.2.4.30. vxlanvtep¶
Loading Path | vlcp.service.sdn.vxlanvtep.VXLANVtep |
Class Reference | vlcp.service.sdn.vxlanvtep.VXLANVtep |
Dependencies | (None) |
Use hardware_vtep instead of software VXLAN
API List
-
vxlanvtep/get_vxlan_bind_info (systemid=None)
get vxlan -> vlan , bind info
3.2.4.31. autoload¶
Loading Path | vlcp.service.utils.autoload.AutoLoad |
Class Reference | vlcp.service.utils.autoload.AutoLoad |
Dependencies | (None) |
Auto load some modules from a package. Usually used to load network plugins.
3.2.4.32. knowledge¶
Loading Path | vlcp.service.utils.knowledge.Knowledge |
Class Reference | vlcp.service.utils.knowledge.Knowledge |
Dependencies | (None) |
Simple KV-cache in memory. A base for other KV-DB. Data is automatically removed after timeout. Use knowledge instead of local storage in modules so data is not lost on module restarting.
API List
-
knowledge/get (key, timeout=None)
Get value from key
-
knowledge/set (key, value, timeout=None)
Set value to key, with an optional timeout
-
knowledge/delete (key)
Delete a key
-
knowledge/mget (keys)
Get multiple values from multiple keys
-
knowledge/mgetwithcache (keys, cache=None)
Get multiple values, cached when possible
-
knowledge/mset (kvpairs, timeout=None)
Set multiple values on multiple keys
-
knowledge/update (key, updater, timeout=None)
Update in-place with a custom function
Parameters: - key – key to update
- updater –
func(k,v)
, should return a new value to update, or return None to delete - timeout – new timeout
Returns: the updated value, or None if deleted
-
knowledge/mupdate (keys, updater, timeout=None)
Update multiple keys in-place one by one with a custom function, see update. Either all success, or all fail.
-
knowledge/updateall (keys, updater, timeout=None)
Update multiple keys in-place, with a function
updater(keys, values)
which returns(updated_keys, updated_values)
. Either all success or all fail
-
knowledge/updateallwithtime (keys, updater, timeout=None)
Update multiple keys in-place, with a function
updater(keys, values, timestamp)
which returns(updated_keys, updated_values)
. Either all success or all fail.Timestamp is a integer standing for current time in microseconds.
3.2.4.33. remotecall¶
Loading Path | vlcp.service.utils.remoteapi.RemoteCall |
Class Reference | vlcp.service.utils.remoteapi.RemoteCall |
Dependencies | (None) |
Route local API calls to remote management API.
API List
-
remotecall/call (remote_module, method, timeout, params)
Call remote API
Parameters: - remote_module – target name for the remote module
- method – method name of the API
- timeout – timeout for the call
- params – A dictionary contains all the parameters need for the call
Returns: Return result from the remote call
3.2.4.34. session¶
Loading Path | vlcp.service.utils.session.Session |
Class Reference | vlcp.service.utils.session.Session |
Dependencies |
HTTP Session with cookies
API List
-
session/start (cookies, cookieopts=None)
Session start operation. First check among the cookies to find existed sessions; if there is not an existed session, create a new one.
Parameters: - cookies – cookie header from the client
- cookieopts – extra options used when creating a new cookie
Returns: (session_handle, cookies)
where session_handle is a SessionHandle object, and cookies is a list of created Set-Cookie headers (may be empty)
-
session/create ()
Create a new session object
Returns: Session handle for the created session object.
-
session/get (sessionid, refresh=True)
Get the seesion object of the session id
Parameters: - sessionid – a session ID
- refresh – if True, refresh the expiration time of this session
Returns: Session object or None if not exists
-
session/destroy (sessionid)
Destroy a session
Parameters: sessionid – session ID Returns: a list of Set-Cookie headers to be sent to the client
3.2.4.35. static¶
Loading Path | vlcp.service.web.static.Static |
Class Reference | vlcp.service.web.static.Static |
Dependencies |
Map specified path to local files
API List
-
static/updateconfig ()
Reload configurations, remove non-exist servers, add new servers, and leave others unchanged
3.2.4.36. dockerplugin¶
Loading Path | vlcp_docker.dockerplugin.DockerPlugin |
Class Reference | vlcp_docker.dockerplugin.DockerPlugin |
Dependencies |
Integrate VLCP with Docker
API List
-
dockerplugin/getdockerinfo (portid)
Get docker info for specified port