Skip to content

Commit

Permalink
Merge 2ae5f40 into 670a97d
Browse files Browse the repository at this point in the history
  • Loading branch information
ktbyers committed Apr 11, 2018
2 parents 670a97d + 2ae5f40 commit 7a8f79b
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 23 deletions.
4 changes: 2 additions & 2 deletions napalm/ios/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -2083,9 +2083,9 @@ def get_users(self):
lowest access and 15 represents full access to the device.
"""
username_regex = r"^username\s+(?P<username>\S+)\s+(?:privilege\s+(?P<priv_level>\S+)" \
"\s+)?(?:secret \d+\s+(?P<pwd_hash>\S+))?$"
r"\s+)?(?:secret \d+\s+(?P<pwd_hash>\S+))?$"
pub_keychain_regex = r"^\s+username\s+(?P<username>\S+)(?P<keys>(?:\n\s+key-hash\s+" \
"(?P<hash_type>\S+)\s+(?P<hash>\S+)(?:\s+\S+)?)+)$"
r"(?P<hash_type>\S+)\s+(?P<hash>\S+)(?:\s+\S+)?)+)$"
users = {}
command = "show run | section username"
output = self._send_command(command)
Expand Down
41 changes: 25 additions & 16 deletions napalm/iosxr/iosxr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1315,23 +1315,32 @@ def get_route_to(self, destination='', protocol=''):
raise TypeError('Wrong destination IP Address!')

if ipv == 6:
route_info_rpc_command = '<Get><Operational><IPV6_RIB><VRFTable><VRF><Naming><VRFName>\
default</VRFName></Naming><AFTable><AF><Naming><AFName>IPv6</AFName></Naming><SAFTable>\
<SAF><Naming><SAFName>Unicast</SAFName></Naming><IP_RIBRouteTable><IP_RIBRoute><Naming>\
<RouteTableName>default</RouteTableName></Naming><RouteTable><Route><Naming><Address>\
{network}</Address>{prefix}</Naming></Route></RouteTable></IP_RIBRoute>\
</IP_RIBRouteTable></SAF></SAFTable></AF></AFTable></VRF></VRFTable></IPV6_RIB>\
</Operational></Get>'.format(network=network, prefix=prefix_tag)
route_info_rpc_command = (
'<Get><Operational><IPV6_RIB><VRFTable><VRF><Naming><VRFName>'
'default</VRFName></Naming><AFTable><AF><Naming><AFName>IPv6</AFName></Naming>'
'<SAFTable>'
'<SAF><Naming><SAFName>Unicast</SAFName></Naming><IP_RIBRouteTable><IP_RIBRoute>'
'<Naming>'
'<RouteTableName>default</RouteTableName></Naming><RouteTable><Route><Naming>'
'<Address>'
'{network}</Address>{prefix}</Naming></Route></RouteTable></IP_RIBRoute>'
'</IP_RIBRouteTable></SAF></SAFTable></AF></AFTable></VRF></VRFTable></IPV6_RIB>'
'</Operational></Get>'
).format(network=network, prefix=prefix_tag)
else:
route_info_rpc_command = '<Get><Operational><RIB><VRFTable><VRF><Naming><VRFName>default\
</VRFName></Naming><AFTable><AF><Naming><AFName>IPv4</AFName></Naming><SAFTable><SAF>\
<Naming><SAFName>Unicast</SAFName></Naming><IP_RIBRouteTable><IP_RIBRoute><Naming>\
<RouteTableName>default</RouteTableName></Naming><RouteTable><Route><Naming><Address>\
{network}</Address>{prefix}</Naming></Route></RouteTable></IP_RIBRoute></IP_RIBRouteTable>\
</SAF></SAFTable></AF></AFTable></VRF></VRFTable></RIB></Operational></Get>'.format(
network=network,
prefix=prefix_tag
)
route_info_rpc_command = (
'<Get><Operational><RIB><VRFTable><VRF><Naming><VRFName>'
'default'
'</VRFName></Naming><AFTable><AF><Naming><AFName>IPv4</AFName></Naming>'
'<SAFTable><SAF>'
'<Naming><SAFName>Unicast</SAFName></Naming><IP_RIBRouteTable><IP_RIBRoute>'
'<Naming>'
'<RouteTableName>default</RouteTableName></Naming><RouteTable><Route><Naming>'
'<Address>'
'{network}</Address>{prefix}</Naming></Route></RouteTable></IP_RIBRoute>'
'</IP_RIBRouteTable>'
'</SAF></SAFTable></AF></AFTable></VRF></VRFTable></RIB></Operational></Get>'
).format(network=network, prefix=prefix_tag)

routes_tree = ETREE.fromstring(self.device.make_rpc_call(route_info_rpc_command))

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="napalm",
version='2.3.0',
version='2.3.1',
packages=find_packages(exclude=("test*", )),
test_suite='test_base',
author="David Barroso, Kirk Byers, Mircea Ulinic",
Expand Down
8 changes: 4 additions & 4 deletions test/base/validate/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

_compare_getter = [
(
{"list": ["\d{2}", 1, 2]},
{"list": [r"\d{2}", 1, 2]},
[1, 2, 33],
{u'complies': True, u'extra': [], u'missing': [], u'present': ['\d{2}', 1, 2]}
{u'complies': True, u'extra': [], u'missing': [], u'present': [r'\d{2}', 1, 2]}
),
(
{"list": [1, 2, 3]},
Expand All @@ -29,9 +29,9 @@
u'present': [1, 2, {'list': [1, 2]}]}
),
(
{"list": ['\d{2}', 4, 3]},
{"list": [r'\d{2}', 4, 3]},
[1, 2, 3],
{u'complies': False, u'extra': [], u'missing': ['\d{2}', 4], u'present': [3]}
{u'complies': False, u'extra': [], u'missing': [r'\d{2}', 4], u'present': [3]}
),
(
{"list": [{"list": [1, 2]}, 3]},
Expand Down

0 comments on commit 7a8f79b

Please sign in to comment.