topology.manager
¶
topology manager module.
This module takes care of understanding the topology defined in the test suite, commanding its construction to appropriate topology platform plugin and finally commanding its destruction to the plugin also.
Classes¶
TopologyManager
: Main Topology Manager object.
-
class
topology.manager.
TopologyManager
(engine='debug', **kwargs)¶ Main Topology Manager object.
This object is responsible to build a topology given a description.
There is three options to build a topology:
Using the simplified textual description using a Graphviz like syntax. To use this option call the
parse()
.Using a basic Python dictionary to load the description of the topology. To use this option call the
load()
.Build a full NML topology using NML objects and relations and register all the objects in the namespace using the embedded
pynml.manager.ExtendedNMLManager
, for example:mgr = TopologyManager() sw1 = mgr.create_node(name='My Switch 1') sw2 = mgr.create_node(name='My Switch 2') sw1p1 = mgr.create_biport(sw1) # ...
See
pynml.manager.ExtendedNMLManager
for more information of this usage.
Parameters: engine (str) – Name of the platform engine to build the topology. See platforms()
for how to get and discover available platforms.Inheritance
-
build
()¶ Build the topology hold by this manager.
This method instance the platform engine and request the build of the topology defined.
-
get
(identifier)¶ Get a platform engine with given identifier.
Parameters: identifier (str) – The node identifier. Return type: A subclass of topology.platforms.node.BaseNode
Returns: The engine node implementing the communication with the node.
-
is_built
()¶ Check if the current topology was built.
Return type: bool Returns: True if the topology was successfully built.
-
load
(dictmeta, inject=None)¶ Load a topology description in a dictionary format.
Dictionary format:
{ 'nodes': [ { 'nodes': ['sw1', 'hs1', ...], 'attributes': {...} }, ], 'ports': [ { 'ports': [('sw1', '1'), ('hs1', '1'), ...], 'attributes': {...} } ] 'links': [ { 'endpoints': (('sw1', '1'), ('hs1', '1')), 'attributes': {...} }, ] }
Parameters:
-
parse
(txtmeta, load=True, inject=None)¶ Parse a textual topology meta-description.
For a description of the textual format see pyszn package documentation.
Parameters:
-
relink
(link_id)¶ Relink back a link specified in the topology.
Parameters: link_id (str) – Link identifier to be recreated.
-
unbuild
()¶ Undo the topology.
This removes all references to the engine nodes and request the platform to destroy the topology.