diff --git a/napalm_junos/junos.py b/napalm_junos/junos.py index e0ceafa..1b3cb5e 100644 --- a/napalm_junos/junos.py +++ b/napalm_junos/junos.py @@ -1101,8 +1101,8 @@ def get_mac_address_table(self): return mac_address_table - def get_route_to(self, destination='', protocol=''): - """Return route details to a specific destination, learned from a certain protocol.""" + def get_route_to(self, destination='', protocol='', vrf=''): + """Return route details to a specific destination, learned from a certain protocol, visible in a particular vrf (table).""" routes = {} if not isinstance(destination, py23_compat.string_types): @@ -1114,6 +1114,9 @@ def get_route_to(self, destination='', protocol=''): if protocol == 'connected': protocol = 'direct' # this is how is called on JunOS + if vrf and not isinstance(vrf, py23_compat.string_types): + raise TypeError('Please specify a valid vrf!') + _COMMON_PROTOCOL_FIELDS_ = [ 'destination', 'prefix_length', @@ -1162,6 +1165,10 @@ def get_route_to(self, destination='', protocol=''): if protocol and isinstance(destination, py23_compat.string_types): rt_kargs['protocol'] = protocol + #table is (almost) a vrf + if vrf: + rt_kargs['table'] = vrf + try: routes_table.get(**rt_kargs) except RpcTimeoutError: