From 3911c6d97e010f6cf8faed8fc9800a90028d7aea Mon Sep 17 00:00:00 2001 From: Sapan Bhatia Date: Tue, 15 Sep 2009 15:47:41 +0000 Subject: [PATCH] Moved xslt extensions to processors/ --- sfatables/exec.py | 30 +++++++++++++++++++ sfatables/{targets => processors}/accept.xsl | 0 sfatables/{matches => processors}/hrn.xsl | 0 .../max_link_bandwidth.xsl | 0 sfatables/{targets => processors}/reject.xsl | 0 .../restrict_to_nodes.xsl | 0 sfatables/xmlrule.py | 7 ++++- 7 files changed, 36 insertions(+), 1 deletion(-) rename sfatables/{targets => processors}/accept.xsl (100%) rename sfatables/{matches => processors}/hrn.xsl (100%) rename sfatables/{targets => processors}/max_link_bandwidth.xsl (100%) rename sfatables/{targets => processors}/reject.xsl (100%) rename sfatables/{targets => processors}/restrict_to_nodes.xsl (100%) diff --git a/sfatables/exec.py b/sfatables/exec.py index 5d096b6f..0423850b 100644 --- a/sfatables/exec.py +++ b/sfatables/exec.py @@ -32,9 +32,39 @@ def main(): incoming = SFATablesRules('INCOMING') outgoing = SFATablesRules('OUTGOING') + rspec = """ + + + + + whitelist + plc.princeton + + + blacklist + plc.princeton.planetlab-04 + + + + + + + + + + + + + + """ + + 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__": diff --git a/sfatables/targets/accept.xsl b/sfatables/processors/accept.xsl similarity index 100% rename from sfatables/targets/accept.xsl rename to sfatables/processors/accept.xsl diff --git a/sfatables/matches/hrn.xsl b/sfatables/processors/hrn.xsl similarity index 100% rename from sfatables/matches/hrn.xsl rename to sfatables/processors/hrn.xsl diff --git a/sfatables/targets/max_link_bandwidth.xsl b/sfatables/processors/max_link_bandwidth.xsl similarity index 100% rename from sfatables/targets/max_link_bandwidth.xsl rename to sfatables/processors/max_link_bandwidth.xsl diff --git a/sfatables/targets/reject.xsl b/sfatables/processors/reject.xsl similarity index 100% rename from sfatables/targets/reject.xsl rename to sfatables/processors/reject.xsl diff --git a/sfatables/targets/restrict_to_nodes.xsl b/sfatables/processors/restrict_to_nodes.xsl similarity index 100% rename from sfatables/targets/restrict_to_nodes.xsl rename to sfatables/processors/restrict_to_nodes.xsl diff --git a/sfatables/xmlrule.py b/sfatables/xmlrule.py index 381b5871..258e75a1 100644 --- a/sfatables/xmlrule.py +++ b/sfatables/xmlrule.py @@ -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) -- 2.43.0