More bug fixes...
authorSapan Bhatia <sapanb@cs.princeton.edu>
Tue, 27 Oct 2009 03:23:12 +0000 (03:23 +0000)
committerSapan Bhatia <sapanb@cs.princeton.edu>
Tue, 27 Oct 2009 03:23:12 +0000 (03:23 +0000)
sfatables/processors/legacy-restrict-to-nodes.xsl
sfatables/processors/max_link_bandwidth.xsl
sfatables/processors/restrict_to_nodes.xsl
sfatables/runtime.py
sfatables/test.sfarspec

index 5e23184..b761a29 100644 (file)
@@ -9,8 +9,8 @@
         </xsl:copy>
     </xsl:template>
 
-    <xsl:variable name="whitelist_suffix" select="//rspec//target-context/argument[name='whitelist-dns-suffix']/value"/>
-    <xsl:variable name="blacklist_suffix" select="//rspec//target-context/argument[name='blacklist-dns-suffix']/value"/>
+    <xsl:variable name="whitelist_suffix" select="//RSpec//target-context/argument[name='whitelist-dns-suffix']/value"/>
+    <xsl:variable name="blacklist_suffix" select="//RSpec//target-context/argument[name='blacklist-dns-suffix']/value"/>
 
     <!-- Drop nodes that are not in the whitelist. This is the legacy version that works on the current
     rspec. The current rspec refers to dns names, not sfa names for nodes.-->
index 42b5711..4cfa4cf 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 -->
-    <xsl:variable name="max-link-bandwidth" select="//rspec//target-context/argument[name='max-link-bandwidth']/value"/>
+    <xsl:variable name="max-link-bandwidth" select="//RSpec//target-context/argument[name='max-link-bandwidth']/value"/>
 
     <!-- Drop Linkspecs for which bw > max-link-bandwidth -->
     <xsl:template match="LinkSpec">
index b6a3eba..4d8f648 100644 (file)
@@ -9,11 +9,12 @@
         </xsl:copy>
     </xsl:template>
 
-    <xsl:variable name="whitelist_prefix" select="//rspec//target-context/argument[name='whitelist']/value"/>
-    <xsl:variable name="blacklist_prefix" select="//rspec//target-context/argument[name='blacklist']/value"/>
+    <xsl:variable name="whitelist_prefix" select="//RSpec//target-context/argument[name='whitelist']/value"/>
+    <xsl:variable name="blacklist_prefix" select="//RSpec//target-context/argument[name='blacklist']/value"/>
 
     <!-- Drop nodes that are not in the whitelist -->
     <xsl:template match="node">
+        <xsl:value-of select="$blacklist_prefix"/>
             <xsl:choose>
                 <xsl:when test="starts-with(@name,$whitelist_prefix) and not($blacklist_prefix and starts-with(@name,$blacklist_prefix))">
                     <xsl:copy-of select="."/>
index 69dd665..f9263fb 100644 (file)
@@ -50,7 +50,9 @@ class SFATablesRules:
                 childNode = self.create_xml_node(k, context_dict[k])
                 node.addChild(childNode)
             else:
-                node.addContent(context_dict[k])
+                childNode = libxml2.newNode(k)
+                childNode.addContent(context_dict[k])
+                node.addChild(childNode)
         return node
                 
     def add_request_context_to_rspec(self, doc):
@@ -86,7 +88,7 @@ class SFATablesRules:
 
 def main():
     incoming = SFATablesRules('INCOMING')
-    incoming.set_context({'sfa':{'user':{'hrn':'ple.princeton.sapanb'}}})
+    incoming.set_context({'sfa':{'user':{'hrn':'plc.princeton.sapanb'}}})
 
     outgoing = SFATablesRules('OUTGOING')
     print "%d rules loaded for INCOMING chain"%len(incoming.sorted_rule_list)
index b84bec4..ca39017 100644 (file)
@@ -3,6 +3,7 @@
 <RSpec>
      <request-context><sfa><user><hrn>plc.princeton.sapanb</hrn></user></sfa></request-context>
      <match-context><argument><name>user-hrn</name><value>plc.princeton.sapanb</value></argument></match-context>
+     <target-context><argument><name>blacklist</name><value>plc.tp</value></argument></target-context>
      <request>
         <nodespec>
             <node name="plc.princeton.planetlab-01"/>