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 PortGroups
  • DeAdaptationService: Shows that the network can extract data from one or more Ports or
  • Group: 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:
  • name (str) – Human readable string name.
  • identifier (str) – Persistent globally unique URI.
  • version (str) – Time stamp formatted as ISO 8601.

Inheritance

Inheritance diagram of NetworkObject

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.
identifier

Get attribute identifier.

Returns:Persistent globally unique URI.
Return type:str
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
name

Get attribute name.

Returns:Human readable string name.
Return type:str
set_located_at(location)

Set the locatedAt relation to given objects.

Parameters:location (Location) – Object to set to the locatedAt relation.
version

Get attribute version.

Returns:Time stamp formatted as ISO 8601.
Return type:str
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

Inheritance diagram of Node

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
implemented_by(node)

Check implementedBy relation with given node object.

FIXME: Document implementedBy relation.

Parameters:node (Node) – Object to validate relation implementedBy with.
Returns:True if node is related to self with implementedBy.
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

Inheritance diagram of Port

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
is_source(link)

Check isSource relation with given link object.

FIXME: Document isSource relation.

Parameters:link (Link) – Object to validate relation isSource with.
Returns:True if link is related to self with isSource.
Return type:bool
set_has_label(label)

Set the hasLabel relation to given objects.

Parameters:label (Label) – Object to set to the hasLabel relation.

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

Inheritance diagram of Link

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.
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
set_has_label(label)

Set the hasLabel relation to given objects.

Parameters:label (Label) – Object to set to the hasLabel relation.
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

Inheritance diagram of Service

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

Inheritance diagram of SwitchingService

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 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 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
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

Check providesLink relation with given link object.

FIXME: Document providesLink relation.

Parameters:link (Link or LinkGroup) – Object to validate relation providesLink with.
Returns:True if link is related to self with providesLink.
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

Inheritance diagram of AdaptationService

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.
provides_port(port)

Check providesPort relation with given port object.

FIXME: Document providesPort relation.

Parameters:port (Port or PortGroup) – Object to validate relation providesPort with.
Returns:True if port is related to self with providesPort.
Return type:bool
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

Inheritance diagram of DeAdaptationService

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.
provides_port(port)

Check providesPort relation with given port object.

FIXME: Document providesPort relation.

Parameters:port (Port or PortGroup) – Object to validate relation providesPort with.
Returns:True if port is related to self with providesPort.
Return type:bool
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

Inheritance diagram of Group

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

Inheritance diagram of Topology

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
has_topology(topology)

Check hasTopology relation with given topology object.

FIXME: Document hasTopology relation.

Parameters:topology (Topology) – Object to validate relation hasTopology with.
Returns:True if topology is related to self with hasTopology.
Return type:bool
class pynml.nml.PortGroup(**kwargs)

A unordered set of Ports.

FIXME: Document PortGroup.

Inheritance

Inheritance diagram of PortGroup

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
is_source(link_group)

Check isSource relation with given link_group object.

FIXME: Document isSource relation.

Parameters:link_group (LinkGroup) – Object to validate relation isSource with.
Returns:True if link_group is related to self with isSource.
Return type:bool
set_has_label_group(lifetime)

Set the hasLabelGroup relation to given objects.

Parameters:lifetime (Lifetime) – Object to set to the hasLabelGroup relation.
class pynml.nml.LinkGroup(**kwargs)

A unordered set of Links.

FIXME: Document LinkGroup.

Inheritance

Inheritance diagram of LinkGroup

add_exists_during(lifetime)

Add given lifetime to this object existsDuring relations.

Parameters:lifetime (Lifetime) – Object to add to the existsDuring relation.

Add given port to this object hasLink relations.

Parameters:port (Port or PortGroup) – Object to add to the hasLink relation.

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 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 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

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

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
set_has_label_group(lifetime)

Set the hasLabelGroup relation to given objects.

Parameters:lifetime (Lifetime) – Object to set to the hasLabelGroup relation.
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

Inheritance diagram of BidirectionalPort

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.
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
set_has_port(port1, port2)

Set the hasPort relation to given objects.

Parameters:
  • port1 (Port or PortGroup) – One of the objects to set the hasPort relation.
  • port2 (Port or PortGroup) – One of the objects to set the hasPort relation.

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

Inheritance diagram of BidirectionalLink

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 all objects related with this object with relation hasLink.

Return type:set
Returns:A copy of the collection of objects related with this object.

Check hasLink relation with given link object.

FIXME: Document hasLink relation.

Parameters:link (Link or LinkGroup) – Object to validate relation hasLink with.
Returns:True if link is related to self with hasLink.
Return type:bool

Set the hasLink relation to given objects.

Parameters:
  • link1 (Link or LinkGroup) – One of the objects to set the hasLink relation.
  • link2 (Link or LinkGroup) – One of the objects to set the hasLink relation.
class pynml.nml.Environment(**kwargs)

Describes attributes inherent to the environment.

Attributes to be attached to the environment the topology is in..

Inheritance

Inheritance diagram of Environment

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

Inheritance diagram of Location

address

Get attribute address.

Returns:A vCard ADR property.
Return type:str
altitude

Get attribute altitude.

Returns:Altitude in WGS84 and in decimal meters.
Return type:str
identifier

Get attribute identifier.

Returns:Persistent globally unique URI.
Return type:str
latitude

Get attribute latitude.

Returns:Latitude in WGS84 and in decimal degrees.
Return type:str
longitude

Get attribute longitude.

Returns:Longitude in WGS84 and in decimal degrees.
Return type:str
name

Get attribute name.

Returns:Human readable string name.
Return type:str
unlocode

Get attribute unlocode.

Returns:UN/LOCODE location identifier.
Return type:str
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:
  • start (str) – Date and time formatted as ISO 8601 calendar date compact representation with UTC timezone (YYYYMMDDThhmmssZ).
  • end (str) – Date and time formatted as ISO 8601 calendar date compact representation with UTC timezone (YYYYMMDDThhmmssZ).

Inheritance

Inheritance diagram of Lifetime

end

Get attribute end.

Returns:Date and time formatted as ISO 8601 calendar date compact representation with UTC timezone (YYYYMMDDThhmmssZ).
Return type:str
start

Get attribute start.

Returns:Date and time formatted as ISO 8601 calendar date compact representation with UTC timezone (YYYYMMDDThhmmssZ).
Return type:str
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:
  • labeltype (None) – A technology-specific labelset.
  • value (None) – A specific value taken from a labelset.

Inheritance

Inheritance diagram of Label

class pynml.nml.LabelGroup(labeltype=None, value=None, **kwargs)

A unordered set of Labels.

FIXME: Document LabelGroup.

Parameters:
  • labeltype (None) – A technology-specific labelset.
  • value (None) – A specific value taken from a labelset.

Inheritance

Inheritance diagram of LabelGroup

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

Inheritance diagram of OrderedList

class pynml.nml.ListItem(**kwargs)

An element of an OrderedList.

Is a syntax-dependent object used to represent elements in an OrderedList.

Inheritance

Inheritance diagram of ListItem