Skip to content

Commit

Permalink
add feat
Browse files Browse the repository at this point in the history
  • Loading branch information
canoziia committed Jan 12, 2025
1 parent 88c041c commit 29bb54c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions configure/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ def get_router_id(router_name):
return answer[0].address


def isIP(ipstr):
try:
ipaddress.ip_address(ipstr)
return True
except ValueError:
return False


def get_as_info(asn):
"""use peeringdb to get as info"""

Expand Down Expand Up @@ -667,6 +675,7 @@ def get_bgp_neighbor_cmd(
{f"set protocols bgp neighbor {neighbor_address} ebgp-multihop {multihop}" if multihop else ""}
set protocols bgp neighbor {neighbor_address} solo
set protocols bgp neighbor {neighbor_address} update-source {neighbor["update-source"]}
{f"set protocols bgp neighbor {neighbor_address} interface source-interface {neighbor["update-source"]}" if not isIP(neighbor["update-source"]) else ""}
{f"set protocols bgp neighbor {neighbor_address} timers holdtime {neighbor['holdtime']}" if "holdtime" in neighbor else ""}
{f"set protocols bgp neighbor {neighbor_address} timers keepalive {neighbor['keepalive']}" if "keepalive" in neighbor else ""}
{f"set protocols bgp neighbor {neighbor_address} address-family ipv{ipversion}-unicast addpath-tx-all" if "addpath" in neighbor and neighbor["addpath"] else ""}
Expand Down

0 comments on commit 29bb54c

Please sign in to comment.