Closed
Description
Getting a route via ndb.routes[{"dst": "10.0.4.0/24"}]
seems to be no longer working:
>>> ndb.routes[{"dst": "10.0.4.0/24"}]
{'dst': '10.0.4.0/24'}
{'dst': '10.0.4.0/24', 'target': 'localhost'}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/pyroute2/ndb/auth_manager.py", line 69, in guard
return f(obj, *argv, **kwarg)
File "/usr/lib/python3/dist-packages/pyroute2/ndb/main.py", line 551, in __getitem__
ret = self.template(key, table)
File "/usr/lib/python3/dist-packages/pyroute2/ndb/main.py", line 392, in template
auth_managers=self.auth_managers)
File "/usr/lib/python3/dist-packages/pyroute2/ndb/objects/route.py", line 525, in __init__
super(Route, self).__init__(*argv, **kwarg)
File "/usr/lib/python3/dist-packages/pyroute2/ndb/objects/__init__.py", line 327, in __init__
raise KeyError('object does not exists')
KeyError: 'object does not exists'
The same applies to ndb.routes.get({"dst": "10.0.4.0/24"})
.
When using
>>> ndb.routes["10.0.4.0/24"]
{'dst': '10.0.4.0', 'dst_len': 24, 'target': 'localhost'}
{'multipath': [], 'metrics': {}, 'dst': '10.0.4.0', 'dst_len': 24, 'target': 'localhost', 'table': 254, 'tflags': 0, 'family': 2, 'tos': 0, 'scope': 253, 'oif': 4, 'priority': 0, 'via': '', 'newdst': '', 'src_len': 0, 'proto': 2, 'type': 1, 'flags': 0, 'src': None, 'iif': None, 'gateway': None, 'prefsrc': '10.0.4.15', 'protoinfo': None, 'flow': None, 'mark': None, 'pref': None, 'encap_type': None, 'route_id': None, 'gc_mark': None}
the route is found.
Tested with pyroute2
version 0.5.19
and 0.6.2
.
Would be nice if this could be fixed and maybe patched for version 0.5
which we are using. 🙂
Thanks!
Activity