NFVBENCH-110 EXT shared network requires 2 vlans per chain in config 79/65679/1 3.0.3
authorahothan <ahothan@cisco.com>
Sun, 9 Dec 2018 02:05:26 +0000 (18:05 -0800)
committerahothan <ahothan@cisco.com>
Sun, 9 Dec 2018 02:05:26 +0000 (18:05 -0800)
Change-Id: I6ba220eab476edd0e9f62c56a0c379250fc51916
Signed-off-by: ahothan <ahothan@cisco.com>
nfvbench/chaining.py

index ed379bc..5f9e1e8 100644 (file)
@@ -908,13 +908,22 @@ class ChainManager(object):
         # if it is a single int or mac, make it a list of 1 int
         if isinstance(ll, (int, str)):
             ll = [ll]
-        if not ll or len(ll) < self.chain_count:
-            raise ChainException('%s=%s must be a list with %d elements per chain' %
-                                 (list_name, ll, self.chain_count))
         for item in ll:
             if not re.match(pattern, str(item)):
                 raise ChainException("Invalid format '{item}' specified in {fname}"
                                      .format(item=item, fname=list_name))
+        # must have at least 1 element
+        if not ll:
+            raise ChainException('%s cannot be empty' % (list_name))
+        # for shared network, if 1 element is passed, replicate it as many times
+        # as chains
+        if self.config.service_chain_shared_net and len(ll) == 1:
+            ll = [ll[0]] * self.chain_count
+
+        # number of elements musty be the number of chains
+        elif len(ll) < self.chain_count:
+            raise ChainException('%s=%s must be a list with %d elements per chain' %
+                                 (list_name, ll, self.chain_count))
         return ll
 
     def _setup_image(self):