Merge "convert networkcapacity to LF"
[yardstick.git] / yardstick / cmd / commands / task.py
index ca7c428..a10a2a8 100644 (file)
@@ -51,7 +51,7 @@ class TaskCommands(object):
              output_file_default, default=output_file_default)
     @cliargs("--suite", help="process test suite file instead of a task file",
              action="store_true")
-    def do_start(self, args):
+    def do_start(self, args, **kwargs):
         '''Start a benchmark scenario.'''
 
         atexit.register(atexit_handler)
@@ -275,10 +275,16 @@ class TaskParser(object):
         for cfg_attrs in context_cfgs:
             context_type = cfg_attrs.get("type", "Heat")
             if "Heat" == context_type and "networks" in cfg_attrs:
+                # bugfix: if there are more than one network,
+                # only add "external_network" on first one.
+                # the name of netwrok should follow this rule:
+                # test, test2, test3 ...
+                # sort network with the length of network's name
+                sorted_networks = sorted(cfg_attrs["networks"].keys())
                 # config external_network based on env var
-                for _, attrs in cfg_attrs["networks"].items():
-                    attrs["external_network"] = os.environ.get(
-                        'EXTERNAL_NETWORK', 'net04_ext')
+                cfg_attrs["networks"][sorted_networks[0]]["external_network"] \
+                    = os.environ.get("EXTERNAL_NETWORK", "net04_ext")
+
             context = Context.get(context_type)
             context.init(cfg_attrs)