From: Sapan Bhatia Date: Tue, 22 Sep 2009 18:00:05 +0000 (+0000) Subject: Updating new target names in the initializer. X-Git-Tag: sfa-0.9-3~55 X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=commitdiff_plain;h=88665387c6da04b7a87d21baec918f18fdda29c3 Updating new target names in the initializer. --- diff --git a/sfatables/commands/Add.py b/sfatables/commands/Add.py index 4f0e6067..e0c190fb 100644 --- a/sfatables/commands/Add.py +++ b/sfatables/commands/Add.py @@ -33,12 +33,13 @@ class Add(Command): p = xmldoc.xpathNewContext() supplied_arguments = options.arguments + element = options.element for option in supplied_arguments: option_name = option['name'] option_value = getattr(options,option_name) if (hasattr(options,option_name)): - context = p.xpathEval("//rule/argument[name='%s']"%option_name) + context = p.xpathEval("//rule[@element='%s' or @element='*']/argument[name='%s']"%element, option_name) if (not context): raise Exception('Unknown option %s for match %s'%(option,option['name'])) else: diff --git a/sfatables/sfatables b/sfatables/sfatables index 7f61a3f0..32b2f8dd 100755 --- a/sfatables/sfatables +++ b/sfatables/sfatables @@ -113,11 +113,12 @@ def main(): target_parser = create_parser_xml_ext(target_dict) targets_str = ",".join(target_dict.keys()) target_parser.add_option('-j','--jump',dest='name',help='Target name (one of %s)'%targets, metavar = 'TARGET') + target_parser.add_option('-e','--element',dest='element',help='Element name'%targets, metavar = 'ELEMENT') (target_options, args) = target_parser.parse_args(pargs[2]) try: name = target_options.name except Exception: - print "Must specify target name with -m" + print "Must specify target name with -j" if (target_dict.has_key(name)): setattr(target_options, 'arguments', target_dict[name].arguments) diff --git a/sfatables/targets/__init__.py b/sfatables/targets/__init__.py index 3a5e632c..1dcc2d1e 100644 --- a/sfatables/targets/__init__.py +++ b/sfatables/targets/__init__.py @@ -1,6 +1,6 @@ all=""" -RESTRICT_TO_NODES +RESTRICT_SLICE_DOMAIN ACCEPT REJECT -MAX_LINK_BW +RESTRICT_SLICE_PROP """.split()