NAME

perfSONAR_PS::Topology::ID - A module that provides various utility functions for Topology IDs.

DESCRIPTION

This module contains a set of utility functions that are used to interact with Topology IDs.

SYNOPSIS

DETAILS

API

idConstruct($type1, $field1, $type2, $field2, $type3, $field3, $type4, $field4)

Constructs an a fully-qualified id based on the specified fields. No
sanity checking is performed to verify that the created ID makes sense.
The $type parameters are values like 'domain', 'node', etc whereas the
$field parameter is the ID for that element like "I2" or "HOPI". All
values past the first blank ("") type or field are ignored.

idIsFQ($id, $type)

Checks if the specified ID is a fully-qualified ID of the specified
type. If it is not a fully-qualified id, the function returns 0. If it
is an incorrect fully-qualified id(e.g. too many elements), it returns
-1. If it is a correctly specified fully-qualified id, it returns 1.

idAddLevel($id, $new_type, $new_level)

Takes a fully-qualified id and adds a new level onto it. No sanity
checking is done, it simply returns the ID created from the values
requested.

idRemoveLevel($id, $ret_type)

Takes a fully-qualified id and returns the parent level for the id. If
you'd like to know the type of the parent, you can add a reference to a
variable for $ret_type and the function will fill it in with the type
of the returned id.

e.g. urn:ogf:network:domain=hopi:node=losa would return
'urn:ogf:network:domain=hopi' and $ret_type would be filled in with
'domain'

idBaseLevel($id, $ret_type)

Returns the base level of the specified id. If you want to be informed
fo the type of the base element, you can add a reference to a variable
for $ret_type and the function will fill it in with the type of the
element.

e.g. urn:ogf:network:domain=hopi:node=losa would return 'losa' and
$ret_type would be filled in with 'node'

idEncode($element)

Performs any necessary encoding of the specified element for inclusion
in a fully-qualified id.

idDecode($element)

Decodes the specified element from a fully-qualified id.

idCompare($id1, $id2, $compare_to)

Compares the given ids to see if they match up to the specified field.
$compare_to can be any ID element type that the IDs have in common. It
returns an array containing two values. The first is either 0 or -1 and
tells whether the function failed or succeeded. If the function failed,
the next element in the array is the error message.

idSplit($id, $fq, $top_down)

Splits the specified fully-qualified id into its component elements. If
$fq is 1, the returns components are all fully-qualified. The components are returned in an array. The
first value of the array is the 0 or -1 specifying whether the function
succeeded or failed. The next element is a string for the type of the
ID. Each subsequent pair of elements corresponds to the type of the
element followed by the element itself. If $top_down is 0, the order is
the most specific element to least specific element. If $top_down is 1,
however, the order is reversed.

SEE ALSO

To join the 'perfSONAR-PS' mailing list, please visit:

https://mail.internet2.edu/wws/info/i2-perfsonar

The perfSONAR-PS subversion repository is located at:

https://svn.internet2.edu/svn/perfSONAR-PS

Questions and comments can be directed to the author, or the mailing list.

VERSION

$Id$

AUTHOR

Aaron Brown, <aaron@internet2.edu>

LICENSE

You should have received a copy of the Internet2 Intellectual Property Framework along with this software. If not, see <http://www.internet2.edu/membership/ip.html>

COPYRIGHT

Copyright (c) 2004-2007, Internet2 and the University of Delaware

All rights reserved.