From af52e17f717ee272577bcaa3524b272531752423 Mon Sep 17 00:00:00 2001 From: Ido Barnea Date: Wed, 15 Feb 2017 17:17:18 +0200 Subject: VLAN keyword in platform config file will now make all traffic be sent over vlan Signed-off-by: Ido Barnea --- .../regression/setups/trex25/benchmark.yaml | 4 + .../regression/stateful_tests/trex_vlan_test.py | 83 +++++++++++++++++++++ .../stf/trex_stf_lib/trex_client.py | 25 +++++++ scripts/cap2/dns.yaml | 2 - scripts/cap2/dns_no_delay.yaml | 2 - scripts/cap2/ipv4_load_balance.yaml | 21 ++++++ scripts/cap2/ipv4_vlan.yaml | 21 ------ scripts/cap2/ipv6_load_balance.yaml | 23 ++++++ scripts/cap2/ipv6_vlan.yaml | 23 ------ scripts/cap2/jumbo.yaml | 2 - scripts/cap2/wrong_ip.yaml | 2 - scripts/exp/ipv4_load_balance-0-ex.erf | Bin 0 -> 10560 bytes scripts/exp/ipv4_vlan-0-ex.erf | Bin 10560 -> 0 bytes scripts/exp/ipv4_vlan-0.erf | Bin 10560 -> 0 bytes scripts/exp/ipv6_load_balance-0-ex.erf | Bin 0 -> 13440 bytes scripts/exp/ipv6_vlan-0-ex.erf | Bin 13440 -> 0 bytes scripts/exp/ipv6_vlan-0.erf | Bin 13440 -> 0 bytes 17 files changed, 156 insertions(+), 52 deletions(-) create mode 100644 scripts/automation/regression/stateful_tests/trex_vlan_test.py create mode 100755 scripts/cap2/ipv4_load_balance.yaml delete mode 100755 scripts/cap2/ipv4_vlan.yaml create mode 100755 scripts/cap2/ipv6_load_balance.yaml delete mode 100755 scripts/cap2/ipv6_vlan.yaml create mode 100755 scripts/exp/ipv4_load_balance-0-ex.erf delete mode 100755 scripts/exp/ipv4_vlan-0-ex.erf delete mode 100644 scripts/exp/ipv4_vlan-0.erf create mode 100755 scripts/exp/ipv6_load_balance-0-ex.erf delete mode 100755 scripts/exp/ipv6_vlan-0-ex.erf delete mode 100644 scripts/exp/ipv6_vlan-0.erf (limited to 'scripts') diff --git a/scripts/automation/regression/setups/trex25/benchmark.yaml b/scripts/automation/regression/setups/trex25/benchmark.yaml index 2c677b81..7f357ce1 100644 --- a/scripts/automation/regression/setups/trex25/benchmark.yaml +++ b/scripts/automation/regression/setups/trex25/benchmark.yaml @@ -107,6 +107,10 @@ test_client_cfg_vlan: cores : 1 multiplier : 10 +test_platform_cfg_vlan: + cores : 1 + multiplier : 10 + test_rx_check_http: &rx_http multiplier : 8800 cores : 1 diff --git a/scripts/automation/regression/stateful_tests/trex_vlan_test.py b/scripts/automation/regression/stateful_tests/trex_vlan_test.py new file mode 100644 index 00000000..13d89565 --- /dev/null +++ b/scripts/automation/regression/stateful_tests/trex_vlan_test.py @@ -0,0 +1,83 @@ +#!/router/bin/python +from .trex_general_test import CTRexGeneral_Test, CTRexScenario +from .tests_exceptions import * +import time +from CPlatform import CStaticRouteConfig + +class CTRexVlan_Test(CTRexGeneral_Test):#(unittest.TestCase): + """This class defines test for vlan platform configutation file""" + def __init__(self, *args, **kwargs): + super(CTRexVlan_Test, self).__init__(*args, **kwargs) + self.unsupported_modes = ['loopback'] # We test on routers + + def setUp(self): + super(CTRexVlan_Test, self).setUp() # launch super test class setUp process + + def test_platform_cfg_vlan(self): + if self.is_loopback: + self.skip('Not relevant on loopback') + + if not CTRexScenario.router_cfg['no_dut_config']: + self.router.configure_basic_interfaces(vlan = True) + self.router.config_pbr(mode = "config", vlan = True) + + mult = self.get_benchmark_param('multiplier') + core = self.get_benchmark_param('cores') + + self.create_vlan_conf_file() + + ret = self.trex.start_trex ( + c = core, + m = mult, + d = 60, + f = 'cap2/dns.yaml', + cfg = '/tmp/trex_files/trex_cfg_vlan.yaml', + l = 100, + limit_ports = 4) + + trex_res = self.trex.sample_to_run_finish() + print("\nLATEST RESULT OBJECT:") + print(trex_res) + self.check_general_scenario_results(trex_res, check_latency = True) + + def tearDown(self): + pass + + # Add vlan to platform config file + # write the result to new config file in /tmp, to be used by the test + def create_vlan_conf_file(self): + + remote_cfg_file = self.trex.get_trex_config() + out = open("/tmp/trex_cfg_vlan.yaml", "w") + insert_vlan = False + vlan_val_1 = "100" + vlan_val_2 = "200" + vlan_val = vlan_val_1 + + for line in remote_cfg_file.split("\n"): + out.write (line + "\n") + # when we see "port_info" start inserting, until port_info section end + if "port_info" in line.lstrip(): + num_space_port_info = len(line) - len(line.lstrip()) + insert_vlan = True + continue + + if insert_vlan: + num_space = len(line) - len(line.lstrip()) + if num_space == num_space_port_info: + insert_vlan = False + continue + if len(line.lstrip()) > 0 and line.lstrip()[0] == '-': + # insert vlan for each port (every time a section start with '-' + num_space = len(line) - len(line.lstrip(' -')) + # need to insert in the same indentation as other lines in the section + out.write(num_space* " " + "vlan: " + vlan_val + "\n") + if vlan_val == vlan_val_1: + vlan_val = vlan_val_2 + else: + vlan_val = vlan_val_1 + out.close() + self.trex.push_files("/tmp/trex_cfg_vlan.yaml"); + +if __name__ == "__main__": + pass diff --git a/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py b/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py index 490e3b7a..43504c96 100755 --- a/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py +++ b/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py @@ -889,6 +889,31 @@ class CTRexClient(object): finally: self.prompt_verbose_data() + def get_trex_config(self): + """ + Get Trex config file (/etc/trex_cfg.yaml). + + :return: + String representation of TRex config file + + :raises: + + :exc:`trex_exceptions.TRexRequestDenied`, in case file could not be read. + + ProtocolError, in case of error in JSON-RPC protocol. + + """ + try: + res = binascii.a2b_base64(self.server.get_trex_config()) + if type(res) is bytes: + return res.decode() + return res + except AppError as err: + self._handle_AppError_exception(err.args[0]) + except ProtocolError: + raise + finally: + self.prompt_verbose_data() + + def push_files (self, filepaths): """ Pushes a file (or a list of files) to store locally on server. diff --git a/scripts/cap2/dns.yaml b/scripts/cap2/dns.yaml index dd577894..23b02fd6 100755 --- a/scripts/cap2/dns.yaml +++ b/scripts/cap2/dns.yaml @@ -11,8 +11,6 @@ tcp_aging : 1 udp_aging : 1 mac : [0x00,0x00,0x00,0x01,0x00,0x00] - #vlan : { enable : 1 , vlan0 : 100 , vlan1 : 200 } - #mac_override_by_ip : true cap_info : - name: cap2/dns.pcap cps : 1.0 diff --git a/scripts/cap2/dns_no_delay.yaml b/scripts/cap2/dns_no_delay.yaml index ab387d31..6139716c 100644 --- a/scripts/cap2/dns_no_delay.yaml +++ b/scripts/cap2/dns_no_delay.yaml @@ -11,8 +11,6 @@ tcp_aging : 0 udp_aging : 0 mac : [0x00,0x00,0x00,0x01,0x00,0x00] - #vlan : { enable : 1 , vlan0 : 100 , vlan1 : 200 } - #mac_override_by_ip : true cap_info : - name: cap2/dns.pcap cps : 1.0 diff --git a/scripts/cap2/ipv4_load_balance.yaml b/scripts/cap2/ipv4_load_balance.yaml new file mode 100755 index 00000000..63f7db7d --- /dev/null +++ b/scripts/cap2/ipv4_load_balance.yaml @@ -0,0 +1,21 @@ +- duration : 10 + generator : + distribution : "seq" + clients_start : "16.0.0.1" + clients_end : "16.0.1.255" + servers_start : "48.0.0.1" + servers_end : "48.0.0.255" + clients_per_gb : 201 + min_clients : 101 + dual_port_mask : "1.0.0.0" + tcp_aging : 1 + udp_aging : 1 + mac : [0x0,0x0,0x0,0x1,0x0,0x00] + vlan : { enable : 1 , vlan0 : 100 , vlan1 : 200 } + cap_info : + - name: cap2/udp_64B.pcap + cps : 10.0 + ipg : 10000 + rtt : 10000 + w : 4 + limit : 20 diff --git a/scripts/cap2/ipv4_vlan.yaml b/scripts/cap2/ipv4_vlan.yaml deleted file mode 100755 index 63f7db7d..00000000 --- a/scripts/cap2/ipv4_vlan.yaml +++ /dev/null @@ -1,21 +0,0 @@ -- duration : 10 - generator : - distribution : "seq" - clients_start : "16.0.0.1" - clients_end : "16.0.1.255" - servers_start : "48.0.0.1" - servers_end : "48.0.0.255" - clients_per_gb : 201 - min_clients : 101 - dual_port_mask : "1.0.0.0" - tcp_aging : 1 - udp_aging : 1 - mac : [0x0,0x0,0x0,0x1,0x0,0x00] - vlan : { enable : 1 , vlan0 : 100 , vlan1 : 200 } - cap_info : - - name: cap2/udp_64B.pcap - cps : 10.0 - ipg : 10000 - rtt : 10000 - w : 4 - limit : 20 diff --git a/scripts/cap2/ipv6_load_balance.yaml b/scripts/cap2/ipv6_load_balance.yaml new file mode 100755 index 00000000..bb91a4f8 --- /dev/null +++ b/scripts/cap2/ipv6_load_balance.yaml @@ -0,0 +1,23 @@ +- duration : 10 + generator : + distribution : "seq" + clients_start : "16.0.0.1" + clients_end : "16.0.1.255" + servers_start : "48.0.0.1" + servers_end : "48.0.0.255" + clients_per_gb : 201 + min_clients : 101 + dual_port_mask : "1.0.0.0" + tcp_aging : 1 + udp_aging : 1 + src_ipv6 : [0x2001,0x0232,0x1002,0x0051,0x0000,0x0000] + dst_ipv6 : [0x3001,0x0DB8,0x0003,0x0004,0x0000,0x0000] + mac : [0x0,0x0,0x0,0x1,0x0,0x00] + vlan : { enable : 1 , vlan0 : 100 , vlan1 : 200 } + cap_info : + - name: cap2/ipv6.pcap + cps : 10.0 + ipg : 10000 + rtt : 10000 + w : 4 + limit : 20 diff --git a/scripts/cap2/ipv6_vlan.yaml b/scripts/cap2/ipv6_vlan.yaml deleted file mode 100755 index bb91a4f8..00000000 --- a/scripts/cap2/ipv6_vlan.yaml +++ /dev/null @@ -1,23 +0,0 @@ -- duration : 10 - generator : - distribution : "seq" - clients_start : "16.0.0.1" - clients_end : "16.0.1.255" - servers_start : "48.0.0.1" - servers_end : "48.0.0.255" - clients_per_gb : 201 - min_clients : 101 - dual_port_mask : "1.0.0.0" - tcp_aging : 1 - udp_aging : 1 - src_ipv6 : [0x2001,0x0232,0x1002,0x0051,0x0000,0x0000] - dst_ipv6 : [0x3001,0x0DB8,0x0003,0x0004,0x0000,0x0000] - mac : [0x0,0x0,0x0,0x1,0x0,0x00] - vlan : { enable : 1 , vlan0 : 100 , vlan1 : 200 } - cap_info : - - name: cap2/ipv6.pcap - cps : 10.0 - ipg : 10000 - rtt : 10000 - w : 4 - limit : 20 diff --git a/scripts/cap2/jumbo.yaml b/scripts/cap2/jumbo.yaml index b45a6ca3..901e6189 100644 --- a/scripts/cap2/jumbo.yaml +++ b/scripts/cap2/jumbo.yaml @@ -11,8 +11,6 @@ tcp_aging : 1 udp_aging : 1 mac : [0x00,0x00,0x00,0x01,0x00,0x00] - #vlan : { enable : 1 , vlan0 : 100 , vlan1 : 200 } - #mac_override_by_ip : true cap_info : - name: cap2/jumbo.pcap cps : 1.0 diff --git a/scripts/cap2/wrong_ip.yaml b/scripts/cap2/wrong_ip.yaml index 7de3b82d..226b0c5c 100644 --- a/scripts/cap2/wrong_ip.yaml +++ b/scripts/cap2/wrong_ip.yaml @@ -11,8 +11,6 @@ tcp_aging : 1 udp_aging : 1 mac : [0x00,0x00,0x00,0x01,0x00,0x00] - #vlan : { enable : 1 , vlan0 : 100 , vlan1 : 200 } - #mac_override_by_ip : true cap_info : - name: cap2/wrong_ip.pcap cps : 1.0 diff --git a/scripts/exp/ipv4_load_balance-0-ex.erf b/scripts/exp/ipv4_load_balance-0-ex.erf new file mode 100755 index 00000000..435d8c32 Binary files /dev/null and b/scripts/exp/ipv4_load_balance-0-ex.erf differ diff --git a/scripts/exp/ipv4_vlan-0-ex.erf b/scripts/exp/ipv4_vlan-0-ex.erf deleted file mode 100755 index 435d8c32..00000000 Binary files a/scripts/exp/ipv4_vlan-0-ex.erf and /dev/null differ diff --git a/scripts/exp/ipv4_vlan-0.erf b/scripts/exp/ipv4_vlan-0.erf deleted file mode 100644 index 435d8c32..00000000 Binary files a/scripts/exp/ipv4_vlan-0.erf and /dev/null differ diff --git a/scripts/exp/ipv6_load_balance-0-ex.erf b/scripts/exp/ipv6_load_balance-0-ex.erf new file mode 100755 index 00000000..8ca5f09b Binary files /dev/null and b/scripts/exp/ipv6_load_balance-0-ex.erf differ diff --git a/scripts/exp/ipv6_vlan-0-ex.erf b/scripts/exp/ipv6_vlan-0-ex.erf deleted file mode 100755 index 8ca5f09b..00000000 Binary files a/scripts/exp/ipv6_vlan-0-ex.erf and /dev/null differ diff --git a/scripts/exp/ipv6_vlan-0.erf b/scripts/exp/ipv6_vlan-0.erf deleted file mode 100644 index 8ca5f09b..00000000 Binary files a/scripts/exp/ipv6_vlan-0.erf and /dev/null differ -- cgit 1.2.3-korg