From: Sapan Bhatia <sapanb@cs.princeton.edu> Date: Wed, 16 Sep 2009 14:02:56 +0000 (+0000) Subject: Implemented terminal rules X-Git-Tag: sfa-0.9-3~67 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=342b9b05015e6a009d9dbccf559ae66334298b1f;p=sfa.git Implemented terminal rules --- diff --git a/sfatables/runtime.py b/sfatables/runtime.py index 0dab15d3..dc9e7cbf 100644 --- a/sfatables/runtime.py +++ b/sfatables/runtime.py @@ -26,6 +26,8 @@ class SFATablesRules: intermediate_rspec = rspec for rule in self.sorted_rule_list: intermediate_rspec = rule.apply_interpreted(intermediate_rspec) + if (rule.terminal): + break return intermediate_rspec @@ -33,37 +35,8 @@ def main(): incoming = SFATablesRules('INCOMING') outgoing = SFATablesRules('OUTGOING') - rspec = """ -<rspec> - <request-context> - <sfa><user><hrn>plc.princeton.sapan</hrn></user></sfa> - </request-context> + rspec = open(sys.argv[1]).read() - <sfatables-rule> - <argument> - <name>hrn</name> - <value>plc</value> - </argument> - <argument> - <name>whitelist</name> - <value>plc.princeton</value> - </argument> - <argument> - <name>blacklist</name> - <value>plc.tp</value> - </argument> - </sfatables-rule> - <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.tp.planetlab3"/> - </nodespec> - </request> -</rspec> - """ print "%d rules loaded for INCOMING chain\n"%len(incoming.sorted_rule_list) diff --git a/sfatables/sfatables b/sfatables/sfatables index 9abcf6cd..7f61a3f0 100755 --- a/sfatables/sfatables +++ b/sfatables/sfatables @@ -91,7 +91,7 @@ def main(): match_parser = create_parser_xml_ext(match_dict) matches_str = ",".join(match_dict.keys()) match_parser.add_option('-m','--match',dest='name',help='Match name (one of %s)'%matches_str, metavar = 'MATCH') - match_parser.add_option('-n','--negate',dest='negate',help='Negate result',action=store_true) + match_parser.add_option('-n','--negate',dest='negate',help='Negate result',action='store_true') (match_options, args) = match_parser.parse_args(pargs[1]) try: name = match_options.name