def test_ft_ipv6_neighbor_entry(): ################# Author Details ################ # Name: Raja Sekhar Uppara # Email: [email protected] ################################################# # Objective - 1.Verify that IPv6 neighbor entries are created successfully. # 2.Verify that Ipv6 Static neighbor entries are created successfully. # 3.'sudo sonic-clear ndp' flushes the existing dymanic entries ############### Test bed details ################ # TG1-----DUT-----TG2 ################################################# vars = st.get_testbed_vars() arp_obj.show_ndp(vars.D1) ndp_dut_count_initial = arp_obj.get_ndp_count(vars.D1) if ndp_dut_count_initial < 2 * data.count: st.report_fail("ndp_dynamic_entry_fail") arp_obj.clear_ndp_table(vars.D1) ndp_dut_count_post_clear = int(arp_obj.get_ndp_count(vars.D1)) if ndp_dut_count_post_clear > 2: out = arp_obj.show_ndp(vars.D1) entries = filter_and_select(out, [None], {'status': 'NOARP'}) if not len(out) == len(entries): st.report_fail("ndp_entries_clearing_failed") arp_obj.config_static_ndp(vars.D1, data.neigh_ip6_addr_gw[2], data.tg_mac3, vars.D1T1P1) ndp_dut_count_static = int(arp_obj.get_ndp_count(vars.D1)) if not ndp_dut_count_static: st.report_fail("static_ndp_create_fail") arp_obj.config_static_ndp(vars.D1, data.neigh_ip6_addr_gw[2], data.tg_mac3, vars.D1T1P1, 'del') st.report_pass("test_case_passed")
def test_l3_perf_tc_12_5(): pre_test_l3_fwding_v6() vars = st.get_testbed_vars() # Config 2 IPV4 interfaces on DUT. (tg1, _, tg_ph_1, _) = get_handles() dut1 = vars.D1 ipfeature.get_interface_ip_address(dut1, family="ipv4") ipfeature.get_interface_ip_address(dut1, family="ipv6") ipfeature.show_ip_route(dut1) interface_status_show(dut1) tr1 = create_l3_host_v6(tg1, tg_ph_1, 16000) # Verified ARP and counters at the DUT. default_nd = arpapi.get_ndp_count(dut1) st.log("Total NDP entries are: {}".format(default_nd)) measure_nd_learn_time(dut1, default_nd, 16000) tg1.tg_traffic_control(action='stop', handle=tr1['stream_id'], max_wait_timer=10) tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) post_test_l3_fwding_v6() st.report_pass("test_case_passed")
def verify_ndp_count(dut,expected_count=data.max_host_1,**kwargs): #n = show_nd_count(dut) cli_type = kwargs.pop('cli_type', "") n = arp_api.get_ndp_count(dut,cli_type,**kwargs) if int(n) >= int(expected_count): st.log('PASS - Expected number of ND entries found in the arp table') return True else: st.log('FAIL - Expected number of ND entries not found in the arp table.') return False
def measure_nd_learn_time(dut1, default_nd, max_nd): st.log("Number of NDP's in the beginning %d" % (default_nd)) curr_nd = default_nd nd_in_this_poll = default_nd sleep_time = 10 record_start_time = 0 prev_poll_count = 0 #initialize start time for error cases start_time = datetime.datetime.now() while (curr_nd < max_nd): now = datetime.datetime.now() prev_poll_count = nd_in_this_poll n = arp_api.get_ndp_count(vars.D1) nd_in_this_poll = n - curr_nd #no more entries learnt, break! if (prev_poll_count == nd_in_this_poll): break nd_in_this_poll = n - curr_nd if nd_in_this_poll > 0 and record_start_time == 0: start_time = now st.log("Time when the first nd was installed %s " % (str(start_time))) sleep_time = 10 record_start_time = 1 #st.log start_time curr_nd = curr_nd + nd_in_this_poll after = datetime.datetime.now() st.log(" [%s]: increment %d curr_nd %d " % (str(after), nd_in_this_poll, curr_nd)) if curr_nd == max_nd: break st.wait(sleep_time) end_time = datetime.datetime.now() st.log("Time when all the NDP's were installed %s" % (str(end_time))) #st.log end_time diff = (end_time - start_time).total_seconds() st.log("total time is %d" % (int(diff))) return int(diff)
def measure_nd_learn_time(dut1, default_nd, max_nd): st.log("Number of NDP's in the beginning %d" % (default_nd)) curr_nd = default_nd nd_in_this_poll = default_nd sleep_time = 10 record_start_time = 0 prev_poll_count = 0 #initialize start time for error cases #start_time = datetime.datetime.now() while (curr_nd < max_nd): now = datetime.datetime.now() output = arpapi.get_ndp_count(dut1) st.log("Total NDP entries are: {}".format(output)) prev_poll_count = nd_in_this_poll nd_in_this_poll = output - curr_nd #no more entries learnt, break! if (prev_poll_count == nd_in_this_poll): break nd_in_this_poll = output - curr_nd if nd_in_this_poll > 0 and record_start_time == 0: start_time = now st.log("Time when the first arp was installed %s " % (str(start_time))) sleep_time = 10 record_start_time = 1 #st.log start_time curr_nd = curr_nd + nd_in_this_poll after = datetime.datetime.now() st.log(" [%s]: increment %d curr_nd %d " % (str(after), nd_in_this_poll, curr_nd)) if curr_nd == max_nd: break st.wait(sleep_time) end_time = datetime.datetime.now() st.log("Time when all the NDP's were installed %s" % (str(end_time)))