def generate_flow_combinations(self, config): client_nic = config.host1.msec0 server_nic = config.host2.msec0 client_netns = client_nic.netns server_netns = server_nic.netns for ipv in self.params.ip_versions: if ipv == "ipv4": family = AF_INET elif ipv == "ipv6": family = AF_INET6 client_bind = client_nic.ips_filter(family=family)[0] server_bind = server_nic.ips_filter(family=family)[0] for perf_test in self.params.perf_tests: for size in self.params.perf_msg_sizes: pstreams = self.params.perf_parallel_streams flow = PerfFlow(type=perf_test, generator=client_netns, generator_bind=client_bind, receiver=server_netns, receiver_bind=server_bind, msg_size=size, duration=self.params.perf_duration, parallel_streams=pstreams, cpupin=self.params.perf_tool_cpu if ("perf_tool_cpu" in self.params) else None) yield [flow]
def _create_perf_flow( self, perf_test, client_nic, client_bind, server_nic, server_bind, msg_size, ) -> PerfFlow: """ Wrapper to create a PerfFlow. Mixins that want to change this behavior (for example, to reverse the direction) can override this method as an alternative to overriding :any:`generate_flow_combinations` """ return PerfFlow( type=perf_test, generator=client_nic.netns, generator_bind=client_bind, generator_nic=client_nic, receiver=server_nic.netns, receiver_bind=server_bind, receiver_nic=server_nic, msg_size=msg_size, duration=self.params.perf_duration, parallel_streams=self.params.perf_parallel_streams, cpupin=(self.params.perf_tool_cpu if "perf_tool_cpu" in self.params else None), )
def generate_flow_combinations(self, config): """ Flow combinations are generated based on the tunnel endpoints and test parameters. """ nic1, nic2 = config.endpoint1, config.endpoint2 ns1, ns2 = config.endpoint1.netns, config.endpoint2.netns ip1, ip2 = config.ips for perf_test in self.params.perf_tests: for size in self.params.perf_msg_sizes: flow = PerfFlow( type=perf_test, generator=ns1, generator_bind=ip1, generator_nic=nic1, receiver=ns2, receiver_bind=ip2, receiver_nic=nic2, msg_size=size, duration=self.params.perf_duration, parallel_streams=self.params.perf_parallel_streams, cpupin=self.params.perf_tool_cpu if ( "perf_tool_cpu" in self.params) else None ) yield [flow] if ("perf_reverse" in self.params and self.params.perf_reverse): reverse_flow = self._create_reverse_flow(flow) yield [reverse_flow]
def generate_perf_config(self, config): flows = [] for src_nic, dst_nic in zip(config.generator.nics, config.dut.nics): src_bind = dict(mac_addr=src_nic.hwaddr, pci_addr=src_nic.bus_info, ip_addr=src_nic.ips[0]) dst_bind = dict(mac_addr=dst_nic.hwaddr, pci_addr=dst_nic.bus_info, ip_addr=dst_nic.ips[0]) flows.append( PerfFlow(type="pvp_loop_rate", generator=config.generator.host, generator_bind=src_bind, receiver=config.dut.host, receiver_bind=dst_bind, msg_size=self.params.perf_msg_size, duration=self.params.perf_duration, parallel_streams=self.params.perf_streams, cpupin=None)) return PerfRecipeConf(measurements=[ self.params.cpu_perf_tool( [config.generator.host, config.dut.host, config.guest.host]), TRexFlowMeasurement(flows, self.params.trex_dir) ], iterations=self.params.perf_iterations)
def generate_flow_combinations(self, config): for client_nic, server_nic in self.generate_perf_endpoints(config): for ipv in self.params.ip_versions: if ipv == "ipv4": family = AF_INET elif ipv == "ipv6": family = AF_INET6 client_bind = client_nic.ips_filter(family=family)[0] server_bind = server_nic.ips_filter(family=family)[0] for perf_test in self.params.perf_tests: for size in self.params.perf_msg_sizes: flow = PerfFlow( type=perf_test, generator=client_nic.netns, generator_bind=client_bind, receiver=server_nic.netns, receiver_bind=server_bind, msg_size=size, duration=self.params.perf_duration, parallel_streams=self.params.perf_parallel_streams, cpupin=self.params.perf_tool_cpu if "perf_tool_cpu" in self.params else None) yield [flow] if self.params.perf_reverse: reverse_flow = self._create_reverse_flow(flow) yield [reverse_flow]
def _create_reverse_flow(self, flow): rev_flow = PerfFlow(type=flow.type, generator=flow.receiver, generator_bind=flow.receiver_bind, receiver=flow.generator, receiver_bind=flow.generator_bind, msg_size=flow.msg_size, duration=flow.duration, parallel_streams=flow.parallel_streams, cpupin=flow.cpupin) return rev_flow
def generate_perf_config(self, config): flows = [] for src_nic, dst_nic in zip(config.generator.nics, config.dut.nics): src_bind = dict(mac_addr=src_nic.hwaddr, pci_addr=src_nic.bus_info, ip_addr=src_nic.ips[0], family=src_nic.ips[0].family) dst_bind = dict(mac_addr=dst_nic.hwaddr, pci_addr=dst_nic.bus_info, ip_addr=dst_nic.ips[0], family=dst_nic.ips[0].family) flows.append( PerfFlow(type="pvp_loop_rate", generator=config.generator.host, generator_nic=src_nic, generator_bind=src_bind, receiver=config.dut.host, receiver_nic=dst_nic, receiver_bind=dst_bind, msg_size=self.params.perf_msg_size, duration=self.params.perf_duration, parallel_streams=self.params.perf_streams, cpupin=None)) perf_recipe_conf = dict( recipe_config=config, flows=flows, ) cpu_measurement = self.params.cpu_perf_tool( [config.generator.host, config.dut.host, config.guest.host], perf_recipe_conf) flows_measurement = TRexFlowMeasurement( flows, self.params.trex_dir, self.params.host1_dpdk_cores.split(","), perf_recipe_conf, ) perf_conf = PerfRecipeConf( measurements=[ cpu_measurement, flows_measurement, ], iterations=self.params.perf_iterations, ) perf_conf.register_evaluators(cpu_measurement, self.cpu_perf_evaluators) perf_conf.register_evaluators(flows_measurement, self.net_perf_evaluators) return perf_conf
def generate_perf_config(self, config): flows = [] for i in range(0, min(len(config.generator.nics), len(config.guest.nics))): src_nic = config.generator.nics[i] src_ip = src_nic.ips[0] dst_nic = config.guest.nics[i] dst_ip = config.generator.nics[((i + 1) % len(config.generator.nics))].ips[0] src_bind = dict(mac_addr=src_nic.hwaddr, pci_addr=src_nic.bus_info, ip_addr=src_ip) dst_bind = dict(mac_addr=dst_nic.hwaddr, pci_addr=dst_nic.bus_info, ip_addr=dst_ip) flows.append( PerfFlow(type="pvp_loop_rate", generator=config.generator.host, generator_bind=src_bind, receiver=config.guest.host, receiver_bind=dst_bind, msg_size=self.params.perf_msg_size, duration=self.params.perf_duration, parallel_streams=self.params.perf_streams, cpupin=None)) return PerfRecipeConf( measurements=[ self.params.cpu_perf_tool([ config.generator.host, config.dut.host, config.guest.host ]), TRexFlowMeasurement( flows, self.params.trex_dir, self.params.host1_dpdk_cores.split(","), ), ], iterations=self.params.perf_iterations, )
def generate_perf_configurations(self, config): """ OvSDPDKBondRecipe perf test configuration generator. OvSDPDKBondRecipe requires a specific TrexFlowMeasurement configuration, where it needs additional parameters, therefore it overrides the inherited method from the :any:`BaseEnrtRecipe`. The generator creates and loops over all flow combinations between the hosts to measure the performance. In addition to that during each flow combination measurement, we add CPU utilization measurement to run in the background. Finally for each generated perf test configuration we register measurement evaluators based on the :any:`cpu_perf_evaluators` and :any:`net_perf_evaluators` properties. :return: Perf test configuration :rtype: :any:`PerfRecipeConf` """ host1, host2 = self.matched.host1, self.matched.host2 testpmd_nics = [host1.dummy_cfg.eth0, host1.dummy_cfg.eth1] trex_nics = [host2.dummy_cfg.eth0, host2.dummy_cfg.eth1] flows = [] for trex_nic, testpmd_nic in zip(trex_nics, testpmd_nics): trex_bind = dict(mac_addr=trex_nic.hwaddr, pci_addr=trex_nic.bus_info, ip_addr=trex_nic.ips[0], family=trex_nic.ips[0].family) testpmd_bind = dict(mac_addr=testpmd_nic.hwaddr, pci_addr=testpmd_nic.bus_info, ip_addr=testpmd_nic.ips[0], family=testpmd_nic.ips[0].family) flows.append(PerfFlow( type="UDPMultiflow", generator=host2, generator_nic=trex_nic, generator_bind=trex_bind, receiver=host1, receiver_nic=testpmd_nic, receiver_bind=testpmd_bind, msg_size=self.params.perf_msg_size, duration=self.params.perf_duration, parallel_streams=1, cpupin=None)) perf_recipe_conf = dict( recipe_config=config, flows=flows, ) cpu_measurement = self.params.cpu_perf_tool([host1, host2], perf_recipe_conf) flows_measurement = TRexFlowMeasurement( flows, self.params.trex_dir, self.params.trex_dpdk_cores.split(","), perf_recipe_conf, ) perf_conf = PerfRecipeConf( measurements=[ cpu_measurement, flows_measurement, ], iterations=self.params.perf_iterations, ) perf_conf.register_evaluators(cpu_measurement, self.cpu_perf_evaluators) perf_conf.register_evaluators(flows_measurement, self.net_perf_evaluators) return perf_conf