Skip to content

Commit

Permalink
shorten bgp group names
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-re-ka committed Jan 17, 2024
1 parent 2155ed4 commit 63f9f7d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion wanda/bgp_device_group/bgp_device_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,16 @@ def to_junos(self):
export_policies = self.get_export_policies()
import_policies = self.get_import_policies()

# name contains an ip version suffix every time.

shorted_name = self.name
if len(self.name) > 32:
as_len = len(str(self.asn))
cap = 29 - as_len - 1
shorted_name = f'{self.name[0:-3][:cap]}_{str(self.asn)}{self.name[-3:]}'

junos_elem = {
"name": self.name,
"name": shorted_name,
"peer_as": self.asn,
"type": "external",
"remove_private": True,
Expand Down

0 comments on commit 63f9f7d

Please sign in to comment.