Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
## Installation of Mininet for running tests
-Only tested with Ubuntu 16.04 (which uses Mininet 2.2.0)
+Only tested with Ubuntu 16.04 and Ubuntu 18.04 (which uses Mininet 2.2.x)
Instructions are the same for all setups (ie ExaBGP is only used for BGP
tests)
lines = lines[1:]
return '\n'.join(lines)
+def proto_name_to_number(protocol):
+ return {
+ 'bgp': '186',
+ 'isis': '187',
+ 'ospf': '188',
+ 'rip': '189',
+ 'ripng': '190',
+ 'nhrp': '191',
+ 'eigrp': '192',
+ 'ldp': '193',
+ 'sharp': '194',
+ 'pbr': '195',
+ 'static': '196'
+ }.get(protocol, protocol) # default return same as input
+
+
def ip4_route(node):
"""
Gets a structured return of the command 'ip route'. It can be used in
if prev == 'via':
route['via'] = column
if prev == 'proto':
- route['proto'] = column
+ # translate protocol names back to numbers
+ route['proto'] = proto_name_to_number(column)
if prev == 'metric':
route['metric'] = column
if prev == 'scope':
if prev == 'via':
route['via'] = column
if prev == 'proto':
- route['proto'] = column
+ # translate protocol names back to numbers
+ route['proto'] = proto_name_to_number(column)
if prev == 'metric':
route['metric'] = column
if prev == 'pref':