@@ -2095,6 +2095,94 @@ def test_show_muxcable_packetloss_port_json(self):
20952095 assert result .exit_code == 0
20962096 assert result .output == show_muxcable_packetloss_expected_output_json
20972097
2098+ @mock .patch ('utilities_common.platform_sfputil_helper.get_logical_list' , mock .MagicMock (return_value = ["Ethernet0" , "Ethernet12" ]))
2099+ @mock .patch ('utilities_common.platform_sfputil_helper.get_asic_id_for_logical_port' , mock .MagicMock (return_value = 0 ))
2100+ @mock .patch ('show.muxcable.platform_sfputil' , mock .MagicMock (return_value = {0 : ["Ethernet12" , "Ethernet0" ]}))
2101+ @mock .patch ('utilities_common.platform_sfputil_helper.logical_port_name_to_physical_port_list' , mock .MagicMock (return_value = [0 ]))
2102+ def test_show_muxcable_tunnel_route (self ):
2103+ runner = CliRunner ()
2104+ db = Db ()
2105+
2106+ result = runner .invoke (show .cli .commands ["muxcable" ].commands ["tunnel-route" ], obj = db )
2107+
2108+ assert result .exit_code == 0
2109+ assert result .output == show_muxcable_tunnel_route_expected_output
2110+
2111+ @mock .patch ('utilities_common.platform_sfputil_helper.get_logical_list' , mock .MagicMock (return_value = ["Ethernet0" , "Ethernet12" ]))
2112+ @mock .patch ('utilities_common.platform_sfputil_helper.get_asic_id_for_logical_port' , mock .MagicMock (return_value = 0 ))
2113+ @mock .patch ('show.muxcable.platform_sfputil' , mock .MagicMock (return_value = {0 : ["Ethernet12" , "Ethernet0" ]}))
2114+ @mock .patch ('utilities_common.platform_sfputil_helper.logical_port_name_to_physical_port_list' , mock .MagicMock (return_value = [0 ]))
2115+ def test_show_muxcable_tunnel_route_json (self ):
2116+ runner = CliRunner ()
2117+ db = Db ()
2118+
2119+ result = runner .invoke (show .cli .commands ["muxcable" ].commands ["tunnel-route" ],
2120+ ["--json" ], obj = db )
2121+
2122+ assert result .exit_code == 0
2123+ assert result .output == show_muxcable_tunnel_route_expected_output_json
2124+
2125+ @mock .patch ('utilities_common.platform_sfputil_helper.get_logical_list' , mock .MagicMock (return_value = ["Ethernet0" , "Ethernet12" ]))
2126+ @mock .patch ('utilities_common.platform_sfputil_helper.get_asic_id_for_logical_port' , mock .MagicMock (return_value = 0 ))
2127+ @mock .patch ('show.muxcable.platform_sfputil' , mock .MagicMock (return_value = {0 : ["Ethernet12" , "Ethernet0" ]}))
2128+ @mock .patch ('utilities_common.platform_sfputil_helper.logical_port_name_to_physical_port_list' , mock .MagicMock (return_value = [0 ]))
2129+ def test_show_muxcable_tunnel_route_port (self ):
2130+ runner = CliRunner ()
2131+ db = Db ()
2132+
2133+ result = runner .invoke (show .cli .commands ["muxcable" ].commands ["tunnel-route" ],
2134+ ["Ethernet0" ], obj = db )
2135+
2136+ assert result .exit_code == 0
2137+ assert result .output == show_muxcable_tunnel_route_expected_port_output
2138+
2139+ @mock .patch ('utilities_common.platform_sfputil_helper.get_logical_list' , mock .MagicMock (return_value = ["Ethernet0" , "Ethernet12" ]))
2140+ @mock .patch ('utilities_common.platform_sfputil_helper.get_asic_id_for_logical_port' , mock .MagicMock (return_value = 0 ))
2141+ @mock .patch ('show.muxcable.platform_sfputil' , mock .MagicMock (return_value = {0 : ["Ethernet12" , "Ethernet0" ]}))
2142+ @mock .patch ('utilities_common.platform_sfputil_helper.logical_port_name_to_physical_port_list' , mock .MagicMock (return_value = [0 ]))
2143+ def test_show_muxcable_tunnel_route_json_port (self ):
2144+ runner = CliRunner ()
2145+ db = Db ()
2146+
2147+ result = runner .invoke (show .cli .commands ["muxcable" ].commands ["tunnel-route" ],
2148+ ["Ethernet0" , "--json" ], obj = db )
2149+ assert result .exit_code == 0
2150+ assert result .output == show_muxcable_tunnel_route_expected_output_port_json
2151+
2152+ @mock .patch ('config.muxcable.swsscommon.DBConnector' , mock .MagicMock (return_value = 0 ))
2153+ @mock .patch ('config.muxcable.swsscommon.Table' , mock .MagicMock (return_value = 0 ))
2154+ @mock .patch ('config.muxcable.swsscommon.Select' , mock .MagicMock (return_value = 0 ))
2155+ def test_config_muxcable_telemetry_enable_without_patch (self ):
2156+ runner = CliRunner ()
2157+ db = Db ()
2158+
2159+ result = runner .invoke (config .config .commands ["muxcable" ].commands ["telemetry" ], [
2160+ "enable" ], obj = db )
2161+ assert result .exit_code == 1
2162+
2163+ @mock .patch ('config.muxcable.swsscommon.DBConnector' , mock .MagicMock (return_value = 0 ))
2164+ @mock .patch ('config.muxcable.swsscommon.Table' , mock .MagicMock (return_value = 0 ))
2165+ @mock .patch ('config.muxcable.swsscommon.Select' , mock .MagicMock (return_value = 0 ))
2166+ def test_config_muxcable_telemetry_disable_without_patch (self ):
2167+ runner = CliRunner ()
2168+ db = Db ()
2169+
2170+ result = runner .invoke (config .config .commands ["muxcable" ].commands ["telemetry" ], [
2171+ "disable" ], obj = db )
2172+ assert result .exit_code == 1
2173+
2174+ @mock .patch ('config.muxcable.swsscommon.DBConnector' , mock .MagicMock (return_value = 0 ))
2175+ @mock .patch ('config.muxcable.swsscommon.Table' , mock .MagicMock (return_value = 0 ))
2176+ @mock .patch ('config.muxcable.swsscommon.Select' , mock .MagicMock (return_value = 0 ))
2177+ @mock .patch ('config.muxcable.update_configdb_ycable_telemetry_data' , mock .MagicMock (return_value = 0 ))
2178+ def test_config_muxcable_telemetry_enable (self ):
2179+ runner = CliRunner ()
2180+ db = Db ()
2181+
2182+ result = runner .invoke (config .config .commands ["muxcable" ].commands ["telemetry" ], [
2183+ "enable" ], obj = db )
2184+ assert result .exit_code == 0
2185+
20982186 @classmethod
20992187 def teardown_class (cls ):
21002188 os .environ ['UTILITIES_UNIT_TESTING' ] = "0"
0 commit comments