-
- self.config.service_chain = self.config.service_chain.upper()
- self.config.service_chain_count = int(self.config.service_chain_count)
- self.config.flow_count = utils.parse_flow_count(self.config.flow_count)
- required_flow_count = self.config.service_chain_count * 2
- if self.config.flow_count < required_flow_count:
- LOG.info("Flow count '{}' has been set to minimum value of '{}' "
- "for current configuration".format(self.config.flow_count,
- required_flow_count))
- self.config.flow_count = required_flow_count
-
- if self.config.flow_count % 2 != 0:
- self.config.flow_count += 1
-
- self.config.duration_sec = float(self.config.duration_sec)
- self.config.interval_sec = float(self.config.interval_sec)
-
- # Get traffic generator profile config
- if not self.config.generator_profile:
- self.config.generator_profile = self.config.traffic_generator.default_profile
-
- generator_factory = TrafficGeneratorFactory(self.config)
- self.config.generator_config = \
- generator_factory.get_generator_config(self.config.generator_profile)
-
- if not any(self.config.generator_config.pcis):
- raise Exception("PCI addresses configuration for selected traffic generator profile "
- "({tg_profile}) are missing. Please specify them in configuration file."
- .format(tg_profile=self.config.generator_profile))
-
- if self.config.traffic is None or len(self.config.traffic) == 0:
- raise Exception("No traffic profile found in traffic configuration, "
- "please fill 'traffic' section in configuration file.")
-
- if isinstance(self.config.traffic, tuple):
- self.config.traffic = self.config.traffic[0]
-
- self.config.frame_sizes = generator_factory.get_frame_sizes(self.config.traffic.profile)
-
- self.config.ipv6_mode = False
- self.config.no_dhcp = True
- self.config.same_network_only = True
- if self.config.openrc_file:
- self.config.openrc_file = os.path.expanduser(self.config.openrc_file)
-
- self.config.ndr_run = (not self.config.no_traffic
- and 'ndr' in self.config.rate.strip().lower().split('_'))
- self.config.pdr_run = (not self.config.no_traffic
- and 'pdr' in self.config.rate.strip().lower().split('_'))
- self.config.single_run = (not self.config.no_traffic
- and not (self.config.ndr_run or self.config.pdr_run))
-
- if self.config.vlans and len(self.config.vlans) != 2:
- raise Exception('Number of configured VLAN IDs for VLAN tagging must be exactly 2.')
-
- self.config.json_file = self.config.json if self.config.json else None
- if self.config.json_file:
- (path, filename) = os.path.split(self.config.json)
+ config = self.config
+
+ config.service_chain = config.service_chain.upper()
+ config.service_chain_count = int(config.service_chain_count)
+ if config.l2_loopback:
+ # force the number of chains to be 1 in case of l2 loopback
+ config.service_chain_count = 1
+ config.service_chain = ChainType.EXT
+ config.no_arp = True
+ LOG.info('Running L2 loopback: using EXT chain/no ARP')
+ config.flow_count = utils.parse_flow_count(config.flow_count)
+ required_flow_count = config.service_chain_count * 2
+ if config.flow_count < required_flow_count:
+ LOG.info("Flow count %d has been set to minimum value of '%d' "
+ "for current configuration", config.flow_count,
+ required_flow_count)
+ config.flow_count = required_flow_count
+
+ if config.flow_count % 2:
+ config.flow_count += 1
+
+ config.duration_sec = float(config.duration_sec)
+ config.interval_sec = float(config.interval_sec)
+ config.pause_sec = float(config.pause_sec)
+
+ if config.traffic is None or not config.traffic:
+ raise Exception("Missing traffic property in configuration")
+
+ if config.openrc_file:
+ config.openrc_file = os.path.expanduser(config.openrc_file)
+ if config.flavor.vcpus < 2:
+ raise Exception("Flavor vcpus must be >= 2")
+
+
+ config.ndr_run = (not config.no_traffic and
+ 'ndr' in config.rate.strip().lower().split('_'))
+ config.pdr_run = (not config.no_traffic and
+ 'pdr' in config.rate.strip().lower().split('_'))
+ config.single_run = (not config.no_traffic and
+ not (config.ndr_run or config.pdr_run))
+
+ config.json_file = config.json if config.json else None
+ if config.json_file:
+ (path, _filename) = os.path.split(config.json)