Bug fixes and cleanups
authorSapan Bhatia <sapanb@cs.princeton.edu>
Mon, 26 Oct 2009 03:15:57 +0000 (03:15 +0000)
committerSapan Bhatia <sapanb@cs.princeton.edu>
Mon, 26 Oct 2009 03:15:57 +0000 (03:15 +0000)
sfatables/commands/Add.py
sfatables/processors/link/restrict_slice.xml
sfatables/processors/max_link_bandwidth.xsl
sfatables/processors/restrict_to_nodes.xsl
sfatables/test.sfarspec
sfatables/xmlrule.py

index da02e86..c6f89a8 100644 (file)
@@ -4,12 +4,11 @@ from sfatables.command import Command
 from sfatables.globals import *
 
 class Add(Command):
 from sfatables.globals import *
 
 class Add(Command):
-    options = [('-A','--add')]
-    help = 'Add a rule to a chain'
-    matches = True
-    targets = True
-
     def __init__(self):
     def __init__(self):
+        self.options = [('-A','--add')]
+        self.help = 'Add a rule to a chain'
+        self.matches = True
+        self.targets = True
         return
 
     def getnextfilename(self,type,chain):
         return
 
     def getnextfilename(self,type,chain):
index 37c56d4..ee641cc 100644 (file)
@@ -11,7 +11,7 @@
     <!-- End of magic sauce -->
 
     <!-- Read in the value of the argument. See 'example_vini_rspec.xml' for an example of such an argument -->
     <!-- End of magic sauce -->
 
     <!-- Read in the value of the argument. See 'example_vini_rspec.xml' for an example of such an argument -->
-    <xsl:variable name="max-link-bandwidth" select="//RSpec//sfatables-rule/argument[name='max-link-bandwidth']/value"/>
+    <xsl:variable name="max-link-bandwidth" select="//RSpec//rule-context/argument[name='max-link-bandwidth']/value"/>
 
     <!-- Drop Linkspecs for which bw > max-link-bandwidth -->
     <xsl:template match="LinkSpec">
 
     <!-- Drop Linkspecs for which bw > max-link-bandwidth -->
     <xsl:template match="LinkSpec">
@@ -25,3 +25,4 @@
 
     <xsl:template match="sfatables-input"/>
 </xsl:stylesheet>
 
     <xsl:template match="sfatables-input"/>
 </xsl:stylesheet>
+>
index 37c56d4..ee641cc 100644 (file)
@@ -11,7 +11,7 @@
     <!-- End of magic sauce -->
 
     <!-- Read in the value of the argument. See 'example_vini_rspec.xml' for an example of such an argument -->
     <!-- End of magic sauce -->
 
     <!-- Read in the value of the argument. See 'example_vini_rspec.xml' for an example of such an argument -->
-    <xsl:variable name="max-link-bandwidth" select="//RSpec//sfatables-rule/argument[name='max-link-bandwidth']/value"/>
+    <xsl:variable name="max-link-bandwidth" select="//RSpec//rule-context/argument[name='max-link-bandwidth']/value"/>
 
     <!-- Drop Linkspecs for which bw > max-link-bandwidth -->
     <xsl:template match="LinkSpec">
 
     <!-- Drop Linkspecs for which bw > max-link-bandwidth -->
     <xsl:template match="LinkSpec">
@@ -25,3 +25,4 @@
 
     <xsl:template match="sfatables-input"/>
 </xsl:stylesheet>
 
     <xsl:template match="sfatables-input"/>
 </xsl:stylesheet>
+>
index f09a56f..492e383 100644 (file)
@@ -9,8 +9,8 @@
         </xsl:copy>
     </xsl:template>
 
         </xsl:copy>
     </xsl:template>
 
-    <xsl:variable name="whitelist_prefix" select="//rspec//sfatables-rule/argument[name='whitelist']/value"/>
-    <xsl:variable name="blacklist_prefix" select="//rspec//sfatables-rule/argument[name='blacklist']/value"/>
+    <xsl:variable name="whitelist_prefix" select="//rspec//rule-context/argument[name='whitelist']/value"/>
+    <xsl:variable name="blacklist_prefix" select="//rspec//rule-context/argument[name='blacklist']/value"/>
 
     <!-- Drop nodes that are not in the whitelist -->
     <xsl:template match="node">
 
     <!-- Drop nodes that are not in the whitelist -->
     <xsl:template match="node">
@@ -23,3 +23,4 @@
     </xsl:template>
 
 </xsl:stylesheet>
     </xsl:template>
 
 </xsl:stylesheet>
+et>
index 5a3a36b..ec9c362 100644 (file)
@@ -5,6 +5,13 @@
         <sfa><user><hrn>plc.princeton.sapanb</hrn></user></sfa>
     </request-context>
 
         <sfa><user><hrn>plc.princeton.sapanb</hrn></user></sfa>
     </request-context>
 
+    <rule-context>
+        <argument>
+        <name>blacklist</name>
+        <value>plc.tp</value>
+        </argument>
+    </rule-context>
+
      <request>
         <nodespec>
             <node name="plc.princeton.planetlab-01"/>
      <request>
         <nodespec>
             <node name="plc.princeton.planetlab-01"/>
@@ -15,3 +22,4 @@
         </nodespec>
     </request>
 </rspec>
         </nodespec>
     </request>
 </rspec>
+ec>
index 58a8d4c..b700b60 100644 (file)
@@ -42,11 +42,13 @@ class XMLRule:
         style = libxslt.parseStylesheetDoc(styledoc)
         #doc = libxml2.parseDoc(rspec)
         result = style.applyStylesheet(doc, None)
         style = libxslt.parseStylesheetDoc(styledoc)
         #doc = libxml2.parseDoc(rspec)
         result = style.applyStylesheet(doc, None)
-        stylesheet_result = result #style.saveResultToString(result)
+        stylesheet_result = style.saveResultToString(result)
         style.freeStylesheet()
         style.freeStylesheet()
-        #doc.freeDoc()
-        #result.freeDoc()
+        doc.freeDoc()
+        result.freeDoc()
 
 
+        import pdb
+        pdb.set_trace()
         return stylesheet_result
 
     def match(self, rspec):
         return stylesheet_result
 
     def match(self, rspec):