data module¶
Module ‘data’ is concerned with the connected network and related data.
-
class
data.
DefinedPath
(name, src_ip, dst_ip, priority, idle_timeout, hard_timeout, time=None)¶ Bases:
object
A data container for a custom user-defined traffic path.
-
add_datapath
(dpid, of_version, in_port, out_port)¶ Add a datapath to the defined path.
Parameters: - dpid (string) – DPID of the datapath.
- of_version (string) – OpenFlow version of the datapath.
- in_port (int) – Input port at which it matches packets.
- out_port (int) – Output port through which it sends out forwarded packets.
-
-
class
data.
NetworkData
¶ Bases:
object
Provides network connection and stores custom network information.
-
add_path
(src, dst, datapaths, mandatory, optional)¶ Program the given path into the connected network
Parameters: - src (string) – IP address of the source end node.
- dst (string) – IP address of the destination end node.
- datapaths (list of interfaces.Datapath) – A list of datapaths into which flow entries are to be installed.
- mandatory (dictionary) – A dictionary of elementary parameters of the path. Keys: name, priority, idle_timeout, hard_timeout.
- optional (dictionary) – A dictionary of optional parameters of the path. Possible keys: ip_protocol, tcp_src, tcp_dst, udp_src, udp_dst.
Returns: Internal representation of the defined path.
Return type:
-
connect
(interface, ip, username, password)¶ Connect to a network controller using the given interface.
Parameters: - interface (string) – Module name of the controller interface to connect through.
- ip (string) – IP address of the controller server.
- username (string) – Username to log in to the controller.
- password (string) – Password to log in to the controller.
-
classmethod
datapath_level
(datapath)¶ Return the hierarchy level for the given datapath.
Parameters: datapath (interfaces.Datapath) – Datapath to inquire. Returns: - enums.DeviceType – Corresponding device type for the given datapath.
- None – In case the given object is not a datapath.
-
classmethod
datapath_level_change
(datapath, old_level, new_level)¶ Change the hierarchy level of a datapath.
Parameters: - datapath (interfaces.Datapath) – Datapath to change
- old_level (enums.DeviceType) – Old level of the datapath.
- new_level (enums.DeviceType) – New level of the datapath.
-
datapath_levels_alive
()¶ Get live datapaths from the top of the hierarchy.
Returns: - list of interfaces.Datapath – A list of live core datapaths in case any of them are alive. A list of live distribution datapaths in case any of them are alive and no core datapaths are alive.
- None – In case no core or distribution datapaths are alive.
-
datapath_levels_state
()¶ Check whether any core or distribution datapaths are alive.
Returns: True in case there is at least one core or distribution datapath alive. False otherwise. Return type: bool
-
defined_paths
= []¶
-
device_names
= {}¶
-
disconnect
()¶ Disconnect from the controller by losing a reference to it.
-
levels
= {<DeviceType.datapath_distribution: 'datapath_distribution'>: set(), <DeviceType.datapath_core: 'datapath_core'>: set()}¶
-
options
¶ Get a dictionary of available controller interfaces.
Returns: A dictionary with pairs - module name: full name. Ordered by the full name. Return type: OrderedDict
-
update
(interval)¶ Evoke network update and return the result.
Parameters: interval (int) – The interval between individual updates. Returns: A summary of changes in the network. Return type: interfaces.Update
-