geni.urn¶
Simple library for manipulating URNs, particularly those used for GENI objects
-
class
geni.urn.
Base
(*args)[source]¶ Base class representing any URN (RFC 2141).
-
__init__
(*args)[source]¶ Create a new generic URN
URNs can be initialized in one of two ways:
- Passing a single string in URN format (‘urn:NID:NSS‘)
- Passing two strings (the NID and the NSS) separately
-
-
class
geni.urn.
GENI
(*args)[source]¶ Class representing the URNs used by GENI, which use the publicid NID and IDN (domain name) scheme, then impose some additional strucutre.
-
static
GENIURNType
(s)[source]¶ Returns the type of the object if the URN is a valid GENI URN, or None otherwise.
-
TYPE_AUTHORITY
= 'authority'¶ Aggregate Managers, Slice Authorities, etc.
-
TYPE_IMAGE
= 'image'¶ Disk images
-
TYPE_INTERFACE
= 'interface'¶ Network interfaces
-
TYPE_LINK
= 'link'¶ Point-to-point and multipoint links
-
TYPE_NODE
= 'node'¶ Physical and virtual machines
-
TYPE_SLICE
= 'slice'¶ Container for allocated resources
-
TYPE_SLIVER
= 'sliver'¶ Slice of a specific resource
-
TYPE_USER
= 'user'¶ Principal
-
__init__
(*args)[source]¶ Create a URN in the format used for GENI objects
There are four forms of this constructor:
- Pass a single string in GENI URN format (‘urn:publicid:IDN+auth+type+name‘)
- Pass three arguments: the authority (a single string), the type (see the TYPE_ variables in this class), and the object name
- Pass three arguments: as #2, but the authorit(ies) are passed as a list, with the top-level authority coming first, followed by any subauthorities
- Pass three arguments: as #2, but the authority is a geni.aggregate.core.AM object, and the authority is taken from that object
Returns a list containing at least one authority string (the top level authority) and possibly additional subauthorities.
Return a single string capturing the entire authority/subauthority chain
-
static
isValidGENIURN
(s)[source]¶ Returns True if the given string is a valid URN in GENI format, False otherwise.
-
name
¶ Returns the ‘name’ part of a GENI URN.
-
type
¶ Returns the ‘type’ part of a GENI URN.
-
static
-
geni.urn.
Make
(s)[source]¶ Returns the ‘most specific’ URN object that it can for the given string.
Specifically, returns a GENI URN if the string is in GENI format, or a Base URN if it is not. May throw a MalformedURNError exception if the string is not a valid URN at all.