From a6e3bf69eb5b338047f4338a3cecc052db042188 Mon Sep 17 00:00:00 2001 From: Ido Barnea Date: Thu, 12 Jan 2017 14:09:28 +0200 Subject: client config regression tests with NBAR and VLAN Signed-off-by: Ido Barnea --- scripts/automation/regression/CPlatform.py | 172 +++++++++++++-------- .../automation/regression/cfg/client_cfg_vlan.yaml | 31 ++++ .../automation/regression/interactive_platform.py | 33 ++++ .../regression/setups/trex25/benchmark.yaml | 8 +- .../stateful_tests/trex_client_cfg_test.py | 52 +++++-- 5 files changed, 220 insertions(+), 76 deletions(-) create mode 100644 scripts/automation/regression/cfg/client_cfg_vlan.yaml (limited to 'scripts/automation/regression') diff --git a/scripts/automation/regression/CPlatform.py b/scripts/automation/regression/CPlatform.py index 606235a6..79712e71 100755 --- a/scripts/automation/regression/CPlatform.py +++ b/scripts/automation/regression/CPlatform.py @@ -19,33 +19,62 @@ class CPlatform(object): self.needed_image_path = None self.tftp_cfg = None self.config_history = { 'basic_if_config' : False, 'tftp_server_config' : False } + self.client_vlan = "100" + self.server_vlan = "200" - def configure_basic_interfaces(self, mtu = 9050): + def configure_basic_interfaces(self, mtu = 9050, vlan=False): cache = CCommandCache() for dual_if in self.if_mngr.get_dual_if_list(): client_if_command_set = [] server_if_command_set = [] + client_if_command_set_vlan = [] + server_if_command_set_vlan = [] + + client_if_name = dual_if.client_if.get_name() + server_if_name = dual_if.server_if.get_name() + + if vlan: + client_if_name_vlan = client_if_name + "." + self.client_vlan + server_if_name_vlan = server_if_name + "." + self.server_vlan + client_if_command_set_vlan.append('encapsulation dot1Q {vlan}'. format(vlan = self.client_vlan)); + server_if_command_set_vlan.append('encapsulation dot1Q {vlan}'. format(vlan = self.server_vlan)); client_if_command_set.append ('mac-address {mac}'.format( mac = dual_if.client_if.get_src_mac_addr()) ) client_if_command_set.append ('mtu %s' % mtu) - client_if_command_set.append ('ip address {ip} 255.255.255.0'.format( ip = dual_if.client_if.get_ipv4_addr() )) - client_if_command_set.append ('ipv6 address {ip}/64'.format( ip = dual_if.client_if.get_ipv6_addr() )) - cache.add('IF', client_if_command_set, dual_if.client_if.get_name()) + client_ip_command = 'ip address {ip} 255.255.255.0'.format( ip = dual_if.client_if.get_ipv4_addr() ) + client_ipv6_command = 'ipv6 address {ip}/64'.format( ip = dual_if.client_if.get_ipv6_addr() ) + if vlan: + client_if_command_set_vlan.append (client_ip_command) + client_if_command_set_vlan.append (client_ipv6_command) + else: + client_if_command_set.append (client_ip_command) + client_if_command_set.append (client_ipv6_command) + + cache.add('IF', client_if_command_set, client_if_name) + if vlan: + cache.add('IF', client_if_command_set_vlan, client_if_name_vlan) server_if_command_set.append ('mac-address {mac}'.format( mac = dual_if.server_if.get_src_mac_addr()) ) server_if_command_set.append ('mtu %s' % mtu) - server_if_command_set.append ('ip address {ip} 255.255.255.0'.format( ip = dual_if.server_if.get_ipv4_addr() )) - server_if_command_set.append ('ipv6 address {ip}/64'.format( ip = dual_if.server_if.get_ipv6_addr() )) - cache.add('IF', server_if_command_set, dual_if.server_if.get_name()) + server_ip_command = 'ip address {ip} 255.255.255.0'.format( ip = dual_if.server_if.get_ipv4_addr() ) + server_ipv6_command = 'ipv6 address {ip}/64'.format( ip = dual_if.server_if.get_ipv6_addr() ) + if vlan: + server_if_command_set_vlan.append (server_ip_command) + server_if_command_set_vlan.append (server_ipv6_command) + else: + server_if_command_set.append (server_ip_command) + server_if_command_set.append (server_ipv6_command) + + cache.add('IF', server_if_command_set, server_if_name) + if vlan: + cache.add('IF', server_if_command_set_vlan, server_if_name_vlan) self.cmd_link.run_single_command(cache) self.config_history['basic_if_config'] = True - - def configure_basic_filtered_interfaces(self, intf_list, mtu = 9050): cache = CCommandCache() @@ -54,8 +83,9 @@ class CPlatform(object): if_command_set.append ('mac-address {mac}'.format( mac = intf.get_src_mac_addr()) ) if_command_set.append ('mtu %s' % mtu) - if_command_set.append ('ip address {ip} 255.255.255.0'.format( ip = intf.get_ipv4_addr() )) - if_command_set.append ('ipv6 address {ip}/64'.format( ip = intf.get_ipv6_addr() )) + if vlan: + if_command_set.append ('ip address {ip} 255.255.255.0'.format( ip = intf.get_ipv4_addr() )) + if_command_set.append ('ipv6 address {ip}/64'.format( ip = intf.get_ipv6_addr() )) cache.add('IF', if_command_set, intf.get_name()) @@ -75,7 +105,7 @@ class CPlatform(object): continue raise Exception('Could not load clean config, response: %s' % res) - def config_pbr (self, mode = 'config'): + def config_pbr (self, mode = 'config', vlan = False): idx = 1 unconfig_str = '' if mode=='config' else 'no ' @@ -93,30 +123,30 @@ class CPlatform(object): if dual_if.is_duplicated(): # define the relevant VRF name pre_commit_set.add('{mode}ip vrf {dup}'.format( mode = unconfig_str, dup = dual_if.get_vrf_name()) ) - + # assign VRF to interfaces, config interfaces with relevant route-map client_if_command_set.append ('{mode}ip vrf forwarding {dup}'.format( mode = unconfig_str, dup = dual_if.get_vrf_name()) ) - client_if_command_set.append ('{mode}ip policy route-map {dup}_{p1}_to_{p2}'.format( + client_if_command_set.append ('{mode}ip policy route-map {dup}_{p1}_to_{p2}'.format( mode = unconfig_str, - dup = dual_if.get_vrf_name(), + dup = dual_if.get_vrf_name(), p1 = 'p'+str(idx), p2 = 'p'+str(idx+1) ) ) server_if_command_set.append ('{mode}ip vrf forwarding {dup}'.format( mode = unconfig_str, dup = dual_if.get_vrf_name()) ) - server_if_command_set.append ('{mode}ip policy route-map {dup}_{p2}_to_{p1}'.format( + server_if_command_set.append ('{mode}ip policy route-map {dup}_{p2}_to_{p1}'.format( mode = unconfig_str, - dup = dual_if.get_vrf_name(), + dup = dual_if.get_vrf_name(), p1 = 'p'+str(idx), p2 = 'p'+str(idx+1) ) ) # config route-map routing conf_t_command_set.append('{mode}route-map {dup}_{p1}_to_{p2} permit 10'.format( mode = unconfig_str, - dup = dual_if.get_vrf_name(), + dup = dual_if.get_vrf_name(), p1 = 'p'+str(idx), p2 = 'p'+str(idx+1) ) ) if mode == 'config': conf_t_command_set.append('set ip next-hop {next_hop}'.format( next_hop = client_net_next_hop) ) conf_t_command_set.append('{mode}route-map {dup}_{p2}_to_{p1} permit 10'.format( mode = unconfig_str, - dup = dual_if.get_vrf_name(), + dup = dual_if.get_vrf_name(), p1 = 'p'+str(idx), p2 = 'p'+str(idx+1) ) ) if mode == 'config': conf_t_command_set.append('set ip next-hop {next_hop}'.format( @@ -127,21 +157,21 @@ class CPlatform(object): if dual_if.client_if.get_dest_mac(): conf_t_command_set.append('{mode}arp vrf {dup} {next_hop} {dest_mac} arpa'.format( mode = unconfig_str, - dup = dual_if.get_vrf_name(), - next_hop = server_net_next_hop, + dup = dual_if.get_vrf_name(), + next_hop = server_net_next_hop, dest_mac = dual_if.client_if.get_dest_mac())) if dual_if.server_if.get_dest_mac(): conf_t_command_set.append('{mode}arp vrf {dup} {next_hop} {dest_mac} arpa'.format( - mode = unconfig_str, - dup = dual_if.get_vrf_name(), - next_hop = client_net_next_hop, + mode = unconfig_str, + dup = dual_if.get_vrf_name(), + next_hop = client_net_next_hop, dest_mac = dual_if.server_if.get_dest_mac())) else: # config interfaces with relevant route-map - client_if_command_set.append ('{mode}ip policy route-map {p1}_to_{p2}'.format( + client_if_command_set.append ('{mode}ip policy route-map {p1}_to_{p2}'.format( mode = unconfig_str, p1 = 'p'+str(idx), p2 = 'p'+str(idx+1) ) ) - server_if_command_set.append ('{mode}ip policy route-map {p2}_to_{p1}'.format( + server_if_command_set.append ('{mode}ip policy route-map {p2}_to_{p1}'.format( mode = unconfig_str, p1 = 'p'+str(idx), p2 = 'p'+str(idx+1) ) ) @@ -164,17 +194,22 @@ class CPlatform(object): if dual_if.client_if.get_dest_mac(): conf_t_command_set.append('{mode}arp {next_hop} {dest_mac} arpa'.format( mode = unconfig_str, - next_hop = server_net_next_hop, + next_hop = server_net_next_hop, dest_mac = dual_if.client_if.get_dest_mac())) if dual_if.server_if.get_dest_mac(): conf_t_command_set.append('{mode}arp {next_hop} {dest_mac} arpa'.format( mode = unconfig_str, - next_hop = client_net_next_hop, + next_hop = client_net_next_hop, dest_mac = dual_if.server_if.get_dest_mac())) # assign generated config list to cache - cache.add('IF', server_if_command_set, dual_if.server_if.get_name()) - cache.add('IF', client_if_command_set, dual_if.client_if.get_name()) + client_if_name = dual_if.client_if.get_name() + server_if_name = dual_if.server_if.get_name() + if vlan: + client_if_name += "." + self.client_vlan + server_if_name += "." + self.server_vlan + cache.add('IF', server_if_command_set, server_if_name) + cache.add('IF', client_if_command_set, client_if_name) cache.add('CONF', conf_t_command_set) idx += 2 @@ -186,12 +221,12 @@ class CPlatform(object): # deploy the configs (order is important!) self.cmd_link.run_command( [pre_commit_cache, cache] ) if self.config_history['basic_if_config']: - # in this case, duplicated interfaces will lose its ip address. + # in this case, duplicated interfaces will lose its ip address. # re-config IPv4 addresses self.configure_basic_filtered_interfaces(self.if_mngr.get_duplicated_if() ) - def config_no_pbr (self): - self.config_pbr(mode = 'unconfig') + def config_no_pbr (self, vlan = False): + self.config_pbr(mode = 'unconfig', vlan = vlan) def config_static_routing (self, stat_route_obj, mode = 'config'): @@ -241,13 +276,13 @@ class CPlatform(object): conf_t_command_set.append( "{mode}ip route vrf {dup} {next_net} {dest_mask} {next_hop}".format( mode = unconfig_str, - dup = dual_if.get_vrf_name(), + dup = dual_if.get_vrf_name(), next_net = client_net, dest_mask = stat_route_obj.client_mask, next_hop = client_net_next_hop)) conf_t_command_set.append( "{mode}ip route vrf {dup} {next_net} {dest_mask} {next_hop}".format( mode = unconfig_str, - dup = dual_if.get_vrf_name(), + dup = dual_if.get_vrf_name(), next_net = server_net, dest_mask = stat_route_obj.server_mask, next_hop = server_net_next_hop)) @@ -256,14 +291,14 @@ class CPlatform(object): if dual_if.client_if.get_dest_mac(): conf_t_command_set.append('{mode}arp vrf {dup} {next_hop} {dest_mac} arpa'.format( mode = unconfig_str, - dup = dual_if.get_vrf_name(), - next_hop = server_net_next_hop, + dup = dual_if.get_vrf_name(), + next_hop = server_net_next_hop, dest_mac = dual_if.client_if.get_dest_mac())) if dual_if.server_if.get_dest_mac(): conf_t_command_set.append('{mode}arp vrf {dup} {next_hop} {dest_mac} arpa'.format( - mode = unconfig_str, - dup = dual_if.get_vrf_name(), - next_hop = client_net_next_hop, + mode = unconfig_str, + dup = dual_if.get_vrf_name(), + next_hop = client_net_next_hop, dest_mac = dual_if.server_if.get_dest_mac())) # assign generated interfaces config list to cache @@ -286,12 +321,12 @@ class CPlatform(object): if dual_if.client_if.get_dest_mac(): conf_t_command_set.append('{mode}arp {next_hop} {dest_mac} arpa'.format( mode = unconfig_str, - next_hop = server_net_next_hop, + next_hop = server_net_next_hop, dest_mac = dual_if.client_if.get_dest_mac())) if dual_if.server_if.get_dest_mac(): conf_t_command_set.append('{mode}arp {next_hop} {dest_mac} arpa'.format( mode = unconfig_str, - next_hop = client_net_next_hop, + next_hop = client_net_next_hop, dest_mac = dual_if.server_if.get_dest_mac())) # bump up to the next client network address @@ -309,7 +344,7 @@ class CPlatform(object): # deploy the configs (order is important!) self.cmd_link.run_command( [pre_commit_cache, cache] ) if self.config_history['basic_if_config']: - # in this case, duplicated interfaces will lose its ip address. + # in this case, duplicated interfaces will lose its ip address. # re-config IPv4 addresses self.configure_basic_filtered_interfaces(self.if_mngr.get_duplicated_if() ) @@ -424,7 +459,7 @@ class CPlatform(object): def config_zbf (self, mode = 'config'): cache = CCommandCache() pre_commit_cache = CCommandCache() - conf_t_command_set = [] + conf_t_command_set = [] # toggle all duplicate interfaces down self.toggle_duplicated_intf(action = 'down') @@ -460,7 +495,7 @@ class CPlatform(object): def config_no_zbf (self): cache = CCommandCache() - conf_t_command_set = [] + conf_t_command_set = [] # define security zones and security service policy to be applied on the interfaces conf_t_command_set.append('no zone-pair security in2out source z_in destination z_out') @@ -485,7 +520,7 @@ class CPlatform(object): # self.__toggle_interfaces(dup_ifs) - def config_ipv6_pbr (self, mode = 'config'): + def config_ipv6_pbr (self, mode = 'config', vlan=False): idx = 1 unconfig_str = '' if mode=='config' else 'no ' cache = CCommandCache() @@ -496,7 +531,7 @@ class CPlatform(object): for dual_if in self.if_mngr.get_dual_if_list(): client_if_command_set = [] server_if_command_set = [] - + client_net_next_hop = misc_methods.get_single_net_client_addr(dual_if.server_if.get_ipv6_addr(), {'7':1}, ip_type = 'ipv6' ) server_net_next_hop = misc_methods.get_single_net_client_addr(dual_if.client_if.get_ipv6_addr(), {'7':1}, ip_type = 'ipv6' ) client_net_next_hop_v4 = misc_methods.get_single_net_client_addr(dual_if.server_if.get_ipv4_addr() ) @@ -510,22 +545,22 @@ class CPlatform(object): prefix = 'ipv6_' + dual_if.get_vrf_name() else: prefix = 'ipv6' - + # config interfaces with relevant route-map - client_if_command_set.append ('{mode}ipv6 policy route-map {pre}_{p1}_to_{p2}'.format( + client_if_command_set.append ('{mode}ipv6 policy route-map {pre}_{p1}_to_{p2}'.format( mode = unconfig_str, - pre = prefix, + pre = prefix, p1 = 'p'+str(idx), p2 = 'p'+str(idx+1) ) ) - server_if_command_set.append ('{mode}ipv6 policy route-map {pre}_{p2}_to_{p1}'.format( + server_if_command_set.append ('{mode}ipv6 policy route-map {pre}_{p2}_to_{p1}'.format( mode = unconfig_str, - pre = prefix, + pre = prefix, p1 = 'p'+str(idx), p2 = 'p'+str(idx+1) ) ) # config global arp to interfaces net address and vrf if dual_if.client_if.get_ipv6_dest_mac(): conf_t_command_set.append('{mode}ipv6 neighbor {next_hop} {intf} {dest_mac}'.format( mode = unconfig_str, - next_hop = server_net_next_hop, + next_hop = server_net_next_hop, intf = dual_if.client_if.get_name(), dest_mac = dual_if.client_if.get_ipv6_dest_mac())) # For latency packets (which are IPv4), we need to configure also static ARP @@ -561,17 +596,24 @@ class CPlatform(object): conf_t_command_set.append('exit') # assign generated config list to cache - cache.add('IF', server_if_command_set, dual_if.server_if.get_name()) - cache.add('IF', client_if_command_set, dual_if.client_if.get_name()) + client_if_name = dual_if.client_if.get_name() + server_if_name = dual_if.server_if.get_name() + if vlan: + client_if_name += "." + self.client_vlan + server_if_name += "." + self.server_vlan + + cache.add('IF', server_if_command_set, server_if_name) + cache.add('IF', client_if_command_set, client_if_name) + idx += 2 cache.add('CONF', conf_t_command_set) - + # deploy the configs (order is important!) self.cmd_link.run_command( [cache] ) - def config_no_ipv6_pbr (self): - self.config_ipv6_pbr(mode = 'unconfig') + def config_no_ipv6_pbr (self, vlan = False): + self.config_ipv6_pbr(mode = 'unconfig', vlan = vlan) # show methods def get_cpu_util (self): @@ -679,7 +721,7 @@ class CPlatform(object): parsed_info = CShowParser.parse_show_image_version(response) self.running_image = parsed_info return parsed_info - + def check_image_existence (self, img_name): """ check_image_existence(self, img_name) -> boolean @@ -716,7 +758,7 @@ class CPlatform(object): # tmp_tftp_config = external_tftp_config if external_tftp_config is not None else self.tftp_server_config self.tftp_cfg = device_cfg_obj.get_tftp_info() cache = CCommandCache() - + command = "ip tftp source-interface {intf}".format( intf = device_cfg_obj.get_mgmt_interface() ) cache.add('CONF', command ) self.cmd_link.run_single_command(cache) @@ -737,12 +779,12 @@ class CPlatform(object): """ if not self.check_image_existence(img_filename): # check if this image isn't already saved in platform #tmp_tftp_config = external_tftp_config if external_tftp_config is not None else self.tftp_cfg - + if self.config_history['tftp_server_config']: # make sure a TFTP configuration has been loaded cache = CCommandCache() if self.running_image is None: self.get_running_image_details() - + command = "copy tftp://{tftp_ip}/{img_path}/{image} bootflash:".format( tftp_ip = self.tftp_cfg['ip_address'], img_path = self.tftp_cfg['images_path'], @@ -795,7 +837,7 @@ class CPlatform(object): An image file to compare router running image Compares image name to router running image, returns match result. - + """ if self.running_image is None: self.get_running_image_details() @@ -839,7 +881,7 @@ class CPlatform(object): i = 0 sleep_time = 30 # seconds - try: + try: cache = CCommandCache() cache.add('EXEC', ['reload','n\r','\r'] ) @@ -861,7 +903,7 @@ class CPlatform(object): raise TimeoutError('Platform failed to reload after reboot for over {minutes} minutes!'.format(minutes = round(1 + i * sleep_time / 60))) else: i += 1 - + time.sleep(30) self.reload_connection(device_cfg_obj) progress_thread.join() diff --git a/scripts/automation/regression/cfg/client_cfg_vlan.yaml b/scripts/automation/regression/cfg/client_cfg_vlan.yaml new file mode 100644 index 00000000..db70e4e1 --- /dev/null +++ b/scripts/automation/regression/cfg/client_cfg_vlan.yaml @@ -0,0 +1,31 @@ +vlan: true +#vlan: false + +groups: + +- ip_start : 16.0.0.1 + ip_end : 16.0.1.255 + initiator : + next_hop: 1.1.1.1 + src_ip : 1.1.1.2 + vlan : 100 + responder : + next_hop: 1.1.2.1 + src_ip : 1.1.2.2 + vlan : 200 + + count : 1 + +- ip_start : 17.0.0.1 + ip_end : 17.0.1.255 + initiator : + next_hop: 1.1.3.1 + src_ip : 1.1.3.2 + vlan : 100 + responder : + next_hop: 1.1.4.1 + src_ip : 1.1.4.2 + vlan : 200 + + count : 1 + diff --git a/scripts/automation/regression/interactive_platform.py b/scripts/automation/regression/interactive_platform.py index 10e89910..7a15bb0c 100755 --- a/scripts/automation/regression/interactive_platform.py +++ b/scripts/automation/regression/interactive_platform.py @@ -90,16 +90,31 @@ class InteractivePlatform(cmd.Cmd): self.platform.configure_basic_interfaces() print(termstyle.green("Basic interfaces configuration applied successfully.")) + def do_basic_if_config_vlan(self, line): + """Apply basic interfaces configuartion with vlan to all platform interfaces""" + self.platform.configure_basic_interfaces(vlan = True) + print(termstyle.green("Basic VLAN interfaces configuration applied successfully.")) + def do_pbr(self, line): """Apply IPv4 PBR configuration on all interfaces""" self.platform.config_pbr() print(termstyle.green("IPv4 PBR configuration applied successfully.")) + def do_pbr_vlan(self, line): + """Apply IPv4 PBR configuration on all VLAN interfaces""" + self.platform.config_pbr(vlan = True) + print(termstyle.green("IPv4 VLAN PBR configuration applied successfully.")) + def do_no_pbr(self, line): """Removes IPv4 PBR configuration from all interfaces""" self.platform.config_no_pbr() print(termstyle.green("IPv4 PBR configuration removed successfully.")) + def do_no_pbr_vlan(self, line): + """Removes IPv4 PBR configuration from all VLAN interfaces""" + self.platform.config_no_pbr(vlan = True) + print(termstyle.green("IPv4 PBR VLAN configuration removed successfully.")) + def do_nbar(self, line): """Apply NBAR PD configuration on all interfaces""" self.platform.config_nbar_pd() @@ -180,11 +195,21 @@ class InteractivePlatform(cmd.Cmd): self.platform.config_ipv6_pbr() print(termstyle.green("IPv6 PBR configuration applied successfully.")) + def do_ipv6_pbr_vlan(self, line): + """Apply IPv6 PBR configuration on all vlan interfaces""" + self.platform.config_ipv6_pbr(vlan = True) + print(termstyle.green("IPv6 VLAN PBR configuration applied successfully.")) + def do_no_ipv6_pbr(self, line): """Removes IPv6 PBR configuration from all interfaces""" self.platform.config_no_ipv6_pbr() print(termstyle.green("IPv6 PBR configuration removed successfully.")) + def do_no_ipv6_pbr_vlan(self, line): + """Removes IPv6 PBR configuration from all VLAN interfaces""" + self.platform.config_no_ipv6_pbr(vlan = True) + print(termstyle.green("IPv6 VLAN PBR configuration removed successfully.")) + def do_zbf(self, line): """Apply Zone-Based policy Firewall configuration on all interfaces""" self.platform.config_zbf() @@ -318,6 +343,14 @@ class InteractivePlatform(cmd.Cmd): self.do_pbr('') self.do_ipv6_pbr('') + def do_all_vlan(self, arg): + """Configures bundle of commands to set PBR routing using on vlan interfaces""" + self.do_load_clean('') + self.do_set_tftp_server('') + self.do_basic_if_config_vlan('') + self.do_pbr_vlan('') + self.do_ipv6_pbr_vlan('') + if __name__ == "__main__": diff --git a/scripts/automation/regression/setups/trex25/benchmark.yaml b/scripts/automation/regression/setups/trex25/benchmark.yaml index b425a9c7..2c677b81 100644 --- a/scripts/automation/regression/setups/trex25/benchmark.yaml +++ b/scripts/automation/regression/setups/trex25/benchmark.yaml @@ -79,7 +79,7 @@ test_nat_learning: nat_opened : 40000 -test_nbar_simple: +test_nbar_simple: &nbar_simple multiplier : 6 cores : 1 bw_per_core : 16.645 @@ -100,6 +100,12 @@ test_nbar_simple: rtsp : 0.04 unknown : 28.52 +test_client_cfg_nbar: &client_cfg_nbar + << : *nbar_simple + +test_client_cfg_vlan: + cores : 1 + multiplier : 10 test_rx_check_http: &rx_http multiplier : 8800 diff --git a/scripts/automation/regression/stateful_tests/trex_client_cfg_test.py b/scripts/automation/regression/stateful_tests/trex_client_cfg_test.py index 852e745d..a1e462e5 100644 --- a/scripts/automation/regression/stateful_tests/trex_client_cfg_test.py +++ b/scripts/automation/regression/stateful_tests/trex_client_cfg_test.py @@ -1,5 +1,6 @@ #!/router/bin/python from .trex_general_test import CTRexGeneral_Test, CTRexScenario +from .trex_nbar_test import CTRexNbar_Test from CPlatform import CStaticRouteConfig from .tests_exceptions import * #import sys @@ -8,7 +9,7 @@ from nose.tools import nottest # Testing client cfg ARP resolve. Actually, just need to check that TRex run finished with no errors. # If resolve will fail, TRex will exit with exit code != 0 -class CTRexClientCfg_Test(CTRexGeneral_Test): +class CTRexClientCfg_Test(CTRexNbar_Test): """This class defines the IMIX testcase of the TRex traffic generator""" def __init__(self, *args, **kwargs): # super(CTRexClientCfg_Test, self).__init__() @@ -20,30 +21,61 @@ class CTRexClientCfg_Test(CTRexGeneral_Test): super(CTRexClientCfg_Test, self).setUp() # launch super test class setUp process pass - def test_client_cfg(self): + def test_client_cfg_nbar(self): # test initializtion if self.is_loopback: return else: self.router.configure_basic_interfaces() self.router.config_pbr(mode = "config") + self.router.config_nbar_pd() + + mult = self.get_benchmark_param('multiplier') + core = self.get_benchmark_param('cores') - ret = self.trex.start_trex( - c = 1, - m = 1, - d = 10, - f = 'cap2/dns.yaml', - v = 3, + ret = self.trex.start_trex ( + c = core, + m = mult, + nc = True, + p = True, + d = 100, + f = 'avl/sfr_delay_10_1g.yaml', client_cfg = 'automation/regression/cfg/client_cfg.yaml', l = 1000) trex_res = self.trex.sample_to_run_finish() - print("\nLATEST RESULT OBJECT:") print(trex_res) + self.check_general_scenario_results(trex_res, check_latency = False) # no latency with client config + self.match_classification() + + def test_client_cfg_vlan(self): + # test initializtion + if self.is_loopback: + return + else: + self.router.configure_basic_interfaces(vlan = True) + self.router.config_pbr(mode = "config", vlan = True) + self.router.config_nbar_pd() + + mult = self.get_benchmark_param('multiplier') + core = self.get_benchmark_param('cores') - self.check_general_scenario_results(trex_res) + ret = self.trex.start_trex ( + c = core, + m = mult, + nc = True, + p = True, + d = 60, + f = 'cap2/dns.yaml', + limit_ports = 4, + client_cfg = 'automation/regression/cfg/client_cfg_vlan.yaml') + trex_res = self.trex.sample_to_run_finish() + print("\nLATEST RESULT OBJECT:") + print(trex_res) + self.check_general_scenario_results(trex_res, check_latency = False) # no latency with client config + def tearDown(self): CTRexGeneral_Test.tearDown(self) pass -- cgit 1.2.3-korg