def crm_fdb_config(): st.log("Configuring polling interval to non-default value") crm_obj.set_crm_polling_interval(vars.D1, data.polling_interval) st.wait(data.polling_interval) (data.used_counter_fdb, data.free_counter_fdb) = crm_obj.crm_get_resources_count( vars.D1, data.family) data.total_resources_fdb = data.used_counter_fdb + data.free_counter_fdb tx_pkt_2_percent_fdb = data.used_counter_fdb + ( 2 * data.total_resources_fdb) / 100 data.mode_high_used_fdb = data.used_counter_fdb + tx_pkt_2_percent_fdb - 5 data.mode_low_used_fdb = data.used_counter_fdb + 5 data.mode_high_free_fdb = data.free_counter_fdb - 1 data.mode_low_free_fdb = data.free_counter_fdb - tx_pkt_2_percent_fdb + 2 data.mode_high_percentage_fdb = 2 data.mode_low_percentage_fdb = 1 data.mac_addrs_count = int(tx_pkt_2_percent_fdb) + int(10) st.log("Setting fdb type used:") crm_obj.set_crm_polling_interval(vars.D1, data.polling_interval) crm_obj.set_crm_thresholds_type(vars.D1, family=data.family, type=data.threshold_used_type) crm_obj.set_crm_thresholds_value(vars.D1, family=data.family, mode=data.mode_high, value=data.mode_high_used_fdb) crm_obj.set_crm_thresholds_value(vars.D1, family=data.family, mode=data.mode_low, value=data.mode_low_used_fdb)
def crm_config(): st.log("CRM config for ACL table") crm_obj.set_crm_polling_interval(vars.D1, data.polling_interval) crm_obj.set_crm_thresholds_type(vars.D1, family=data.acl_table_family, type=data.threshold_free_type) crm_obj.set_crm_thresholds_value(vars.D1, family=data.acl_table_family, mode=data.mode_high, value=data.mode_high_free) crm_obj.set_crm_thresholds_value(vars.D1, family=data.acl_table_family, mode=data.mode_low, value=data.mode_low_free) st.log("CRM config for IPv4 route family") crm_obj.set_crm_thresholds_type(vars.D1, family=data.ipv4_route_family, type=data.threshold_percentage_type) crm_obj.set_crm_thresholds_value(vars.D1, family=data.ipv4_route_family, mode=data.mode_high, value=data.mode_high_percentage) crm_obj.set_crm_thresholds_value(vars.D1, family=data.ipv4_route_family, mode=data.mode_low, value=data.mode_low_percentage) st.log("CRM config for IPv6 route family") crm_obj.set_crm_thresholds_type(vars.D1, family=data.ipv6_route_family, type=data.threshold_percentage_type) crm_obj.set_crm_thresholds_value(vars.D1, family=data.ipv6_route_family, mode=data.mode_high, value=data.mode_high_percentage) crm_obj.set_crm_thresholds_value(vars.D1, family=data.ipv6_route_family, mode=data.mode_low, value=data.mode_low_percentage) st.log("CRM config for fdb") crm_obj.set_crm_thresholds_type(vars.D1, family=data.fdb_family, type=data.threshold_used_type) crm_obj.set_crm_thresholds_value(vars.D1, family=data.fdb_family, mode=data.mode_high, value=data.mode_high_used) crm_obj.set_crm_thresholds_value(vars.D1, family=data.fdb_family, mode=data.mode_low, value=data.mode_low_used) st.log("CRM config for IPv4 neighbor family") crm_obj.set_crm_thresholds_type(vars.D1, family=data.ipv4_neighbor_family, type=data.threshold_percentage_type) crm_obj.set_crm_thresholds_value(vars.D1, family=data.ipv4_neighbor_family, mode=data.mode_high, value=data.mode_high_percentage) crm_obj.set_crm_thresholds_value(vars.D1, family=data.ipv4_neighbor_family, mode=data.mode_low, value=data.mode_low_percentage) st.log("CRM config for IPv6 neighbor family") crm_obj.set_crm_thresholds_type(vars.D1, family=data.ipv6_neighbor_family, type=data.threshold_percentage_type) crm_obj.set_crm_thresholds_value(vars.D1, family=data.ipv6_neighbor_family, mode=data.mode_high, value=data.mode_high_percentage) crm_obj.set_crm_thresholds_value(vars.D1, family=data.ipv6_neighbor_family, mode=data.mode_low, value=data.mode_low_percentage) st.log("CRM config for ACL group entry family") crm_obj.set_crm_thresholds_type(vars.D1, family=data.acl_group_entry_family, type=data.threshold_percentage_type) crm_obj.set_crm_thresholds_value(vars.D1, family=data.acl_group_entry_family, mode=data.mode_high, value=data.mode_high_percentage) crm_obj.set_crm_thresholds_value(vars.D1, family=data.acl_group_entry_family, mode=data.mode_low, value=data.mode_low_percentage) st.log("CRM config for IPv6 nexthop family") crm_obj.set_crm_thresholds_type(vars.D1, family=data.ipv6_nexthop_family, type=data.threshold_percentage_type) crm_obj.set_crm_thresholds_value(vars.D1, family=data.ipv6_nexthop_family, mode=data.mode_high, value=data.mode_high_percentage) crm_obj.set_crm_thresholds_value(vars.D1, family=data.ipv6_nexthop_family, mode=data.mode_low, value=data.mode_low_percentage) st.log("CRM config for IPv4 nexthop family") crm_obj.set_crm_thresholds_type(vars.D1, family=data.ipv4_nexthop_family, type=data.threshold_percentage_type) crm_obj.set_crm_thresholds_value(vars.D1, family=data.ipv4_nexthop_family, mode=data.mode_high, value=data.mode_high_percentage) crm_obj.set_crm_thresholds_value(vars.D1, family=data.ipv4_nexthop_family, mode=data.mode_low, value=data.mode_low_percentage) st.log("CRM config for ACL group counter family") crm_obj.set_crm_thresholds_type(vars.D1, family=data.acl_group_counter_family, type=data.threshold_percentage_type) crm_obj.set_crm_thresholds_value(vars.D1, family=data.acl_group_counter_family, mode=data.mode_high, value=data.mode_high_percentage) crm_obj.set_crm_thresholds_value(vars.D1, family=data.acl_group_counter_family, mode=data.mode_low, value=data.mode_low_percentage)
def crm_ft_test_all(): data = SpyTestDict() data.my_dut_list = st.get_dut_names() if len(data.my_dut_list) < 1: st.error("DUT Unavailable") return False data.D1 = data.my_dut_list[0] data.fdb_count = 0 data.crm_polling_interval = 1 crm_obj.set_crm_clear_config(data.D1) crm_obj.set_crm_polling_interval(data.D1, data.crm_polling_interval) data.af_ipv4 = "ipv4" data.af_ipv6 = "ipv6" data.local_asn = 65001 data.router_id_1 = "110.110.110.1" data.router_id_2 = "120.120.120.1" data.remote_asn = 65007 data.loopback_1 = "66.66.66.66" data.loopback_2 = "77.77.77.77" data.tg_bgp6_route_prfix = "1001::1" data.tg_bgp6_routes = '1100' data.shell_sonic = 'vtysh' data.used_counter = dict() data.free_counter = dict() data.resource_count_max = dict() data.thresh_percent_low = dict() data.thresh_percent_high = dict() data.thresh_used_low = dict() data.thresh_used_high = dict() data.thresh_free_low = dict() data.thresh_free_high = dict() data.cur_thresh_type = dict() data.cli_type = st.get_ui_type(data.D1) family_list = crm_obj.crm_get_family_list(data.D1) if base_obj.get_hwsku( vars.D1).lower() in vars.constants[vars.D1]["TH3_PLATFORMS"]: for family in family_list: if family in ['dnat', 'snat']: family_list.remove(family) st.log("Verify CRM polling interval:") st.wait(data.crm_polling_interval) if not crm_obj.verify_crm_summary( data.D1, pollinginterval=data.crm_polling_interval): st.error('polling interval did not match with the configured value') return False st.log("Calculate Max resources:") for family in family_list: if family != 'acl_group_counter' and family != 'acl_group_entry' and family != 'all': (data.used_counter[family], data.free_counter[family]) = crm_obj.crm_get_resources_count( data.D1, family) data.resource_count_max[ family] = data.used_counter[family] + data.free_counter[family] for family in family_list: if family != 'acl_group_counter' and family != 'acl_group_entry' and family != 'all': st.log('{} {}/{}/{}'.format(family, data.used_counter[family], data.free_counter[family], data.resource_count_max[family])) data.routing_subnet = 24 data.dut_p1 = vars.T1D1P1 data.dut_p1_interface = vars.D1T1P1 data.dut_p1_ipaddr = '7.7.7.1' data.dut_p1_ipaddr_subnet = 24 data.dut_p1_ipaddr_peer = '7.7.7.2' data.adv_routes_cnt = 1000 data.adv_routes_prefix = "100.0.0.0" data.neighbor_cnt = 100 data.dut_p2 = vars.T1D1P2 data.dut_p2_interface = vars.D1T1P2 data.dut_p2_ipaddr = '2001::1' data.dut_p2_ipaddr_subnet = 64 data.dut_p2_ipaddr_peer = '2001::2' data.adv_routes_cnt_v6 = 1000 data.adv_routes_prefix_v6 = '2121::0' data.neighbor_cnt_v6 = 100 data.vlanid = 777 st.log('crminfo: VLAN ID {}'.format(data.vlanid)) crm_fdb_config(data) crm_acl_config(data) crm_bgp_config_v4(data.local_asn, data.remote_asn, data) crm_ecmp_config(data) if st.is_feature_supported("config-ipv6-command", data.D1): crm_bgp_config_v6(data.local_asn, data.remote_asn, data) verify_thresholds(data) # debug trace crm_obj.get_crm_resources(data.D1, "all") global crm_test_status crm_test_status = True