Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenning committed Oct 26, 2023
2 parents 4fcc39d + 22b43d9 commit 5719f5e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,13 @@ from ciscoconfparse import CiscoConfParse
# ipv6 address fe80::1 link-local
# ipv6 enable
# ipv6 ospf 11 area 0
# standby 11 ip 172.16.2.254
# standby 11 ipv6 autoconfig
# standby 11 priority 150
# standby 11 preempt delay minimum 15
# standby 11 track Dialer1 75
# standby 110 ip 172.16.2.254
# standby 110 ipv6 autoconfig
# standby 110 priority 150
# standby 110 preempt delay minimum 15
# standby 110 track Dialer1 75
# standby 110 track FastEthernet0/1 20
# standby 110 track FastEthernet1/0 30
# standby 111 ip 172.16.2.253
# standby 111 priority 150
# standby 111 preempt delay minimum 15
Expand Down Expand Up @@ -207,9 +209,9 @@ Interface FastEthernet0/0: 172.16.2.1/24
Tracking interface: Dialer1
Tracking decrement: 75
Tracking weighting: None
--- Tracking FastEthernet0/1 ---
Tracking interface: FastEthernet0/1
Tracking decrement: 20
--- Tracking FastEthernet 0/1 ---
Tracking interface: FastEthernet 0/1
Tracking decrement: 10
Tracking weighting: None
--- Tracking FastEthernet1/0 ---
Tracking interface: FastEthernet1/0
Expand All @@ -220,6 +222,8 @@ Interface FastEthernet0/0: 172.16.2.1/24
Tracking interface: Dialer1
Tracking decrement: 50
Tracking weighting: None
GRP {'addr': <IPv6Obj fd01:ab00::/64>}
RESULT <IOSIntfLine # 231 'FastEthernet0/0' primary_ipv4: '172.16.2.1/24'> <IPv6Obj fd01:ab00::/64>
```


Expand Down
15 changes: 9 additions & 6 deletions ciscoconfparse/models_cisco.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def group(self):
@property
@logger.catch(reraise=True)
def decrement(self):
if isinstance(self._decrement, (str, int)):
if isinstance(self._decrement, (str, int)) and str(self._decrement) != "":
return int(self._decrement)
else:
return None
Expand Down Expand Up @@ -304,12 +304,15 @@ def get_hsrp_tracked_interfaces(self):
for obj in self._parent.children:
obj_parts = obj.text.strip().split()
if obj_parts[0:3] == ["standby", str(self._group), "track"]:
_groupdict = obj.re_match_iter_typed(
r"standby\s(\d+)\s+track\s+(?P<intf>\S.+?)\s+(?P<decr>\d+)$",
groupdict={"intf": str, "decr": int},
interface = None
decrement = 10
_gg = obj.re_match_iter_typed(
r"standby\s(\d+)\s+track\s+(?P<intf>\S.+?)(?P<decr>\s+\d+)*$",
groupdict={"intf": str, "decr": str},
)
interface = _groupdict["intf"]
decrement = _groupdict["decr"]
interface = _gg["intf"]
if isinstance(_gg["decr"], str) and _gg["decr"] != "None":
decrement = int(_gg["decr"].strip())
retval.append(
TrackingInterface(
group=int(self._group),
Expand Down

0 comments on commit 5719f5e

Please sign in to comment.