Initial commmit.
authorFaiyaz Ahmed <faiyaza@cs.princeton.edu>
Thu, 8 Jan 2009 22:06:51 +0000 (22:06 +0000)
committerFaiyaz Ahmed <faiyaza@cs.princeton.edu>
Thu, 8 Jan 2009 22:06:51 +0000 (22:06 +0000)
cmdline/testUser.sh
rspec/planetlab.xsd [new file with mode: 0644]
rspec/rspecvalidate.py [new file with mode: 0644]

index 59b909c..f1aa80a 100755 (executable)
@@ -6,7 +6,7 @@
 
 # The following lines use a test account. The account has a first name of "test"
 # and a last name of "account". The private key should be in the file test.pkey
-USERNAME=test
+USERNAME=${USERNAME-`whoami`}
 PARENT_HRN=planetlab.us.pl
 USER_HRN=$PARENT_HRN.account_test
 
@@ -18,9 +18,9 @@ USER_HRN=$PARENT_HRN.account_test
 
 # The following lines use Tony Mack's planetlab account on a live PLC
 # database (tony: copy your private key to tmack.pkey in the current directory)
-USERNAME=tmack
-PARENT_HRN=planetlab.us.princeton
-USER_HRN=$PARENT_HRN.Mack_Tony
+#USERNAME=tmack
+#PARENT_HRN=planetlab.us.princeton
+#USER_HRN=$PARENT_HRN.Mack_Tony
 
 PRIVKEY_FN=$USERNAME.pkey
 CRED_FN=$USERNAME.cred
diff --git a/rspec/planetlab.xsd b/rspec/planetlab.xsd
new file mode 100644 (file)
index 0000000..6be14cb
--- /dev/null
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:pl="http://www.planet-lab.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ecore:nsPrefix="pl" ecore:package="planetlab.planetlab" targetNamespace="http://www.planet-lab.org">
+  <xsd:import namespace="http://www.eclipse.org/emf/2002/Ecore" schemaLocation="../../../plugin/org.eclipse.emf.ecore/model/Ecore.xsd"/>
+  <xsd:element ecore:ignore="true" name="Network" type="pl:Network"/>
+  <xsd:element ecore:ignore="true" name="Node" type="pl:Node"/>
+  <xsd:element ecore:ignore="true" name="Link" type="pl:Link"/>
+  <xsd:element ecore:ignore="true" name="Interface" type="pl:Interface"/>
+  <xsd:element ecore:ignore="true" name="RSpec" type="pl:RSpec"/>
+  <xsd:complexType name="Network">
+    <xsd:sequence>
+      <xsd:element ecore:resolveProxies="true" maxOccurs="unbounded" minOccurs="0" name="links" type="pl:Link"/>
+    </xsd:sequence>
+    <xsd:attribute ecore:reference="pl:Node" name="nodes" use="required">
+      <xsd:simpleType>
+        <xsd:list itemType="xsd:anyURI"/>
+      </xsd:simpleType>
+    </xsd:attribute>
+  </xsd:complexType>
+  <xsd:complexType name="Node">
+    <xsd:attribute default="&quot;&quot;" ecore:changeable="false" ecore:unsettable="false" name="name" type="ecore:EString"/>
+    <xsd:attribute default="&quot;&quot;" ecore:unsettable="false" name="type" type="ecore:EString"/>
+    <xsd:attribute default="&quot;&quot;" ecore:name="init_script" ecore:unsettable="false" name="init_script" type="ecore:EString"/>
+    <xsd:attribute default="0" ecore:name="cpu_min" ecore:unsettable="false" name="cpu_min" type="ecore:EBigInteger"/>
+    <xsd:attribute default="0" ecore:name="cpu_share" ecore:unsettable="false" name="cpu_share" type="ecore:EBigInteger"/>
+    <xsd:attribute default="0" ecore:name="cpu_pct" ecore:unsettable="false" name="cpu_pct" type="ecore:EBigInteger"/>
+    <xsd:attribute default="0" ecore:name="disk_max" ecore:unsettable="false" name="disk_max" type="ecore:EBigInteger"/>
+    <xsd:attribute ecore:name="net_if" ecore:reference="pl:Interface" name="net_if" use="required">
+      <xsd:simpleType>
+        <xsd:list itemType="xsd:anyURI"/>
+      </xsd:simpleType>
+    </xsd:attribute>
+  </xsd:complexType>
+  <xsd:complexType name="Link">
+    <xsd:attribute default="&quot;&quot;" ecore:changeable="false" ecore:unsettable="false" name="type" type="ecore:EString"/>
+    <xsd:attribute default="0" ecore:unsettable="false" name="bw" type="ecore:EBigInteger"/>
+    <xsd:attribute default="0" ecore:name="min_alloc" ecore:unsettable="false" name="min_alloc" type="ecore:EBigInteger"/>
+    <xsd:attribute default="0" ecore:name="max_alloc" ecore:unsettable="false" name="max_alloc" type="ecore:EBigInteger"/>
+    <xsd:attribute ecore:changeable="false" ecore:reference="pl:Interface" name="endpoint" use="required">
+      <xsd:simpleType>
+        <xsd:list itemType="xsd:anyURI"/>
+      </xsd:simpleType>
+    </xsd:attribute>
+  </xsd:complexType>
+  <xsd:complexType name="Interface">
+    <xsd:attribute default="&quot;&quot;" ecore:changeable="false" ecore:unsettable="false" name="name" type="ecore:EString"/>
+    <xsd:attribute default="&quot;&quot;" ecore:changeable="false" ecore:unsettable="false" name="type" type="ecore:EString"/>
+    <xsd:attribute default="&quot;&quot;" ecore:changeable="false" ecore:unsettable="false" name="addr" type="ecore:EString"/>
+    <xsd:attribute default="0" ecore:name="min_rate" ecore:unsettable="false" name="min_rate" type="ecore:EBigInteger"/>
+    <xsd:attribute default="0" ecore:name="max_rate" ecore:unsettable="false" name="max_rate" type="ecore:EBigInteger"/>
+    <xsd:attribute default="0" ecore:name="max_kbyte" ecore:unsettable="false" name="max_kbyte" type="ecore:EBigInteger"/>
+  </xsd:complexType>
+  <xsd:complexType name="RSpec">
+    <xsd:attribute ecore:reference="pl:Network" name="networks" use="required">
+      <xsd:simpleType>
+        <xsd:list itemType="xsd:anyURI"/>
+      </xsd:simpleType>
+    </xsd:attribute>
+    <xsd:attribute ecore:name="start_time" name="start_time" type="ecore:EBigInteger"/>
+    <xsd:attribute name="duration" type="ecore:EBigInteger"/>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/rspec/rspecvalidate.py b/rspec/rspecvalidate.py
new file mode 100644 (file)
index 0000000..8a0a488
--- /dev/null
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+
+# $HeadURL$
+# $Id$
+
+#
+# Validate RSPEC hiearchy, values, types, and names using supplied xsd.
+#
+# Faiyaz Ahmed <faiyaza at cs dot princeton dot edu>
+#
+# Copyright 2009 Princeton University
+# http://www.planet-lab.org
+#
+
+import sys
+from xml.dom import minidom
+
+
+# parse