@@ -372,6 +372,37 @@ def test_del_entire_ECMP_static_route(self):
372372 print (result .exit_code , result .output )
373373 assert not '14.2.3.4/32' in db .cfgdb .get_table ('STATIC_ROUTE' )
374374
375+ def test_static_route_nexthop_subinterface (self ):
376+ db = Db ()
377+ runner = CliRunner ()
378+ obj = {'config_db' :db .cfgdb }
379+
380+ # config route add prefix 2.2.3.5/32 nexthop dev Ethernet0.10
381+ result = runner .invoke (config .config .commands ["route" ].commands ["add" ], \
382+ ["prefix" , "2.2.3.5/32" , "nexthop" , "dev" , "Ethernet0.10" ], obj = obj )
383+ print (result .exit_code , result .output )
384+ assert ('2.2.3.5/32' ) in db .cfgdb .get_table ('STATIC_ROUTE' )
385+ assert db .cfgdb .get_entry ('STATIC_ROUTE' , '2.2.3.5/32' ) == {'nexthop' : '' , 'blackhole' : 'false' , 'distance' : '0' , 'ifname' : 'Ethernet0.10' , 'nexthop-vrf' : '' }
386+
387+ # config route del prefix 2.2.3.5/32 nexthop dev Ethernet0.10
388+ result = runner .invoke (config .config .commands ["route" ].commands ["del" ], \
389+ ["prefix" , "2.2.3.5/32" , "nexthop" , "dev" , "Ethernet0.10" ], obj = obj )
390+ print (result .exit_code , result .output )
391+ assert not ('2.2.3.5/32' ) in db .cfgdb .get_table ('STATIC_ROUTE' )
392+
393+ # config route add prefix 2.2.3.5/32 nexthop dev Eth32.10
394+ result = runner .invoke (config .config .commands ["route" ].commands ["add" ], \
395+ ["prefix" , "2.2.3.5/32" , "nexthop" , "dev" , "Eth32.10" ], obj = obj )
396+ print (result .exit_code , result .output )
397+ assert ('2.2.3.5/32' ) in db .cfgdb .get_table ('STATIC_ROUTE' )
398+ assert db .cfgdb .get_entry ('STATIC_ROUTE' , '2.2.3.5/32' ) == {'nexthop' : '' , 'blackhole' : 'false' , 'distance' : '0' , 'ifname' : 'Eth32.10' , 'nexthop-vrf' : '' }
399+
400+ # config route del prefix 2.2.3.5/32 nexthop dev Eth32.10
401+ result = runner .invoke (config .config .commands ["route" ].commands ["del" ], \
402+ ["prefix" , "2.2.3.5/32" , "nexthop" , "dev" , "Eth32.10" ], obj = obj )
403+ print (result .exit_code , result .output )
404+ assert not ('2.2.3.5/32' ) in db .cfgdb .get_table ('STATIC_ROUTE' )
405+
375406 @classmethod
376407 def teardown_class (cls ):
377408 os .environ ['UTILITIES_UNIT_TESTING' ] = "0"
0 commit comments