Commit bb76cd3b authored by Jonathon Duerig's avatar Jonathon Duerig

Added support for rspec version 2 to ptopgen.

Note that command line arguments for ptopgen are tweaked slightly so that after '-g' for GENI, you must enter a version number. Changed invocation in GeniCM. Also, tweaked rspec definitions to make it conform to reality on the ground inside of our system as it gets implemented.
parent d1536506
......@@ -275,7 +275,7 @@ sub GetAdvertisement($$)
my ($available, $pc) = @_;
my $xml = undef;
my $invocation = "$PTOPGEN -x -g -r -p GeniSlices";
my $invocation = "$PTOPGEN -x -g 0.1 -r -p GeniSlices";
$invocation .= " -a" unless $available;
if (defined($pc)) {
$invocation .= " -1 $pc";
......
......@@ -49,12 +49,12 @@
<xs:group ref="rspec:AnyExtension"/>
<xs:element ref="rspec:relation"/>
<xs:element ref="rspec:location"/>
<xs:element ref="rspec:services"/>
<xs:element ref="rspec:interface"/>
</xs:choice>
<xs:choice>
<xs:element ref="rspec:available"/>
<xs:element ref="rspec:cloud"/>
<xs:element ref="rspec:services"/>
<xs:element ref="rspec:hardware_type"/>
<xs:element name="sliver_type">
<xs:complexType>
......@@ -83,6 +83,7 @@
</xs:complexType>
<xs:element name="relation" type="rspec:RelationContents"/>
<xs:element name="location" type="rspec:LocationContents"/>
<xs:element name="services" type="rspec:ServiceContents"/>
<xs:element name="interface" type="rspec:InterfaceContents"/>
<xs:element name="available" type="rspec:AvailableContents"/>
<xs:element name="cloud">
......@@ -91,10 +92,40 @@
<xs:attributeGroup ref="rspec:AnyExtension"/>
</xs:complexType>
</xs:element>
<xs:element name="services" type="rspec:ServiceContents"/>
<xs:complexType name="ServiceContents">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:choice>
<xs:group ref="rspec:AnyExtension"/>
<xs:element ref="rspec:login"/>
</xs:choice>
<xs:choice>
<xs:element ref="rspec:install"/>
<xs:element ref="rspec:execute"/>
</xs:choice>
</xs:choice>
<xs:attributeGroup ref="rspec:AnyExtension"/>
</xs:complexType>
<xs:element name="login" type="rspec:LoginServiceContents"/>
<xs:element name="install" type="rspec:InstallServiceContents"/>
<xs:element name="execute" type="rspec:ExecuteServiceContents"/>
<xs:complexType name="LoginServiceContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="authentication" use="required">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="ssh-keys"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="hostname"/>
<xs:attribute name="port"/>
</xs:complexType>
<xs:complexType name="RelationContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="type" use="required"/>
<xs:attribute name="component_id" use="required"/>
</xs:complexType>
<xs:complexType name="LocationContents">
<xs:group ref="rspec:AnyExtension"/>
......@@ -191,4 +222,12 @@
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="name" use="required"/>
</xs:complexType>
<xs:complexType name="DiskImageContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="name" use="required"/>
<xs:attribute name="os"/>
<xs:attribute name="version"/>
<xs:attribute name="description"/>
</xs:complexType>
</xs:schema>
......@@ -36,8 +36,6 @@ NodeContents &=
# multiple physical links to connect to the same interface.
element cloud { AnyExtension } &
element services { ServiceContents } &
# Node type. This includes both hardware and sliver type elements:
HardwareType* &
element sliver_type {
......@@ -48,17 +46,14 @@ NodeContents &=
}*
}*
RelationContents &=
attribute component_id { text }
AvailableContents =
AnyExtension &
# Indictates current availability
attribute now { xsd:boolean }
DiskImageContents =
AnyExtension &
attribute name { text } &
attribute os { text }? &
attribute version { text }?
LinkContents &=
# Component identifiers
attribute component_id { text } &
......@@ -88,10 +83,6 @@ ExternalReferenceContents &=
attribute component_manager_id { text }?
ServiceContents &=
AnyExtension &
# Login services include ssh-services, serial consoles, etc.
element login { LoginServiceContents }* &
# Install services include download and extraction of a file at
# experiment startup.
element install { InstallServiceContents }* &
......@@ -99,14 +90,6 @@ ServiceContents &=
# Execute services include initialization scripts
element execute { ExecuteServiceContents }*
LoginServiceContents &=
AnyExtension &
# Authentication mechanism
attribute authentication { "ssh-keys" } &
# Access mechanism
attribute hostname { text } &
attribute port { text }
InstallServiceContents &=
AnyExtension &
# Type(s) of archives supported
......
......@@ -19,13 +19,6 @@
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="now" use="required" type="xs:boolean"/>
</xs:complexType>
<xs:complexType name="DiskImageContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="name" use="required"/>
<xs:attribute name="os"/>
<xs:attribute name="version"/>
</xs:complexType>
<xs:complexType name="MonitoringContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
......@@ -38,31 +31,6 @@
<xs:attribute name="component_id" use="required"/>
<xs:attribute name="component_manager_id"/>
</xs:complexType>
<xs:complexType name="ServiceContents">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="rspec:AnyExtension"/>
<xs:element ref="rspec:login"/>
<xs:element ref="rspec:install"/>
<xs:element ref="rspec:execute"/>
</xs:choice>
<xs:attributeGroup ref="rspec:AnyExtension"/>
</xs:complexType>
<xs:element name="login" type="rspec:LoginServiceContents"/>
<xs:element name="install" type="rspec:InstallServiceContents"/>
<xs:element name="execute" type="rspec:ExecuteServiceContents"/>
<xs:complexType name="LoginServiceContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="authentication" use="required">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="ssh-keys"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="hostname" use="required"/>
<xs:attribute name="port" use="required"/>
</xs:complexType>
<xs:complexType name="InstallServiceContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
......
......@@ -49,6 +49,9 @@ NodeContents =
# Information about the nodes physical location
element location { LocationContents } &
# Services set up by the CM provided on this node.
element services { ServiceContents }? &
# List of interfaces on this node. Interfaces are declared here. So
# all information about a particular interface including types
# belongs in the declaration. Other references to interfaces
......@@ -57,8 +60,22 @@ NodeContents =
InterfaceContents
}*
ServiceContents &=
AnyExtension &
# Login services include ssh-services, serial consoles, etc.
element login { LoginServiceContents }*
LoginServiceContents &=
AnyExtension &
# Authentication mechanism
attribute authentication { "ssh-keys" } &
# Access mechanism
attribute hostname { text }? &
attribute port { text }?
RelationContents =
AnyExtension
AnyExtension &
attribute type { text }
LocationContents =
AnyExtension &
......@@ -129,3 +146,11 @@ HardwareType = element hardware_type { HardwareTypeContents }
HardwareTypeContents =
AnyExtension &
attribute name { text }
DiskImageContents =
AnyExtension &
attribute name { text } &
attribute os { text }? &
attribute version { text }? &
attribute description { text }?
<?xml version="1.0" encoding="UTF-8"?>
<rspec xmlns="http://www.protogeni.net/resources/rspec/2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.protogeni.net/resources/rspec/2 http://www.protogeni.net/resources/rspec/2/request.xsd"
type="request" >
<!-- Manifests have completely specified component_ids to let you know which
component you actually got -->
<!-- Each individual node has its own sliver_id which allows you to restart
or lookup each one individually using the xmlrpc interface -->
<node client_id="left"
exclusive="true"
component_id="urn:publicid:IDN+emulab.net+node+pc17"
sliver_id="urn:publicid:IDN+emulab.net+sliver+8673">
<!-- The services tell you what the component manager has set up for you.
Here, the CM has set up an ssh server using the keys you passed into
RedeemTicket or CreateSliver using a particular hostname and port -->
<services>
<login authentication="ssh-keys" hostname="pc17.emulab.net" port="22" />
</services>
<sliver_type name="raw-pc">
<!-- We are currently implementing disk image selection and notification.
The CM will give you details about what image was loaded on the node -->
<disk_image
name="urn:publicid:IDN+emulab.net+image+emulab-ops/FBSD61-STD"
os="FBSD" version="6.1"
description="Standard freebsd 6.1 image" />
</sliver_type>
<!-- The CM binds every interface as well as giving the MAC address of
that interface -->
<interface client_id="left:if0"
component_id="urn:publicid:IDN+emulab.net+interface+pc17:eth1"
mac_address="13:11:22:33:44:55" />
</node>
<node client_id="right"
exclusive="true"
component_id="urn:publicid:IDN+emulab.net+node+pc18"
sliver_id="urn:publicid:IDN+emulab.net+sliver+8674">
<services>
<login authentication="ssh-keys" hostname="pc18.emulab.net" port="22" />
</services>
<sliver_type name="raw-pc">
<disk_image
name="urn:publicid:IDN+emulab.net+image+emulab-ops/FBSD61-STD"
os="FBSD" version="6.1"
description="Standard freebsd 6.1 image" />
</sliver_type>
<interface client_id="right:if0"
component_id="urn:publicid:IDN+emulab.net+interface+pc18:eth2"
mac_address="00:11:22:33:44:55" />
</node>
<!-- Links also get sliver_ids -->
<link client_id="center" sliver_id="urn:publicid:IDN+emulab.net+sliver+8675">
<interface_ref client_id="left:if0" />
<interface_ref client_id="right:if0" />
<!-- Link properties are specified so you know what network characteristics
to expect. Of course, this only applies to dedicated links -->
<property source_id="left:if0" dest_id="right:if0" capacity="100000"
latency="1" packet_loss="0.0" />
<property source_id="right:if0" dest_id="left:if0" capacity="100000"
latency="1" packet_loss="0.0" />
</link>
</rspec>
......@@ -41,11 +41,20 @@
<xs:group ref="rspec:AnyExtension"/>
<xs:element ref="rspec:relation"/>
<xs:element ref="rspec:location"/>
<xs:element ref="rspec:services"/>
<xs:element ref="rspec:interface"/>
</xs:choice>
<xs:choice>
<xs:element ref="rspec:hardware_type"/>
<xs:element ref="rspec:sliver_type"/>
<xs:element name="sliver_type">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="rspec:SliverTypeContents"/>
<xs:element ref="rspec:disk_image"/>
</xs:choice>
<xs:attributeGroup ref="rspec:SliverTypeContents"/>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:choice>
<xs:attributeGroup ref="rspec:AnyExtension"/>
......@@ -59,10 +68,43 @@
</xs:complexType>
<xs:element name="relation" type="rspec:RelationContents"/>
<xs:element name="location" type="rspec:LocationContents"/>
<xs:element name="services" type="rspec:ServiceContents"/>
<xs:element name="interface" type="rspec:InterfaceContents"/>
<xs:element name="disk_image" type="rspec:DiskImageContents"/>
<xs:complexType name="ServiceContents">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:choice>
<xs:group ref="rspec:AnyExtension"/>
<xs:element ref="rspec:login"/>
</xs:choice>
<xs:choice>
<xs:group ref="rspec:AnyExtension"/>
<xs:element ref="rspec:install"/>
<xs:element ref="rspec:execute"/>
</xs:choice>
</xs:choice>
<xs:attributeGroup ref="rspec:AnyExtension"/>
</xs:complexType>
<xs:element name="login" type="rspec:LoginServiceContents"/>
<xs:element name="install" type="rspec:InstallServiceContents"/>
<xs:element name="execute" type="rspec:ExecuteServiceContents"/>
<xs:complexType name="LoginServiceContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="authentication" use="required">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="ssh-keys"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="hostname"/>
<xs:attribute name="port"/>
</xs:complexType>
<xs:complexType name="RelationContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="type" use="required"/>
</xs:complexType>
<xs:complexType name="LocationContents">
<xs:group ref="rspec:AnyExtension"/>
......@@ -76,6 +118,7 @@
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="component_id"/>
<xs:attribute name="client_id" use="required"/>
<xs:attribute name="mac_address"/>
</xs:complexType>
<xs:complexType name="LinkContents">
<xs:choice minOccurs="0" maxOccurs="unbounded">
......@@ -131,16 +174,37 @@
<xs:attribute name="name" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="sliver_type" type="rspec:SliverTypeContents"/>
<xs:complexType name="SliverTypeContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:group name="SliverType">
<xs:sequence>
<xs:element name="sliver_type">
<xs:complexType>
<xs:group ref="rspec:SliverTypeContents"/>
<xs:attributeGroup ref="rspec:SliverTypeContents"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:group>
<xs:group name="SliverTypeContents">
<xs:sequence>
<xs:group ref="rspec:AnyExtension"/>
</xs:sequence>
</xs:group>
<xs:attributeGroup name="SliverTypeContents">
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="name" use="required"/>
</xs:complexType>
</xs:attributeGroup>
<xs:element name="hardware_type" type="rspec:HardwareTypeContents"/>
<xs:complexType name="HardwareTypeContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="name" use="required"/>
</xs:complexType>
<xs:complexType name="DiskImageContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="name" use="required"/>
<xs:attribute name="os"/>
<xs:attribute name="version"/>
<xs:attribute name="description"/>
</xs:complexType>
</xs:schema>
......@@ -15,6 +15,18 @@
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.protogeni.net/resources/rspec/2" xmlns:rspec="http://www.protogeni.net/resources/rspec/2">
<xs:include schemaLocation="manifest-common.xsd"/>
<!-- The ComponentName will only be available after an assignment -->
<xs:complexType name="InstallServiceContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="url" use="required"/>
<xs:attribute name="install_path" use="required"/>
</xs:complexType>
<xs:complexType name="ExecuteServiceContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="shell" use="required"/>
<xs:attribute name="command" use="required"/>
</xs:complexType>
<!-- The LinkMapping will only be available after an assignment -->
<!-- The ComponentInterfaceDeclName will only be available after an assignment -->
<!-- The ComponentInterfaceRefName will only be available after an assignment -->
......
......@@ -15,3 +15,6 @@ NodeContents &=
LinkContents &=
attribute sliver_id { text }
InterfaceContents &=
attribute mac_address { text } ?
......@@ -41,11 +41,20 @@
<xs:group ref="rspec:AnyExtension"/>
<xs:element ref="rspec:relation"/>
<xs:element ref="rspec:location"/>
<xs:element ref="rspec:services"/>
<xs:element ref="rspec:interface"/>
</xs:choice>
<xs:choice>
<xs:element ref="rspec:hardware_type"/>
<xs:element ref="rspec:sliver_type"/>
<xs:element name="sliver_type">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="rspec:SliverTypeContents"/>
<xs:element ref="rspec:disk_image"/>
</xs:choice>
<xs:attributeGroup ref="rspec:SliverTypeContents"/>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:choice>
<xs:attributeGroup ref="rspec:AnyExtension"/>
......@@ -58,10 +67,43 @@
</xs:complexType>
<xs:element name="relation" type="rspec:RelationContents"/>
<xs:element name="location" type="rspec:LocationContents"/>
<xs:element name="services" type="rspec:ServiceContents"/>
<xs:element name="interface" type="rspec:InterfaceContents"/>
<xs:element name="disk_image" type="rspec:DiskImageContents"/>
<xs:complexType name="ServiceContents">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:choice>
<xs:group ref="rspec:AnyExtension"/>
<xs:element ref="rspec:login"/>
</xs:choice>
<xs:choice>
<xs:group ref="rspec:AnyExtension"/>
<xs:element ref="rspec:install"/>
<xs:element ref="rspec:execute"/>
</xs:choice>
</xs:choice>
<xs:attributeGroup ref="rspec:AnyExtension"/>
</xs:complexType>
<xs:element name="login" type="rspec:LoginServiceContents"/>
<xs:element name="install" type="rspec:InstallServiceContents"/>
<xs:element name="execute" type="rspec:ExecuteServiceContents"/>
<xs:complexType name="LoginServiceContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="authentication" use="required">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="ssh-keys"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="hostname"/>
<xs:attribute name="port"/>
</xs:complexType>
<xs:complexType name="RelationContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="type" use="required"/>
</xs:complexType>
<xs:complexType name="LocationContents">
<xs:group ref="rspec:AnyExtension"/>
......@@ -129,16 +171,37 @@
<xs:attribute name="name" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="sliver_type" type="rspec:SliverTypeContents"/>
<xs:complexType name="SliverTypeContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:group name="SliverType">
<xs:sequence>
<xs:element name="sliver_type">
<xs:complexType>
<xs:group ref="rspec:SliverTypeContents"/>
<xs:attributeGroup ref="rspec:SliverTypeContents"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:group>
<xs:group name="SliverTypeContents">
<xs:sequence>
<xs:group ref="rspec:AnyExtension"/>
</xs:sequence>
</xs:group>
<xs:attributeGroup name="SliverTypeContents">
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="name" use="required"/>
</xs:complexType>
</xs:attributeGroup>
<xs:element name="hardware_type" type="rspec:HardwareTypeContents"/>
<xs:complexType name="HardwareTypeContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="name" use="required"/>
</xs:complexType>
<xs:complexType name="DiskImageContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="name" use="required"/>
<xs:attribute name="os"/>
<xs:attribute name="version"/>
<xs:attribute name="description"/>
</xs:complexType>
</xs:schema>
......@@ -33,7 +33,25 @@ NodeContents &=
# of hardware type may be specified and the sliver type must be
# specified.
HardwareType? &
SliverType
element sliver_type {
SliverTypeContents &
element disk_image { DiskImageContents }
}
ServiceContents &=
AnyExtension &
element install { InstallServiceContents }* &
element execute { ExecuteServiceContents }*
InstallServiceContents &=
AnyExtension &
attribute url { text } &
attribute install_path { text }
ExecuteServiceContents &=
AnyExtension &
attribute shell { text } &
attribute command { text }
# The LinkMapping will only be available after an assignment
LinkContents &=
......
......@@ -15,6 +15,18 @@
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.protogeni.net/resources/rspec/2" xmlns:rspec="http://www.protogeni.net/resources/rspec/2">
<xs:include schemaLocation="request-common.xsd"/>
<!-- The ComponentName will only be available after an assignment -->
<xs:complexType name="InstallServiceContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="url" use="required"/>
<xs:attribute name="install_path" use="required"/>
</xs:complexType>
<xs:complexType name="ExecuteServiceContents">
<xs:group ref="rspec:AnyExtension"/>
<xs:attributeGroup ref="rspec:AnyExtension"/>
<xs:attribute name="shell" use="required"/>
<xs:attribute name="command" use="required"/>
</xs:complexType>
<!-- The LinkMapping will only be available after an assignment -->
<!-- The ComponentInterfaceDeclName will only be available after an assignment -->
<!-- The ComponentInterfaceRefName will only be available after an assignment -->
......
......@@ -85,7 +85,7 @@ LIB_STUFF = libtbsetup.pm exitonwarn.pm libtestbed.pm snmpit_intel.pm \
libaudit.pm libreboot.pm libosload.pm libtestbed.py \
libadminmfs.pm libtblog.pm libtblog_simple.pm libArchive.pm \
power_mail.pm power_whol.pm Template.pm power_rmcp.pm \
power_ilo.pm libvtop.pm
power_ilo.pm libvtop.pm libptop.pm
# These scripts installed setuid, with sudo.
SETUID_BIN_SCRIPTS = node_reboot eventsys_control tarfiles_setup savelogs \
......
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2010 University of Utah and the Flux Group.
# All rights reserved.
#
package libptop;
use strict;
use Exporter;
use vars qw(@ISA @EXPORT @EXPORT_OK);
@ISA = "Exporter";
@EXPORT = qw( );
sub Create($)
{
my ($class) = @_;
my $self = {};
$self->{'NODES'} = {};
$self->{'LINKS'} = {};
bless($self, $class);
return $self;
}
# Accessors
sub nodes($) { return $_[0]->{'NODES'}; }
sub links($) { return $_[0]->{'LINKS'}; }
# Add new nodes and links
sub CreateNode($$)
{
my ($self, $name) = @_;
my $node = libptop::pnode->Create($name);
$self->nodes()->{$name} = $node;
return $node;
}
###############################################################################
# Physical Nodes. These contain the all of the per-node state used to
# generate ptop or xml files.
package libptop::pnode;
sub Create($$)
{
my ($class, $name) = @_;
my $self = {};
$self->{'NAME'} = $name;
$self->{'SUBNODE_OF'} = undef;
$self->{'IS_REMOTE'} = undef;
bless($self, $class);
return $self;
}
# Accessors
sub name($) { return $_[0]->{'NAME'}; }
sub subnode_of($) { return $_[0]->{'SUBNODE_OF'}; }
sub is_subnode($) { return defined($_[0]->subnode_of()); }
sub is_remote($) { return $_[0]->{'IS_REMOTE'}; }
sub SetSubnode($$$)
{
my ($self, $phys_name, $is_subnode) = @_;
if ($is_subnode) {
$self->{'SUBNODE_OF'} = $phys_name;
} else {
$self->{'SUBNODE_OF'} = undef;
}
}
sub SetRemote($$)
{
my ($self, $isremote) = @_;
$self->{'IS_REMOTE'} = $isremote;
}
package libptop::ptype;
sub Create($$)
{
my ($class, $name) = @_;
my $self = {};
$self->{'NAME'} = $name;
$self->{'OSIDS'} = ();
bless($self, $class);
return $self;
}
sub name($) { return $_[0]->{'NAME'}; }
sub osids($) { return $_[0]->{'OSIDS'}; }
sub AddOs($$)
{
my ($self, $name) = @_;
push($self->{'OSIDS'}, $name);
}
1;
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment