Moved xslt extensions to processors/
Sapan Bhatia [Tue, 15 Sep 2009 15:47:41 +0000 (15:47 +0000)]
sfatables/exec.py
sfatables/processors/accept.xsl [moved from sfatables/targets/accept.xsl with 100% similarity]
sfatables/processors/hrn.xsl [moved from sfatables/matches/hrn.xsl with 100% similarity]
sfatables/processors/max_link_bandwidth.xsl [moved from sfatables/targets/max_link_bandwidth.xsl with 100% similarity]
sfatables/processors/reject.xsl [moved from sfatables/targets/reject.xsl with 100% similarity]
sfatables/processors/restrict_to_nodes.xsl [moved from sfatables/targets/restrict_to_nodes.xsl with 100% similarity]
sfatables/xmlrule.py

index 5d096b6..0423850 100644 (file)
@@ -32,9 +32,39 @@ def main():
     incoming = SFATablesRules('INCOMING')
     outgoing = SFATablesRules('OUTGOING')
 
+    rspec = """
+<rspec>
+    <sfatables-input>
+        <rule>
+            <argument>
+                <name>whitelist</name>
+                <value>plc.princeton</value>
+            </argument>
+            <argument>
+                <name>blacklist</name>
+                <value>plc.princeton.planetlab-04</value>
+            </argument>
+        </rule>
+    </sfatables-input>
+    <request>
+        <nodespec>
+            <node name="plc.princeton.planetlab-01"/>
+            <node name="plc.princeton.planetlab-02"/>
+            <node name="plc.princeton.planetlab-03"/>
+            <node name="plc.princeton.planetlab-04"/>
+            <node name="plc.mit.csail.planetlab3"/>
+        </nodespec>
+    </request>
+</rspec>
+    """
+
+    
     print "%d rules loaded for INCOMING chain\n"%len(incoming.sorted_rule_list)
     print "%d rules loaded for OUTGOING chain\n"%len(outgoing.sorted_rule_list)
 
+    newrspec = incoming.apply(rspec)
+    import pdb
+    pdb.set_trace()
     return
 
 if __name__=="__main__":
index 381b587..258e75a 100644 (file)
@@ -12,7 +12,12 @@ class XMLRule:
     context = {'match':None,'target':None}
 
     def apply_processor(self, type, rspec):
-        processor = processors[type]
+        processor = self.processors[type]
+
+        # XXX TO CLEAN UP
+        filepath = 'processors/' + processor
+        # XXX
+
         styledoc = libxml2.parseFile(processor)
         style = libxslt.parseStylesheetDoc(styledoc)
         doc = libxml2.parseDoc(rspec)