Add modules/bfd.py
This commit is contained in:
parent
c81d3c0f50
commit
dcde044104
1 changed files with 14 additions and 0 deletions
14
modules/bfd.py
Normal file
14
modules/bfd.py
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import re
|
||||||
|
|
||||||
|
def parse_bfd_peers_data(data):
|
||||||
|
bfd_peers = set()
|
||||||
|
|
||||||
|
if data and data.get('success') and isinstance(data.get('data'), str):
|
||||||
|
raw_text = data['data']
|
||||||
|
|
||||||
|
found_ips = re.findall(r"peer\s+([0-9a-fA-F:.]+)", raw_text)
|
||||||
|
|
||||||
|
for ip in found_ips:
|
||||||
|
bfd_peers.add(ip)
|
||||||
|
|
||||||
|
return bfd_peers
|
||||||
Loading…
Add table
Add a link
Reference in a new issue