Developer Guide¶
Setup Development Environment¶
Install
pip
andtox
:sudo apt-get install python-pip sudo pip install tox
Configure git pre-commit hook:
sudo pip install flake8 pep8-naming flake8 --install-hook git config flake8.strict true
Building Documentation¶
tox -e doc
Output will be available at .tox/doc/tmp/html
. It is recommended to install
the webdev
package:
sudo pip install webdev
So a development web server can serve any location like this:
$ webdev .tox/doc/tmp/html
Running Test Suite¶
tox -e py27,py34
pynml
¶
pynml module entry point.
Submodules¶
pynml.exceptions
¶
pynml exceptions module.
Exceptions¶
RelationExistsDuringError
: A existsDuring relation must relate with objects of type Lifetime.RelationIsAliasError
: A isAlias relation must relate with objects of type NetworkObject.RelationLocatedAtError
: A locatedAt relation must relate with objects of type Location.RelationHasInboundPortError
: A hasInboundPort relation must relate with objects of type Port orRelationHasOutboundPortError
: A hasOutboundPort relation must relate with objects of type Port orRelationHasServiceError
: A hasService relation must relate with objects of type SwitchingService.RelationImplementedByError
: A implementedBy relation must relate with objects of type Node.RelationHasLabelError
: A hasLabel relation must relate with objects of type Label.RelationIsSinkError
: A isSink relation must relate with objects of type LinkGroup.RelationIsSourceError
: A isSource relation must relate with objects of type LinkGroup.RelationProvidesLinkError
: A providesLink relation must relate with objects of type Link or LinkGroup.RelationCanProvidePortError
: A canProvidePort relation must relate with objects of type Port orRelationProvidesPortError
: A providesPort relation must relate with objects of type Port or PortGroup.RelationHasNodeError
: A hasNode relation must relate with objects of type Node.RelationHasEnvironmentError
: A hasEnvironment relation must relate with objects of type Environment.RelationHasTopologyError
: A hasTopology relation must relate with objects of type Topology.RelationHasLabelGroupError
: A hasLabelGroup relation must relate with objects of type Lifetime.RelationHasPortError
: A hasPort relation must relate with objects of type Port or PortGroup.RelationHasLinkError
: A hasLink relation must relate with objects of type Link or LinkGroup.RelationIsSerialCompoundLinkError
: A isSerialCompoundLink relation must relate with objects of type Port orAttributeNameError
: Attribute name must be a human readable string name.AttributeIdError
: Attribute identifier must be a persistent globally unique URI.AttributeEncodingError
: Attribute encoding must be a format of the data streaming through the
-
exception
pynml.exceptions.
RelationExistsDuringError
¶ A existsDuring relation must relate with objects of type Lifetime.
Inheritance
-
exception
pynml.exceptions.
RelationIsAliasError
¶ A isAlias relation must relate with objects of type NetworkObject.
Inheritance
-
exception
pynml.exceptions.
RelationLocatedAtError
¶ A locatedAt relation must relate with objects of type Location.
Inheritance
-
exception
pynml.exceptions.
RelationHasInboundPortError
¶ A hasInboundPort relation must relate with objects of type Port or PortGroup.
Inheritance
-
exception
pynml.exceptions.
RelationHasOutboundPortError
¶ A hasOutboundPort relation must relate with objects of type Port or PortGroup.
Inheritance
-
exception
pynml.exceptions.
RelationHasServiceError
¶ A hasService relation must relate with objects of type SwitchingService.
Inheritance
-
exception
pynml.exceptions.
RelationImplementedByError
¶ A implementedBy relation must relate with objects of type Node.
Inheritance
-
exception
pynml.exceptions.
RelationHasLabelError
¶ A hasLabel relation must relate with objects of type Label.
Inheritance
-
exception
pynml.exceptions.
RelationIsSinkError
¶ A isSink relation must relate with objects of type LinkGroup.
Inheritance
-
exception
pynml.exceptions.
RelationIsSourceError
¶ A isSource relation must relate with objects of type LinkGroup.
Inheritance
-
exception
pynml.exceptions.
RelationProvidesLinkError
¶ A providesLink relation must relate with objects of type Link or LinkGroup.
Inheritance
-
exception
pynml.exceptions.
RelationCanProvidePortError
¶ A canProvidePort relation must relate with objects of type Port or PortGroup.
Inheritance
-
exception
pynml.exceptions.
RelationProvidesPortError
¶ A providesPort relation must relate with objects of type Port or PortGroup.
Inheritance
-
exception
pynml.exceptions.
RelationHasNodeError
¶ A hasNode relation must relate with objects of type Node.
Inheritance
-
exception
pynml.exceptions.
RelationHasEnvironmentError
¶ A hasEnvironment relation must relate with objects of type Environment.
Inheritance
-
exception
pynml.exceptions.
RelationHasTopologyError
¶ A hasTopology relation must relate with objects of type Topology.
Inheritance
-
exception
pynml.exceptions.
RelationHasLabelGroupError
¶ A hasLabelGroup relation must relate with objects of type Lifetime.
Inheritance
-
exception
pynml.exceptions.
RelationHasPortError
¶ A hasPort relation must relate with objects of type Port or PortGroup.
Inheritance
-
exception
pynml.exceptions.
RelationHasLinkError
¶ A hasLink relation must relate with objects of type Link or LinkGroup.
Inheritance
-
exception
pynml.exceptions.
RelationIsSerialCompoundLinkError
¶ A isSerialCompoundLink relation must relate with objects of type Port or PortGroup.
Inheritance
-
exception
pynml.exceptions.
AttributeNameError
¶ Attribute name must be a human readable string name.
Inheritance
-
exception
pynml.exceptions.
AttributeIdError
¶ Attribute identifier must be a persistent globally unique URI.
Inheritance
-
exception
pynml.exceptions.
AttributeEncodingError
¶ Attribute encoding must be a format of the data streaming through the service as an URI.
Inheritance
pynml.manager
¶
topology manager module.
Classes¶
NMLManager
: NML namespace manager.ExtendedNMLManager
: Extended NMLManager object.
-
class
pynml.manager.
NMLManager
(name=u'NML Namespace', **kwargs)¶ NML namespace manager.
Parameters: name (str) – Name of this namespace.
Variables: - namespace –
OrderedDict
with all NML objects registered. Useregister_object()
to register new objects. - metadata – Store all kwargs passed to the constructor.
Inheritance
-
export_graphviz
()¶ Export current namespace as a Graphviz graph.
Return type: str Returns: The current NML namespace in Graphviz graph notation.
-
export_nml
(pretty=True)¶ Export current namespace as a NML XML format.
Parameters: pretty – Pretty print the output XML. Return type: str Returns: The current NML namespace in NML XML format.
-
get_object
(identifier)¶ Get an object from this namespace by it’s unique identifier.
Parameters: identifier (str) – Object unique identifier. Return type: NMLObject Returns: The object with given identifier, or None if not found.
-
register_object
(obj)¶ Register a NML object into the namespace managed by this Manager.
Parameters: obj (NetworkObject) – Object to register into the namespace. Raises: Exception – If object already in namespace.
-
save_graphviz
(path, keep_gv=False)¶ Plot this namespace using Graphviz.
To use this function the following must be considered:
- The path must be a path to a filename in the format expected, for example, if a .svg file is expected the path must end with a .svg. If no format is provided an exception is raised.
- The output file will be overriden. If case of permissions or IO error and exception is raised.
- This function will call the dot binary by itself if found (using py:func:distutils.spawn.find_executable); if not, an exception is raised.
- If the output parent directories does not exists this function will try to create them using py:func:os.makedirs.
Parameters: Return type: str o None
Returns: Path to .gv file is keep_gv is True, else None.
-
save_nml
(path, pretty=True)¶ Write NML XML file of the current namespace.
To use this function the following must be considered:
- The output file will be overriden. If case of permissions or IO error and exception is raised.
- If the output parent directories does not exists this function will try to create them using py:func:os.makedirs.
Parameters:
- namespace –
-
class
pynml.manager.
ExtendedNMLManager
(**kwargs)¶ Extended NMLManager object.
This object provides a additional helper interface that allow to easily create common objects in a topology, their relations and iterate over them. In particular, this object does the following assumptions that are not part of the NML specification:
- A
pynml.nml.BidirectionalPort
is related to a singlepynml.nml.Node
. - A
pynml.nml.BidirectionalLink
is related to a singlepynml.nml.BidirectionalPort
.
If the above assumptions aren’t true for your topologies please use the standard
NMLManager
or implement your own subclass.The original proposed name for this class was
NMLManagerWithCommonHelpersThatMakeSeveralAssumptions
, but it was too long.Inheritance
-
bilinks
()¶ Iterate over all registered
pynml.nml.BidirectionalLink
s in the namespace.This iterates the bilinks in the order as they were added into the namespace.
Returns: An iterator to all bilinks in the namespace. The iterator is a tuple of the form: (( pynml.nml.Node
A,pynml.nml.BidirectionalPort
A), (pynml.nml.Node
B,pynml.nml.BidirectionalPort
B),pynml.nml.BidirectionalLink
).
-
biports
()¶ Iterate over all registered
pynml.nml.BidirectionalPort
s in the namespace.This iterates the biports in the order as they were added into the namespace.
Returns: An iterator to all biports in the namespace. The iterator is a tuple ( pynml.nml.Node
,pynml.nml.BidirectionalPort
).
-
create_bilink
(biport_a, biport_b, **kwargs)¶ Helper to create and register a
pynml.nml.BidirectionalLink
.All keyword arguments are passed as is to the
pynml.nml.BidirectionalLink
constructor. This helper also creates all intermediate directed sink and source sublinks and relates them to the inbound and outbound subports.Return type: pynml.nml.BidirectionalLink
Returns: A new pynml.nml.BidirectionalLink
already registered into the namespace and with sublinks already related.
-
create_biport
(node, **kwargs)¶ Helper to create and register a
pynml.nml.BidirectionalPort
.All keyword arguments are passed as is to the
pynml.nml.BidirectionalPort
constructor. This helper also creates all intermediate directed inbound and outbound subports and relates them to the node. The node argument is related to those subports too.Return type: pynml.nml.BidirectionalPort
Returns: A new pynml.nml.BidirectionalPort
already registered into the namespace and with subports already related.
-
create_environment
(**kwargs)¶ Helper to create and register a
pynml.nml.Environment
.All keyword arguments are passed as is to the
pynml.nml.Environment
constructor.Return type: pynml.nml.Environment
Returns: A new pynml.nml.Environment
already registered into the namespace.
-
create_node
(**kwargs)¶ Helper to create and register a
pynml.nml.Node
.All keyword arguments are passed as is to the
pynml.nml.Node
constructor.Return type: pynml.nml.Node
Returns: A new pynml.nml.Node
already registered into the namespace.
-
environment
¶ Returns the environment :class: pynml.nml.Environment
-
export_graphviz
()¶ Graphiz export override. See
NMLManager.export_graphviz()
.
-
nodes
()¶ Iterate over all registered
pynml.nml.Node
s in the namespace.This iterates the nodes in the order as they were added into the namespace.
Returns: An iterator to all nodes in the namespace.
- A
pynml.nml
¶
pynml main module.
Classes¶
NetworkObject
: The basic class from other instances inherit from.Node
: A Node object represents a device in a network.Port
: Endpoint of an unidirectional connection.Link
: Connects a source object with a sink one.Service
: Base class for services that a network may provide.SwitchingService
: Shows that the network can create new links between certain ports.AdaptationService
: Shows that the network can embed data from one or more Ports or PortGroupsDeAdaptationService
: Shows that the network can extract data from one or more Ports orGroup
: A collection of objects.Topology
: A set of connected or connectable Network objects.PortGroup
: A unordered set of Ports.LinkGroup
: A unordered set of Links.BidirectionalPort
: A group of two unidirectional Ports or PortGroups.BidirectionalLink
: A group of two unidirectional Links or LinkGroups.Environment
: Describes attributes inherent to the environment.Location
: Describes where the object is physically located.Lifetime
: A time interval where the object is active.Label
: A value that specifies a single data stream among many.LabelGroup
: A unordered set of Labels.OrderedList
: An ordered list of Network Objects.ListItem
: An element of an OrderedList.
-
class
pynml.nml.
NetworkObject
(name=None, identifier=None, version=None, **kwargs)¶ The basic class from other instances inherit from.
No NetworkObject instances can be created because this class is abstract.
Parameters: Inheritance
-
add_exists_during
(lifetime)¶ Add given lifetime to this object existsDuring relations.
Parameters: lifetime (Lifetime) – Object to add to the existsDuring relation.
-
add_is_alias
(network_object)¶ Add given network_object to this object isAlias relations.
Parameters: network_object (NetworkObject) – Object to add to the isAlias relation.
-
exists_during
(lifetime)¶ Check existsDuring relation with given lifetime object.
FIXME: Document existsDuring relation.
Parameters: lifetime (Lifetime) – Object to validate relation existsDuring with. Returns: True if lifetime is related to self with existsDuring. Return type: bool
-
get_exists_during
()¶ Get all objects related with this object with relation existsDuring.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_is_alias
()¶ Get all objects related with this object with relation isAlias.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_located_at
()¶ Get all objects related with this object with relation locatedAt.
Return type: set Returns: A copy of the collection of objects related with this object.
-
is_alias
(network_object)¶ Check isAlias relation with given network_object object.
FIXME: Document isAlias relation.
Parameters: network_object (NetworkObject) – Object to validate relation isAlias with. Returns: True if network_object is related to self with isAlias. Return type: bool
-
located_at
(location)¶ Check locatedAt relation with given location object.
FIXME: Document locatedAt relation.
Parameters: location (Location) – Object to validate relation locatedAt with. Returns: True if location is related to self with locatedAt. Return type: bool
-
-
class
pynml.nml.
Node
(**kwargs)¶ A Node object represents a device in a network.
Physical or virtual devices can be represented by instances of this class.
Inheritance
-
add_has_inbound_port
(port)¶ Add given port to this object hasInboundPort relations.
Parameters: port (Port or PortGroup) – Object to add to the hasInboundPort relation.
-
add_has_outbound_port
(port)¶ Add given port to this object hasOutboundPort relations.
Parameters: port (Port or PortGroup) – Object to add to the hasOutboundPort relation.
-
add_has_service
(switching_service)¶ Add given switching_service to this object hasService relations.
Parameters: switching_service (SwitchingService) – Object to add to the hasService relation.
-
add_implemented_by
(node)¶ Add given node to this object implementedBy relations.
Parameters: node (Node) – Object to add to the implementedBy relation.
-
get_has_inbound_port
()¶ Get all objects related with this object with relation hasInboundPort.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_has_outbound_port
()¶ Get all objects related with this object with relation hasOutboundPort.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_has_service
()¶ Get all objects related with this object with relation hasService.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_implemented_by
()¶ Get all objects related with this object with relation implementedBy.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
has_inbound_port
(port)¶ Check hasInboundPort relation with given port object.
FIXME: Document hasInboundPort relation.
Parameters: port (Port or PortGroup) – Object to validate relation hasInboundPort with. Returns: True if port is related to self with hasInboundPort. Return type: bool
-
has_outbound_port
(port)¶ Check hasOutboundPort relation with given port object.
FIXME: Document hasOutboundPort relation.
Parameters: port (Port or PortGroup) – Object to validate relation hasOutboundPort with. Returns: True if port is related to self with hasOutboundPort. Return type: bool
-
has_service
(switching_service)¶ Check hasService relation with given switching_service object.
FIXME: Document hasService relation.
Parameters: switching_service (SwitchingService) – Object to validate relation hasService with. Returns: True if switching_service is related to self with hasService. Return type: bool
-
-
class
pynml.nml.
Port
(encoding=None, **kwargs)¶ Endpoint of an unidirectional connection.
Can represent physical or virtual ports. Needs a proper linking instance to connect to other ports.
Parameters: encoding (str) – Format of the data streaming through the port as an URI. Inheritance
-
add_has_service
(adaptation_service)¶ Add given adaptation_service to this object hasService relations.
Parameters: adaptation_service (AdaptationService or DeAdaptationService) – Object to add to the hasService relation.
-
add_is_sink
(link)¶ Add given link to this object isSink relations.
Parameters: link (Link) – Object to add to the isSink relation.
-
add_is_source
(link)¶ Add given link to this object isSource relations.
Parameters: link (Link) – Object to add to the isSource relation.
-
encoding
¶ Get attribute encoding.
Returns: Format of the data streaming through the port as an URI. Return type: str
-
get_has_label
()¶ Get all objects related with this object with relation hasLabel.
Return type: set Returns: A copy of the collection of objects related with this object.
-
get_has_service
()¶ Get all objects related with this object with relation hasService.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_is_sink
()¶ Get all objects related with this object with relation isSink.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_is_source
()¶ Get all objects related with this object with relation isSource.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
has_label
(label)¶ Check hasLabel relation with given label object.
FIXME: Document hasLabel relation.
Parameters: label (Label) – Object to validate relation hasLabel with. Returns: True if label is related to self with hasLabel. Return type: bool
-
has_service
(adaptation_service)¶ Check hasService relation with given adaptation_service object.
FIXME: Document hasService relation.
Parameters: adaptation_service (AdaptationService or DeAdaptationService) – Object to validate relation hasService with. Returns: True if adaptation_service is related to self with hasService. Return type: bool
-
is_sink
(link)¶ Check isSink relation with given link object.
FIXME: Document isSink relation.
Parameters: link (Link) – Object to validate relation isSink with. Returns: True if link is related to self with isSink. Return type: bool
-
-
class
pynml.nml.
Link
(encoding=None, **kwargs)¶ Connects a source object with a sink one.
Sources and sinks have specified isSource or isSink relations with the Link instance but not vice versa.
Parameters: encoding (str) – Format of the data streaming through the link as an URI. Inheritance
-
encoding
¶ Get attribute encoding.
Returns: Format of the data streaming through the link as an URI. Return type: str
-
get_has_label
()¶ Get all objects related with this object with relation hasLabel.
Return type: set Returns: A copy of the collection of objects related with this object.
-
-
class
pynml.nml.
Service
(**kwargs)¶ Base class for services that a network may provide.
No Service instances can be created because this class is abstract.
Inheritance
-
class
pynml.nml.
SwitchingService
(encoding=None, **kwargs)¶ Shows that the network can create new links between certain ports.
An instance of this class shows that the network is capable of creating new Links or LinkGroups between its inbound and outbound ports. These Links or LinkGroups are identified by being related to the SwitchingService instance with a providesLink relation.
Parameters: encoding (str) – Format of the data streaming through the service as an URI. Inheritance
-
add_has_inbound_port
(port)¶ Add given port to this object hasInboundPort relations.
Parameters: port (Port or PortGroup) – Object to add to the hasInboundPort relation.
-
add_has_outbound_port
(port)¶ Add given port to this object hasOutboundPort relations.
Parameters: port (Port or PortGroup) – Object to add to the hasOutboundPort relation.
-
add_provides_link
(link)¶ Add given link to this object providesLink relations.
Parameters: link (Link or LinkGroup) – Object to add to the providesLink relation.
-
encoding
¶ Get attribute encoding.
Returns: Format of the data streaming through the service as an URI. Return type: str
-
get_has_inbound_port
()¶ Get all objects related with this object with relation hasInboundPort.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_has_outbound_port
()¶ Get all objects related with this object with relation hasOutboundPort.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_provides_link
()¶ Get all objects related with this object with relation providesLink.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
has_inbound_port
(port)¶ Check hasInboundPort relation with given port object.
FIXME: Document hasInboundPort relation.
Parameters: port (Port or PortGroup) – Object to validate relation hasInboundPort with. Returns: True if port is related to self with hasInboundPort. Return type: bool
-
-
class
pynml.nml.
AdaptationService
(adaptation_function=None, **kwargs)¶ Shows that the network can embed data from one or more Ports or PortGroups into other Ports or PortGroups.
An instance of this class shows that data from one or more Ports can be embedded in the data encoding of other Port or Ports. This class has an adaptationFunction attribute that should describe the kind of embedding that is used by the AdaptationService instance.
Parameters: adaptation_function (None) – Function for multiplexing. Inheritance
-
add_can_provide_port
(port)¶ Add given port to this object canProvidePort relations.
Parameters: port (Port or PortGroup) – Object to add to the canProvidePort relation.
-
add_exists_during
(lifetime)¶ Add given lifetime to this object existsDuring relations.
Parameters: lifetime (Lifetime) – Object to add to the existsDuring relation.
-
add_provides_port
(port)¶ Add given port to this object providesPort relations.
Parameters: port (Port or PortGroup) – Object to add to the providesPort relation.
-
can_provide_port
(port)¶ Check canProvidePort relation with given port object.
FIXME: Document canProvidePort relation.
Parameters: port (Port or PortGroup) – Object to validate relation canProvidePort with. Returns: True if port is related to self with canProvidePort. Return type: bool
-
exists_during
(lifetime)¶ Check existsDuring relation with given lifetime object.
FIXME: Document existsDuring relation.
Parameters: lifetime (Lifetime) – Object to validate relation existsDuring with. Returns: True if lifetime is related to self with existsDuring. Return type: bool
-
get_can_provide_port
()¶ Get all objects related with this object with relation canProvidePort.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_exists_during
()¶ Get all objects related with this object with relation existsDuring.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_provides_port
()¶ Get all objects related with this object with relation providesPort.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
-
class
pynml.nml.
DeAdaptationService
(adaptation_function=None, **kwargs)¶ Shows that the network can extract data from one or more Ports or PortGroups encoding.
An instance of this class shows that data from one or more Ports can be extracted from the data encoding of other Port or Ports. This class has an adaptationFunction attribute that should describe the kind of extraction that is used by the DeadaptationService instance.
Parameters: adaptation_function (None) – Function for multiplexing. Inheritance
-
add_can_provide_port
(port)¶ Add given port to this object canProvidePort relations.
Parameters: port (Port or PortGroup) – Object to add to the canProvidePort relation.
-
add_exists_during
(lifetime)¶ Add given lifetime to this object existsDuring relations.
Parameters: lifetime (Lifetime) – Object to add to the existsDuring relation.
-
add_provides_port
(port)¶ Add given port to this object providesPort relations.
Parameters: port (Port or PortGroup) – Object to add to the providesPort relation.
-
can_provide_port
(port)¶ Check canProvidePort relation with given port object.
FIXME: Document canProvidePort relation.
Parameters: port (Port or PortGroup) – Object to validate relation canProvidePort with. Returns: True if port is related to self with canProvidePort. Return type: bool
-
exists_during
(lifetime)¶ Check existsDuring relation with given lifetime object.
FIXME: Document existsDuring relation.
Parameters: lifetime (Lifetime) – Object to validate relation existsDuring with. Returns: True if lifetime is related to self with existsDuring. Return type: bool
-
get_can_provide_port
()¶ Get all objects related with this object with relation canProvidePort.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_exists_during
()¶ Get all objects related with this object with relation existsDuring.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_provides_port
()¶ Get all objects related with this object with relation providesPort.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
-
class
pynml.nml.
Group
(**kwargs)¶ A collection of objects.
Any object can be part of a Group, even another Group. An object can be part of multiple Groups.
Inheritance
-
class
pynml.nml.
Topology
(**kwargs)¶ A set of connected or connectable Network objects.
One or more Link or LinkGroup objects can provide the connection between the Topology Network Objects.
Inheritance
-
add_exists_during
(lifetime)¶ Add given lifetime to this object existsDuring relations.
Parameters: lifetime (Lifetime) – Object to add to the existsDuring relation.
-
add_has_environment
(environment)¶ Add given environment to this object hasEnvironment relations.
Parameters: environment (Environment) – Object to add to the hasEnvironment relation.
-
add_has_inbound_port
(port)¶ Add given port to this object hasInboundPort relations.
Parameters: port (Port or PortGroup) – Object to add to the hasInboundPort relation.
-
add_has_node
(node)¶ Add given node to this object hasNode relations.
Parameters: node (Node) – Object to add to the hasNode relation.
-
add_has_outbound_port
(port)¶ Add given port to this object hasOutboundPort relations.
Parameters: port (Port or PortGroup) – Object to add to the hasOutboundPort relation.
-
add_has_service
(switching_service)¶ Add given switching_service to this object hasService relations.
Parameters: switching_service (SwitchingService) – Object to add to the hasService relation.
-
add_has_topology
(topology)¶ Add given topology to this object hasTopology relations.
Parameters: topology (Topology) – Object to add to the hasTopology relation.
-
exists_during
(lifetime)¶ Check existsDuring relation with given lifetime object.
FIXME: Document existsDuring relation.
Parameters: lifetime (Lifetime) – Object to validate relation existsDuring with. Returns: True if lifetime is related to self with existsDuring. Return type: bool
-
get_exists_during
()¶ Get all objects related with this object with relation existsDuring.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_has_environment
()¶ Get all objects related with this object with relation hasEnvironment.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_has_inbound_port
()¶ Get all objects related with this object with relation hasInboundPort.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_has_node
()¶ Get all objects related with this object with relation hasNode.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_has_outbound_port
()¶ Get all objects related with this object with relation hasOutboundPort.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_has_service
()¶ Get all objects related with this object with relation hasService.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_has_topology
()¶ Get all objects related with this object with relation hasTopology.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
has_environment
(environment)¶ Check hasEnvironment relation with given environment object.
FIXME: Document hasEnvironment relation.
Parameters: environment (Environment) – Object to validate relation hasEnvironment with. Returns: True if environment is related to self with hasEnvironment. Return type: bool
-
has_inbound_port
(port)¶ Check hasInboundPort relation with given port object.
FIXME: Document hasInboundPort relation.
Parameters: port (Port or PortGroup) – Object to validate relation hasInboundPort with. Returns: True if port is related to self with hasInboundPort. Return type: bool
-
has_node
(node)¶ Check hasNode relation with given node object.
FIXME: Document hasNode relation.
Parameters: node (Node) – Object to validate relation hasNode with. Returns: True if node is related to self with hasNode. Return type: bool
-
has_outbound_port
(port)¶ Check hasOutboundPort relation with given port object.
FIXME: Document hasOutboundPort relation.
Parameters: port (Port or PortGroup) – Object to validate relation hasOutboundPort with. Returns: True if port is related to self with hasOutboundPort. Return type: bool
-
has_service
(switching_service)¶ Check hasService relation with given switching_service object.
FIXME: Document hasService relation.
Parameters: switching_service (SwitchingService) – Object to validate relation hasService with. Returns: True if switching_service is related to self with hasService. Return type: bool
-
-
class
pynml.nml.
PortGroup
(**kwargs)¶ A unordered set of Ports.
FIXME: Document PortGroup.
Inheritance
-
add_exists_during
(lifetime)¶ Add given lifetime to this object existsDuring relations.
Parameters: lifetime (Lifetime) – Object to add to the existsDuring relation.
-
add_has_port
(port)¶ Add given port to this object hasPort relations.
Parameters: port (Port or PortGroup) – Object to add to the hasPort relation.
-
add_is_sink
(link_group)¶ Add given link_group to this object isSink relations.
Parameters: link_group (LinkGroup) – Object to add to the isSink relation.
-
add_is_source
(link_group)¶ Add given link_group to this object isSource relations.
Parameters: link_group (LinkGroup) – Object to add to the isSource relation.
-
exists_during
(lifetime)¶ Check existsDuring relation with given lifetime object.
FIXME: Document existsDuring relation.
Parameters: lifetime (Lifetime) – Object to validate relation existsDuring with. Returns: True if lifetime is related to self with existsDuring. Return type: bool
-
get_exists_during
()¶ Get all objects related with this object with relation existsDuring.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_has_label_group
()¶ Get all objects related with this object with relation hasLabelGroup.
Return type: set Returns: A copy of the collection of objects related with this object.
-
get_has_port
()¶ Get all objects related with this object with relation hasPort.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_is_sink
()¶ Get all objects related with this object with relation isSink.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_is_source
()¶ Get all objects related with this object with relation isSource.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
has_label_group
(lifetime)¶ Check hasLabelGroup relation with given lifetime object.
FIXME: Document hasLabelGroup relation.
Parameters: lifetime (Lifetime) – Object to validate relation hasLabelGroup with. Returns: True if lifetime is related to self with hasLabelGroup. Return type: bool
-
has_port
(port)¶ Check hasPort relation with given port object.
FIXME: Document hasPort relation.
Parameters: port (Port or PortGroup) – Object to validate relation hasPort with. Returns: True if port is related to self with hasPort. Return type: bool
-
is_sink
(link_group)¶ Check isSink relation with given link_group object.
FIXME: Document isSink relation.
Parameters: link_group (LinkGroup) – Object to validate relation isSink with. Returns: True if link_group is related to self with isSink. Return type: bool
-
-
class
pynml.nml.
LinkGroup
(**kwargs)¶ A unordered set of Links.
FIXME: Document LinkGroup.
Inheritance
-
add_exists_during
(lifetime)¶ Add given lifetime to this object existsDuring relations.
Parameters: lifetime (Lifetime) – Object to add to the existsDuring relation.
-
add_has_link
(port)¶ Add given port to this object hasLink relations.
Parameters: port (Port or PortGroup) – Object to add to the hasLink relation.
-
add_is_serial_compound_link
(port)¶ Add given port to this object isSerialCompoundLink relations.
Parameters: port (Port or PortGroup) – Object to add to the isSerialCompoundLink relation.
-
exists_during
(lifetime)¶ Check existsDuring relation with given lifetime object.
FIXME: Document existsDuring relation.
Parameters: lifetime (Lifetime) – Object to validate relation existsDuring with. Returns: True if lifetime is related to self with existsDuring. Return type: bool
-
get_exists_during
()¶ Get all objects related with this object with relation existsDuring.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_has_label_group
()¶ Get all objects related with this object with relation hasLabelGroup.
Return type: set Returns: A copy of the collection of objects related with this object.
-
get_has_link
()¶ Get all objects related with this object with relation hasLink.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_is_serial_compound_link
()¶ Get all objects related with this object with relation isSerialCompoundLink.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
has_label_group
(lifetime)¶ Check hasLabelGroup relation with given lifetime object.
FIXME: Document hasLabelGroup relation.
Parameters: lifetime (Lifetime) – Object to validate relation hasLabelGroup with. Returns: True if lifetime is related to self with hasLabelGroup. Return type: bool
-
has_link
(port)¶ Check hasLink relation with given port object.
FIXME: Document hasLink relation.
Parameters: port (Port or PortGroup) – Object to validate relation hasLink with. Returns: True if port is related to self with hasLink. Return type: bool
-
is_serial_compound_link
(port)¶ Check isSerialCompoundLink relation with given port object.
FIXME: Document isSerialCompoundLink relation.
Parameters: port (Port or PortGroup) – Object to validate relation isSerialCompoundLink with. Returns: True if port is related to self with isSerialCompoundLink. Return type: bool
-
-
class
pynml.nml.
BidirectionalPort
(**kwargs)¶ A group of two unidirectional Ports or PortGroups.
The purpose of this class is to provide a convenient representation of a bidirectional Port. This is needed because NML is a unidirectional specification.
Inheritance
-
add_exists_during
(lifetime)¶ Add given lifetime to this object existsDuring relations.
Parameters: lifetime (Lifetime) – Object to add to the existsDuring relation.
-
exists_during
(lifetime)¶ Check existsDuring relation with given lifetime object.
FIXME: Document existsDuring relation.
Parameters: lifetime (Lifetime) – Object to validate relation existsDuring with. Returns: True if lifetime is related to self with existsDuring. Return type: bool
-
get_exists_during
()¶ Get all objects related with this object with relation existsDuring.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_has_port
()¶ Get all objects related with this object with relation hasPort.
Return type: set Returns: A copy of the collection of objects related with this object.
-
-
class
pynml.nml.
BidirectionalLink
(**kwargs)¶ A group of two unidirectional Links or LinkGroups.
The purpose of this class is to provide a convenient representation of a bidirectional Link. This is needed because NML is a unidirectional specification.
Inheritance
-
add_exists_during
(lifetime)¶ Add given lifetime to this object existsDuring relations.
Parameters: lifetime (Lifetime) – Object to add to the existsDuring relation.
-
exists_during
(lifetime)¶ Check existsDuring relation with given lifetime object.
FIXME: Document existsDuring relation.
Parameters: lifetime (Lifetime) – Object to validate relation existsDuring with. Returns: True if lifetime is related to self with existsDuring. Return type: bool
-
get_exists_during
()¶ Get all objects related with this object with relation existsDuring.
Return type: OrderedDict
Returns: A copy of the collection of objects related with this object.
-
get_has_link
()¶ Get all objects related with this object with relation hasLink.
Return type: set Returns: A copy of the collection of objects related with this object.
-
-
class
pynml.nml.
Environment
(**kwargs)¶ Describes attributes inherent to the environment.
Attributes to be attached to the environment the topology is in..
Inheritance
-
class
pynml.nml.
Location
(name=None, identifier=None, longitude=None, latitude=None, altitude=None, unlocode=None, address=None, **kwargs)¶ Describes where the object is physically located.
An instance of this class can be related to other objects that are to be represented as being present in the same place.
Parameters: - name (str) – Human readable string name.
- identifier (str) – Persistent globally unique URI.
- longitude (str) – Longitude in WGS84 and in decimal degrees.
- latitude (str) – Latitude in WGS84 and in decimal degrees.
- altitude (str) – Altitude in WGS84 and in decimal meters.
- unlocode (str) – UN/LOCODE location identifier.
- address (str) – A vCard ADR property.
Inheritance
-
class
pynml.nml.
Lifetime
(start=None, end=None, **kwargs)¶ A time interval where the object is active.
An object can have multiple Lifetimes, if so, it will be active in a time interval equivalent to the union of all its Lifetimes time intervals.
Parameters: Inheritance
-
class
pynml.nml.
Label
(labeltype=None, value=None, **kwargs)¶ A value that specifies a single data stream among many.
A Label is technology-specific, so a Label used to identify a VLAN would be different from a Label used to identify a wavelength.
Parameters: Inheritance
-
class
pynml.nml.
LabelGroup
(labeltype=None, value=None, **kwargs)¶ A unordered set of Labels.
FIXME: Document LabelGroup.
Parameters: Inheritance
-
class
pynml.nml.
OrderedList
(**kwargs)¶ An ordered list of Network Objects.
Instances of this class are used to describe a path in the network along with the isSerialCompoundLink relation.
Inheritance
-
class
pynml.nml.
ListItem
(**kwargs)¶ An element of an OrderedList.
Is a syntax-dependent object used to represent elements in an OrderedList.
Inheritance
pynml.spec
¶
NML specification definition and generation module.
Variables¶
-
pynml.spec.
NML_SPEC
¶ NML Specification as a Python dictionary
{u'classes': [{u'abstract': True, u'attributes': [{u'default': u"'{}({})'.format(\n self.__class__.__name__, str(id(self))\n )", u'default_arg': u'None', u'doc': u'Human readable string name', u'name': u'name', u'nml_attribute': u'name', u'property': True, u'semantic_type': u'string', u'type': u'str', u'validation': u'%s'}, {u'default': u'str(id(self))', u'default_arg': u'None', u'doc': u'Persistent globally unique URI', u'name': u'identifier', u'nml_attribute': u'id', u'property': True, u'semantic_type': u'URI', u'type': u'str', u'validation': u'is_valid_uri(%s)'}, {u'default': u'datetime.now().replace(microsecond=0).isoformat()', u'default_arg': u'None', u'doc': u'Time stamp formatted as ISO 8601', u'name': u'version', u'nml_attribute': u'version', u'property': True, u'semantic_type': u'timestamp', u'type': u'str', u'validation': None}], u'brief': u'The basic class from other instances inherit from', u'doc': u'No NetworkObject instances can be created because this class is abstract', u'name': u'Network Object', u'parent': None, u'relations': [{u'cardinality': u'+', u'doc': u'FIXME: Document existsDuring relation', u'name': u'existsDuring', u'with': [u'Lifetime']}, {u'cardinality': u'+', u'doc': u'FIXME: Document isAlias relation', u'name': u'isAlias', u'with': [u'Network Object']}, {u'cardinality': u'1', u'doc': u'FIXME: Document locatedAt relation', u'name': u'locatedAt', u'with': [u'Location']}]}, {u'abstract': False, u'attributes': [], u'brief': u'A Node object represents a device in a network', u'doc': u'Physical or virtual devices can be represented by instances of this class', u'name': u'Node', u'parent': u'Network Object', u'relations': [{u'cardinality': u'+', u'doc': u'FIXME: Document hasInboundPort relation', u'name': u'hasInboundPort', u'with': [u'Port', u'Port Group']}, {u'cardinality': u'+', u'doc': u'FIXME: Document hasOutboundPort relation', u'name': u'hasOutboundPort', u'with': [u'Port', u'Port Group']}, {u'cardinality': u'+', u'doc': u'FIXME: Document hasService relation', u'name': u'hasService', u'with': [u'Switching Service']}, {u'cardinality': u'+', u'doc': u'FIXME: Document implementedBy relation', u'name': u'implementedBy', u'with': [u'Node']}]}, {u'abstract': False, u'attributes': [{u'default': u'unset', u'default_arg': u'None', u'doc': u'Format of the data streaming through the port as an URI', u'name': u'encoding', u'nml_attribute': u'encoding', u'property': True, u'semantic_type': u'URI', u'type': u'str', u'validation': u'is_valid_uri(%s)'}], u'brief': u'Endpoint of an unidirectional connection', u'doc': u'Can represent physical or virtual ports. Needs a proper linking instance to connect to other ports', u'name': u'Port', u'parent': u'Network Object', u'relations': [{u'cardinality': u'1', u'doc': u'FIXME: Document hasLabel relation', u'name': u'hasLabel', u'with': [u'Label']}, {u'cardinality': u'+', u'doc': u'FIXME: Document hasService relation', u'name': u'hasService', u'with': [u'Adaptation Service', u'De-adaptation Service']}, {u'cardinality': u'+', u'doc': u'FIXME: Document isSink relation', u'name': u'isSink', u'with': [u'Link']}, {u'cardinality': u'+', u'doc': u'FIXME: Document isSource relation', u'name': u'isSource', u'with': [u'Link']}]}, {u'abstract': False, u'attributes': [{u'default': u'unset', u'default_arg': u'None', u'doc': u'Format of the data streaming through the link as an URI', u'name': u'encoding', u'nml_attribute': u'encoding', u'property': True, u'semantic_type': u'URI', u'type': u'str', u'validation': u'is_valid_uri(%s)'}], u'brief': u'Connects a source object with a sink one', u'doc': u'Sources and sinks have specified isSource or isSink relations with the Link instance but not vice versa', u'name': u'Link', u'parent': u'Network Object', u'relations': [{u'cardinality': u'1', u'doc': u'FIXME: Document hasLabel relation', u'name': u'hasLabel', u'with': [u'Label']}]}, {u'abstract': True, u'attributes': [], u'brief': u'Base class for services that a network may provide', u'doc': u'No Service instances can be created because this class is abstract', u'name': u'Service', u'parent': u'Network Object', u'relations': []}, {u'abstract': False, u'attributes': [{u'default': u'unset', u'default_arg': u'None', u'doc': u'Format of the data streaming through the service as an URI', u'name': u'encoding', u'nml_attribute': u'encoding', u'property': True, u'semantic_type': u'URI', u'type': u'str', u'validation': u'is_valid_uri(%s)'}], u'brief': u'Shows that the network can create new links between certain ports', u'doc': u'An instance of this class shows that the network is capable of creating new Links or LinkGroups between its inbound and outbound ports. These Links or LinkGroups are identified by being related to the SwitchingService instance with a providesLink relation', u'name': u'Switching Service', u'parent': u'Service', u'relations': [{u'cardinality': u'+', u'doc': u'FIXME: Document hasInboundPort relation', u'name': u'hasInboundPort', u'with': [u'Port', u'Port Group']}, {u'cardinality': u'+', u'doc': u'FIXME: Document hasOutboundPort relation', u'name': u'hasOutboundPort', u'with': [u'Port', u'Port Group']}, {u'cardinality': u'+', u'doc': u'FIXME: Document providesLink relation', u'name': u'providesLink', u'with': [u'Link', u'Link Group']}]}, {u'abstract': False, u'attributes': [{u'default': None, u'default_arg': None, u'doc': u'Function for multiplexing', u'name': u'adaptation_function', u'nml_attribute': u'adaptationFunction', u'property': False, u'semantic_type': None, u'type': None, u'validation': None}], u'brief': u'Shows that the network can embed data from one or more Ports or PortGroups into other Ports or PortGroups', u'doc': u'An instance of this class shows that data from one or more Ports can be embedded in the data encoding of other Port or Ports. This class has an adaptationFunction attribute that should describe the kind of embedding that is used by the AdaptationService instance', u'name': u'Adaptation Service', u'parent': u'Service', u'relations': [{u'cardinality': u'+', u'doc': u'FIXME: Document canProvidePort relation', u'name': u'canProvidePort', u'with': [u'Port', u'Port Group']}, {u'cardinality': u'+', u'doc': u'FIXME: Document existsDuring relation', u'name': u'existsDuring', u'with': [u'Lifetime']}, {u'cardinality': u'+', u'doc': u'FIXME: Document providesPort relation', u'name': u'providesPort', u'with': [u'Port', u'Port Group']}]}, {u'abstract': False, u'attributes': [{u'default': None, u'default_arg': None, u'doc': u'Function for multiplexing', u'name': u'adaptation_function', u'nml_attribute': u'adaptationFunction', u'property': False, u'semantic_type': None, u'type': None, u'validation': None}], u'brief': u'Shows that the network can extract data from one or more Ports or PortGroups encoding', u'doc': u'An instance of this class shows that data from one or more Ports can be extracted from the data encoding of other Port or Ports. This class has an adaptationFunction attribute that should describe the kind of extraction that is used by the DeadaptationService instance', u'name': u'De-adaptation Service', u'parent': u'Service', u'relations': [{u'cardinality': u'+', u'doc': u'FIXME: Document canProvidePort relation', u'name': u'canProvidePort', u'with': [u'Port', u'Port Group']}, {u'cardinality': u'+', u'doc': u'FIXME: Document existsDuring relation', u'name': u'existsDuring', u'with': [u'Lifetime']}, {u'cardinality': u'+', u'doc': u'FIXME: Document providesPort relation', u'name': u'providesPort', u'with': [u'Port', u'Port Group']}]}, {u'abstract': True, u'attributes': [], u'brief': u'A collection of objects', u'doc': u'Any object can be part of a Group, even another Group. An object can be part of multiple Groups', u'name': u'Group', u'parent': u'Network Object', u'relations': []}, {u'abstract': False, u'attributes': [], u'brief': u'A set of connected or connectable Network objects', u'doc': u'One or more Link or LinkGroup objects can provide the connection between the Topology Network Objects', u'name': u'Topology', u'parent': u'Group', u'relations': [{u'cardinality': u'+', u'doc': u'FIXME: Document existsDuring relation', u'name': u'existsDuring', u'with': [u'Lifetime']}, {u'cardinality': u'+', u'doc': u'FIXME: Document hasNode relation', u'name': u'hasNode', u'with': [u'Node']}, {u'cardinality': u'+', u'doc': u'FIXME: Document hasInboundPort relation', u'name': u'hasInboundPort', u'with': [u'Port', u'Port Group']}, {u'cardinality': u'+', u'doc': u'FIXME: Document hasOutboundPort relation', u'name': u'hasOutboundPort', u'with': [u'Port', u'Port Group']}, {u'cardinality': u'+', u'doc': u'FIXME: Document hasService relation', u'name': u'hasService', u'with': [u'Switching Service']}, {u'cardinality': u'+', u'doc': u'FIXME: Document hasEnvironment relation', u'name': u'hasEnvironment', u'with': [u'Environment']}, {u'cardinality': u'+', u'doc': u'FIXME: Document hasTopology relation', u'name': u'hasTopology', u'with': [u'Topology']}]}, {u'abstract': False, u'attributes': [], u'brief': u'A unordered set of Ports', u'doc': u'FIXME: Document PortGroup', u'name': u'Port Group', u'parent': u'Group', u'relations': [{u'cardinality': u'+', u'doc': u'FIXME: Document existsDuring relation', u'name': u'existsDuring', u'with': [u'Lifetime']}, {u'cardinality': u'1', u'doc': u'FIXME: Document hasLabelGroup relation', u'name': u'hasLabelGroup', u'with': [u'Lifetime']}, {u'cardinality': u'+', u'doc': u'FIXME: Document hasPort relation', u'name': u'hasPort', u'with': [u'Port', u'Port Group']}, {u'cardinality': u'+', u'doc': u'FIXME: Document isSink relation', u'name': u'isSink', u'with': [u'Link Group']}, {u'cardinality': u'+', u'doc': u'FIXME: Document isSource relation', u'name': u'isSource', u'with': [u'Link Group']}]}, {u'abstract': False, u'attributes': [], u'brief': u'A unordered set of Links', u'doc': u'FIXME: Document LinkGroup', u'name': u'Link Group', u'parent': u'Group', u'relations': [{u'cardinality': u'+', u'doc': u'FIXME: Document existsDuring relation', u'name': u'existsDuring', u'with': [u'Lifetime']}, {u'cardinality': u'1', u'doc': u'FIXME: Document hasLabelGroup relation', u'name': u'hasLabelGroup', u'with': [u'Lifetime']}, {u'cardinality': u'+', u'doc': u'FIXME: Document hasLink relation', u'name': u'hasLink', u'with': [u'Port', u'Port Group']}, {u'cardinality': u'+', u'doc': u'FIXME: Document isSerialCompoundLink relation', u'name': u'isSerialCompoundLink', u'with': [u'Port', u'Port Group']}]}, {u'abstract': False, u'attributes': [], u'brief': u'A group of two unidirectional Ports or PortGroups', u'doc': u'The purpose of this class is to provide a convenient representation of a bidirectional Port. This is needed because NML is a unidirectional specification', u'name': u'Bidirectional Port', u'parent': u'Group', u'relations': [{u'cardinality': u'+', u'doc': u'FIXME: Document existsDuring relation', u'name': u'existsDuring', u'with': [u'Lifetime']}, {u'cardinality': u'2', u'doc': u'FIXME: Document hasPort relation', u'name': u'hasPort', u'with': [u'Port', u'Port Group']}]}, {u'abstract': False, u'attributes': [], u'brief': u'A group of two unidirectional Links or LinkGroups', u'doc': u'The purpose of this class is to provide a convenient representation of a bidirectional Link. This is needed because NML is a unidirectional specification', u'name': u'Bidirectional Link', u'parent': u'Group', u'relations': [{u'cardinality': u'+', u'doc': u'FIXME: Document existsDuring relation', u'name': u'existsDuring', u'with': [u'Lifetime']}, {u'cardinality': u'2', u'doc': u'FIXME: Document hasLink relation', u'name': u'hasLink', u'with': [u'Link', u'Link Group']}]}, {u'abstract': False, u'attributes': [], u'brief': u'Describes attributes inherent to the environment', u'doc': u'Attributes to be attached to the environment the topology is in.', u'name': u'Environment', u'parent': None, u'relations': []}, {u'abstract': False, u'attributes': [{u'default': u"'{}<{}>'.format(\n self.__class__.__name__, str(id(self))\n )", u'default_arg': u'None', u'doc': u'Human readable string name', u'name': u'name', u'nml_attribute': u'name', u'property': True, u'semantic_type': u'string', u'type': u'str', u'validation': u'%s'}, {u'default': u'str(id(self))', u'default_arg': u'None', u'doc': u'Persistent globally unique URI', u'name': u'identifier', u'nml_attribute': u'id', u'property': True, u'semantic_type': u'URI', u'type': u'str', u'validation': u'is_valid_uri(%s)'}, {u'default': u'unset', u'default_arg': u'None', u'doc': u'Longitude in WGS84 and in decimal degrees', u'name': u'longitude', u'nml_attribute': u'long', u'property': True, u'semantic_type': u'WGS84', u'type': u'str', u'validation': None}, {u'default': u'unset', u'default_arg': u'None', u'doc': u'Latitude in WGS84 and in decimal degrees', u'name': u'latitude', u'nml_attribute': u'lat', u'property': True, u'semantic_type': u'WGS84', u'type': u'str', u'validation': None}, {u'default': u'unset', u'default_arg': u'None', u'doc': u'Altitude in WGS84 and in decimal meters', u'name': u'altitude', u'nml_attribute': u'alt', u'property': True, u'semantic_type': u'WGS84', u'type': u'str', u'validation': None}, {u'default': u'unset', u'default_arg': u'None', u'doc': u'UN/LOCODE location identifier', u'name': u'unlocode', u'nml_attribute': u'unlocode', u'property': True, u'semantic_type': u'UN/LOCODE', u'type': u'str', u'validation': None}, {u'default': u'unset', u'default_arg': u'None', u'doc': u'A vCard ADR property', u'name': u'address', u'nml_attribute': u'address', u'property': True, u'semantic_type': u'vCard ADR', u'type': u'str', u'validation': None}], u'brief': u'Describes where the object is physically located', u'doc': u'An instance of this class can be related to other objects that are to be represented as being present in the same place', u'name': u'Location', u'parent': None, u'relations': []}, {u'abstract': False, u'attributes': [{u'default': u'datetime.now().replace(microsecond=0).isoformat()', u'default_arg': u'None', u'doc': u'Date and time formatted as ISO 8601 calendar date compact representation with UTC timezone (YYYYMMDDThhmmssZ)', u'name': u'start', u'nml_attribute': u'start', u'property': True, u'semantic_type': u'timestamp', u'type': u'str', u'validation': None}, {u'default': u'datetime.now().replace(microsecond=0).isoformat()', u'default_arg': u'None', u'doc': u'Date and time formatted as ISO 8601 calendar date compact representation with UTC timezone (YYYYMMDDThhmmssZ)', u'name': u'end', u'nml_attribute': u'end', u'property': True, u'semantic_type': u'timestamp', u'type': u'str', u'validation': None}], u'brief': u'A time interval where the object is active', u'doc': u'An object can have multiple Lifetimes, if so, it will be active in a time interval equivalent to the union of all its Lifetimes time intervals', u'name': u'Lifetime', u'parent': None, u'relations': []}, {u'abstract': False, u'attributes': [{u'default': None, u'default_arg': None, u'doc': u'A technology-specific labelset', u'name': u'labeltype', u'nml_attribute': u'labeltype', u'property': False, u'semantic_type': None, u'type': None, u'validation': None}, {u'default': None, u'default_arg': None, u'doc': u'A specific value taken from a labelset', u'name': u'value', u'nml_attribute': u'value', u'property': False, u'semantic_type': None, u'type': None, u'validation': None}], u'brief': u'A value that specifies a single data stream among many', u'doc': u'A Label is technology-specific, so a Label used to identify a VLAN would be different from a Label used to identify a wavelength', u'name': u'Label', u'parent': None, u'relations': []}, {u'abstract': False, u'attributes': [{u'default': None, u'default_arg': None, u'doc': u'A technology-specific labelset', u'name': u'labeltype', u'nml_attribute': u'labeltype', u'property': False, u'semantic_type': None, u'type': None, u'validation': None}, {u'default': None, u'default_arg': None, u'doc': u'A specific value taken from a labelset', u'name': u'value', u'nml_attribute': u'value', u'property': False, u'semantic_type': None, u'type': None, u'validation': None}], u'brief': u'A unordered set of Labels', u'doc': u'FIXME: Document LabelGroup', u'name': u'Label Group', u'parent': None, u'relations': []}, {u'abstract': False, u'attributes': [], u'brief': u'An ordered list of Network Objects', u'doc': u'Instances of this class are used to describe a path in the network along with the isSerialCompoundLink relation', u'name': u'Ordered List', u'parent': None, u'relations': []}, {u'abstract': False, u'attributes': [], u'brief': u'An element of an OrderedList', u'doc': u'Is a syntax-dependent object used to represent elements in an OrderedList', u'name': u'List Item', u'parent': None, u'relations': []}]}
NML Python Library¶

Python library for the Network Markup Language (NML) standard for network topologies representation.
Documentation¶
Development¶
Future improvements¶
- Validate entities deletion and perform recursive deletion of subentities.
License¶
Copyright (C) 2015-2016 Hewlett Packard Enterprise Development LP
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.