diff options
-rw-r--r-- | conf/03_traffic.conf | 8 | ||||
-rw-r--r-- | conf/10_custom.conf | 8 | ||||
-rw-r--r-- | docs/configguide/trafficgen.rst | 1 | ||||
-rwxr-xr-x | tools/pkt_gen/xena/xena.py | 14 | ||||
-rw-r--r-- | tools/pkt_gen/xena/xena_json.py | 68 |
5 files changed, 95 insertions, 4 deletions
diff --git a/conf/03_traffic.conf b/conf/03_traffic.conf index 9dc03a46..9937294b 100644 --- a/conf/03_traffic.conf +++ b/conf/03_traffic.conf @@ -169,3 +169,11 @@ TRAFFICGEN_XENA_USER = '' TRAFFICGEN_XENA_PASSWORD = '' TRAFFICGEN_XENA_MODULE1 = '' TRAFFICGEN_XENA_MODULE2 = '' + +# Xena Port IP info +TRAFFICGEN_XENA_PORT0_IP = '192.168.199.10' +TRAFFICGEN_XENA_PORT0_CIDR = 24 +TRAFFICGEN_XENA_PORT0_GATEWAY = '192.168.199.1' +TRAFFICGEN_XENA_PORT1_IP = '192.168.199.11' +TRAFFICGEN_XENA_PORT1_CIDR = 24 +TRAFFICGEN_XENA_PORT1_GATEWAY = '192.168.199.1' diff --git a/conf/10_custom.conf b/conf/10_custom.conf index 63c75d39..4c9341a4 100644 --- a/conf/10_custom.conf +++ b/conf/10_custom.conf @@ -70,6 +70,14 @@ TRAFFICGEN_XENA_PASSWORD = '' TRAFFICGEN_XENA_MODULE1 = '' TRAFFICGEN_XENA_MODULE2 = '' +# Xena Port IP info +TRAFFICGEN_XENA_PORT0_IP = '192.168.199.10' +TRAFFICGEN_XENA_PORT0_CIDR = 24 +TRAFFICGEN_XENA_PORT0_GATEWAY = '192.168.199.1' +TRAFFICGEN_XENA_PORT1_IP = '192.168.199.11' +TRAFFICGEN_XENA_PORT1_CIDR = 24 +TRAFFICGEN_XENA_PORT1_GATEWAY = '192.168.199.1' + TEST_PARAMS = {'pkt_sizes':'64'} OPNFV_INSTALLER = "Fuel" diff --git a/docs/configguide/trafficgen.rst b/docs/configguide/trafficgen.rst index 41a48f61..f612569f 100644 --- a/docs/configguide/trafficgen.rst +++ b/docs/configguide/trafficgen.rst @@ -14,6 +14,7 @@ VSPERF supports the following traffic generators: traffic generator. * IXIA (IxNet and IxOS) * Spirent TestCenter + * Xena Networks To see the list of traffic gens from the cli: diff --git a/tools/pkt_gen/xena/xena.py b/tools/pkt_gen/xena/xena.py index dd23d0e5..67ac5652 100755 --- a/tools/pkt_gen/xena/xena.py +++ b/tools/pkt_gen/xena/xena.py @@ -142,11 +142,17 @@ class Xena(ITrafficGenerator): settings.getValue('TRAFFICGEN_XENA_PASSWORD') ) j_file.set_port(0, settings.getValue('TRAFFICGEN_XENA_MODULE1'), - settings.getValue('TRAFFICGEN_XENA_PORT1') - ) + settings.getValue('TRAFFICGEN_XENA_PORT1')) j_file.set_port(1, settings.getValue('TRAFFICGEN_XENA_MODULE2'), - settings.getValue('TRAFFICGEN_XENA_PORT2') - ) + settings.getValue('TRAFFICGEN_XENA_PORT2')) + j_file.set_port_ip_v4( + 0, settings.getValue("TRAFFICGEN_XENA_PORT0_IP"), + settings.getValue("TRAFFICGEN_XENA_PORT0_CIDR"), + settings.getValue("TRAFFICGEN_XENA_PORT0_GATEWAY")) + j_file.set_port_ip_v4( + 1, settings.getValue("TRAFFICGEN_XENA_PORT1_IP"), + settings.getValue("TRAFFICGEN_XENA_PORT1_CIDR"), + settings.getValue("TRAFFICGEN_XENA_PORT1_GATEWAY")) j_file.set_test_options( packet_sizes=self._params['traffic']['l2']['framesize'], iterations=trials, loss_rate=loss_rate, diff --git a/tools/pkt_gen/xena/xena_json.py b/tools/pkt_gen/xena/xena_json.py index 39cc56c8..971426cf 100644 --- a/tools/pkt_gen/xena/xena_json.py +++ b/tools/pkt_gen/xena/xena_json.py @@ -308,6 +308,52 @@ class XenaJSON(object): self.json_data['PortHandler']['EntityList'][index]['PortRef'][ 'PortIndex'] = port + def set_port_ip_v4(self, port, ip_addr, netmask, gateway): + """ + Set the port IP info + :param port: port number as int of port to set ip info + :param ip_addr: ip address in dot notation format as string + :param netmask: cidr number for netmask (ie 24/16/8) as int + :param gateway: gateway address in dot notation format + :return: None + """ + available_ports = range(len( + self.json_data['PortHandler']['EntityList'])) + if port not in available_ports: + raise ValueError("{}{}{}".format( + 'Port assignment must be an available port ', + 'number in baseconfig file. Port=', port)) + self.json_data['PortHandler']['EntityList'][ + port]["IpV4Address"] = ip_addr + self.json_data['PortHandler']['EntityList'][ + port]["IpV4Gateway"] = gateway + self.json_data['PortHandler']['EntityList'][ + port]["IpV4RoutingPrefix"] = int(netmask) + + def set_port_ip_v6(self, port, ip_addr, netmask, gateway): + """ + Set the port IP info + :param port: port number as int of port to set ip info + :param ip_addr: ip address as 8 groups of 4 hexadecimal groups separated + by a colon. + :param netmask: cidr number for netmask (ie 24/16/8) as int + :param gateway: gateway address as string in 8 group of 4 hexadecimal + groups separated by a colon. + :return: None + """ + available_ports = range(len( + self.json_data['PortHandler']['EntityList'])) + if port not in available_ports: + raise ValueError("{}{}{}".format( + 'Port assignment must be an available port ', + 'number in baseconfig file. Port=', port)) + self.json_data['PortHandler']['EntityList'][ + port]["IpV6Address"] = ip_addr + self.json_data['PortHandler']['EntityList'][ + port]["IpV6Gateway"] = gateway + self.json_data['PortHandler']['EntityList'][ + port]["IpV6RoutingPrefix"] = int(netmask) + def set_test_options(self, packet_sizes, duration, iterations, loss_rate, micro_tpld=False): """ @@ -418,6 +464,22 @@ def print_json_report(json_data): print("Chassis Password: {}".format(json_data['ChassisManager'][ 'ChassisList'][0]['Password'])) print("### Port Configuration ###") + print("Port 1 IPv4:{}/{} gateway:{}".format( + json_data['PortHandler']['EntityList'][0]["IpV4Address"], + json_data['PortHandler']['EntityList'][0]["IpV4RoutingPrefix"], + json_data['PortHandler']['EntityList'][0]["IpV4Gateway"])) + print("Port 1 IPv6:{}/{} gateway:{}".format( + json_data['PortHandler']['EntityList'][0]["IpV6Address"], + json_data['PortHandler']['EntityList'][0]["IpV6RoutingPrefix"], + json_data['PortHandler']['EntityList'][0]["IpV6Gateway"])) + print("Port 2 IPv4:{}/{} gateway:{}".format( + json_data['PortHandler']['EntityList'][1]["IpV4Address"], + json_data['PortHandler']['EntityList'][1]["IpV4RoutingPrefix"], + json_data['PortHandler']['EntityList'][1]["IpV4Gateway"])) + print("Port 2 IPv6:{}/{} gateway:{}".format( + json_data['PortHandler']['EntityList'][1]["IpV6Address"], + json_data['PortHandler']['EntityList'][1]["IpV6RoutingPrefix"], + json_data['PortHandler']['EntityList'][1]["IpV6Gateway"])) print("Port 1: {}/{} group: {}".format( json_data['PortHandler']['EntityList'][0]['PortRef']['ModuleIndex'], json_data['PortHandler']['EntityList'][0]['PortRef']['PortIndex'], @@ -512,6 +574,12 @@ if __name__ == "__main__": JSON.set_chassis_info('192.168.0.5', 'vsperf') JSON.set_port(0, 1, 0) JSON.set_port(1, 1, 1) + JSON.set_port_ip_v4(0, '192.168.240.10', 32, '192.168.240.1') + JSON.set_port_ip_v4(1, '192.168.240.11', 32, '192.168.240.1') + JSON.set_port_ip_v6(0, 'a1a1:a2a2:a3a3:a4a4:a5a5:a6a6:a7a7:a8a8', 128, + 'a1a1:a2a2:a3a3:a4a4:a5a5:a6a6:a7a7:1111') + JSON.set_port_ip_v6(1, 'b1b1:b2b2:b3b3:b4b4:b5b5:b6b6:b7b7:b8b8', 128, + 'b1b1:b2b2:b3b3:b4b4:b5b5:b6b6:b7b7:1111') JSON.set_header_layer2(dst_mac='dd:dd:dd:dd:dd:dd', src_mac='ee:ee:ee:ee:ee:ee') JSON.set_header_vlan(vlan_id=5) |