diff --git a/src/sonic-device-data/tests/config_checker b/src/sonic-device-data/tests/config_checker index 51c32c19c3e4..6e59d1f44ce4 100755 --- a/src/sonic-device-data/tests/config_checker +++ b/src/sonic-device-data/tests/config_checker @@ -10,29 +10,9 @@ def usage(): sys.exit(1) def check_property(p): + if p in permitted_properties: return True - # Try to remove trailing . - if re.sub(r".\d+$", "", p) in permitted_properties: - return True - # Try to remove trailing _. - if re.sub(r"_\d+.\d+$", "", p) in permitted_properties: - return True - # Try to remove trailing _hg. - if re.sub(r"_hg.0$", "", p) in permitted_properties: - return True - # Try to remove trailing _[cx]e - if re.sub(r"_[cx]e\d*$", "", p) in permitted_properties: - return True - # Try to remove trailing _lane_ - if re.sub(r"_lane\d_\d+$", "", p) in permitted_properties: - return True - # Try to remove trailing _lane_. - if re.sub(r"_lane\d_\d+.\d+$", "", p) in permitted_properties: - return True - # Try to remove trailing _lane_[cx]e - if re.sub(r"_lane\d_[cx]e\d+$", "", p) in permitted_properties: - return True return False def check_file(file_name): @@ -45,12 +25,27 @@ def check_file(file_name): lineno = lineno + 1 # Check both commented and uncommented lines line = line.strip().lstrip('#').strip().lower() + # Check if = in the line if line.find("=") == -1: continue p = line.split("=", 1)[0] - # Remove trailing "{.}" - p = re.sub('{[0-9]+\.[0-9]+}', '', p) - # Check if = in the line + + # Remove trailing unit ".$" + p = re.sub(r"\.[0-9]+$", '', p) + # Remove trailing port name + p = re.sub(r"_[cxg]e(\d+)?$", '', p) + # Remove trailing port name example + p = re.sub(r"_$", '', p) + # Remove trailing port number + if p != "phy_84752" and p != "phy_84328": + p = re.sub(r"_(port)?\d+$", '', p) + # Remove trailing higig port + p = re.sub(r"_hg$", '', p) + # Remove trailing lane number + p = re.sub(r"_lane\d+$", '', p) + # Remove trailing "{.}$" + p = re.sub(r"{[0-9]+\.[0-9]+}$", '', p) + if not check_property(p): file_ok = False print("[line %d] Error: %s is not permitted" % (lineno, p)) diff --git a/src/sonic-device-data/tests/permitted_list b/src/sonic-device-data/tests/permitted_list index 150a16292c91..ea78b8165f3a 100644 --- a/src/sonic-device-data/tests/permitted_list +++ b/src/sonic-device-data/tests/permitted_list @@ -7,6 +7,9 @@ bcm_stat_interval bcm_stat_jumbo bcm_tunnel_term_compatible_mode bcm_xlate_port_enable +bcm56340_4x10 +bcm56340_2x10 +bcm56340_config cdma_timeout_usec core_clock_frequency ctr_evict_enable @@ -59,7 +62,7 @@ oversubscribe_mode parity_correction parity_enable pbmp_oversubscribe -pbmp_xport_xe +pbmp_xport pci2eb_overrid pfc_deadlock_seq_control phy_84328 @@ -69,31 +72,35 @@ phy_an_allow_pll_change_hg phy_an_c37 phy_an_c73 phy_an_fec +phy_automedium phy_aux_voltage_enable phy_chain_rx_lane_map_physical phy_chain_rx_polarity_flip_physical phy_chain_tx_lane_map_physical phy_chain_tx_polarity_flip_physical phy_ext_rom_boot +phy_fiber_pref phy_gearbox_enable +phy_null phy_line_tx_mode phy_pcs_rx_polarity_flip phy_pcs_tx_polarity_flip phy_port_primary_and_offset phy_rx_polarity_flip phy_system_tx_mode +phy_sgmii_autoneg phy_tx_polarity_flip phy_xaui_rx_polarity_flip phy_xaui_tx_polarity_flip physical_ports port_init_autoneg port_init_cl72 -port_init_cl72_hg -port_init_speed_xe +port_init_speed port_phy_addr port_phy_clause port_phy_id0 port_phy_id1 +portgroup portmap prbs_polynomial ptp_bs_fref @@ -113,7 +120,7 @@ serdes_firmware_mode serdes_if_type serdes_pre_driver_current serdes_preemphasis -serdes_rx_los_xe +serdes_rx_los serdes_sgmii_m skip_L2_USER_ENTRY sram_scan_enable @@ -129,6 +136,6 @@ tslam_intr_enable tslam_timeout_usec uplink_ports xgxs_lcpll_xtal_refclk -xgxs_pdetect_1 +xgxs_pdetect xgxs_rx_lane_map xgxs_tx_lane_map