Skip to content
This repository has been archived by the owner on Jan 16, 2019. It is now read-only.

Commit

Permalink
Merge 06c0116 into 8367353
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaskarp authored Aug 4, 2017
2 parents 8367353 + 06c0116 commit 444572f
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions napalm_ios/ios.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -947,19 +947,26 @@ def get_interfaces(self):
interface_dict = {}
for line in output.splitlines():

interface_regex = r"^(\S+?)\s+is\s+(.+?),\s+line\s+protocol\s+is\s+(\S+)"
if re.search(interface_regex, line):
interface_match = re.search(interface_regex, line)
interface = interface_match.groups()[0]
status = interface_match.groups()[1]
protocol = interface_match.groups()[2]

if 'admin' in status:
is_enabled = False
interface_regex_simple = r"^(\S+?)\s+is\s+(.+?)"
if re.search(interface_regex_simple, line):
interface_match_simple = re.search(interface_regex_simple, line)
interface = interface_match_simple.groups()[0]
status = interface_match_simple.groups()[1]

interface_regex = r"^(\S+?)\s+is\s+(.+?),\s+line\s+protocol\s+is\s+(\S+)"
if re.search(interface_regex, line):
interface_match = re.search(interface_regex, line)
status = interface_match.groups()[1]
protocol = interface_match.groups()[2]

if 'admin' in status:
is_enabled = False
else:
is_enabled = True
is_up = bool('up' in protocol)
else:
is_enabled = True
is_up = bool('up' in protocol)

is_enabled = True
is_up = True
mac_addr_regex = r"^\s+Hardware.+address\s+is\s+({})".format(MAC_REGEX)
if re.search(mac_addr_regex, line):
mac_addr_match = re.search(mac_addr_regex, line)
Expand Down

0 comments on commit 444572f

Please sign in to comment.