Повышен приоритет группированных маршрутов preference=400.
This commit is contained in:
@@ -301,7 +301,7 @@ if __name__ == "__main__":
|
|||||||
# список комьюнити маршрутов
|
# список комьюнити маршрутов
|
||||||
bgp_community=" ".join([f"bgp_community.add(({str(c).replace(':',',')}));" for c in sorted(v[0])])
|
bgp_community=" ".join([f"bgp_community.add(({str(c).replace(':',',')}));" for c in sorted(v[0])])
|
||||||
with open(ipv4_bird2_m4, "a") as file:
|
with open(ipv4_bird2_m4, "a") as file:
|
||||||
file.write(f"protocol static static_{k.lower()}_v4 {{\n\tipv4 {{ import filter {{ {bgp_community}accept; }}; }};\n\tinclude \"{ipv4_out_file}\";\n}}\n")
|
file.write(f"protocol static static_{k.lower()}_v4 {{\n\tipv4 {{ import filter {{ {bgp_community} preference=400; accept; }}; }};\n\tinclude \"{ipv4_out_file}\";\n}}\n")
|
||||||
# обновляем временный файл конфигурации ipv6
|
# обновляем временный файл конфигурации ipv6
|
||||||
# из группировок
|
# из группировок
|
||||||
if ipv6_dict:
|
if ipv6_dict:
|
||||||
@@ -315,7 +315,7 @@ if __name__ == "__main__":
|
|||||||
# список комьюнити маршрутов
|
# список комьюнити маршрутов
|
||||||
bgp_community=" ".join([f"bgp_community.add(({str(c).replace(':',',')}));" for c in sorted(v[0])])
|
bgp_community=" ".join([f"bgp_community.add(({str(c).replace(':',',')}));" for c in sorted(v[0])])
|
||||||
with open(ipv6_bird2_m4, "a") as file:
|
with open(ipv6_bird2_m4, "a") as file:
|
||||||
file.write(f"protocol static static_{k.lower()}_v6 {{\n\tipv6 {{ import filter {{ {bgp_community}accept; }}; }};\n\tinclude \"{ipv6_out_file}\";\n}}\n")
|
file.write(f"protocol static static_{k.lower()}_v6 {{\n\tipv6 {{ import filter {{ {bgp_community} preference=400; accept; }}; }};\n\tinclude \"{ipv6_out_file}\";\n}}\n")
|
||||||
|
|
||||||
# дополняем временный файл конфигурации всей выгрузкой ipv4 и ipv6
|
# дополняем временный файл конфигурации всей выгрузкой ipv4 и ipv6
|
||||||
for clist, value in ip_list.items():
|
for clist, value in ip_list.items():
|
||||||
@@ -326,10 +326,10 @@ if __name__ == "__main__":
|
|||||||
bgp_community=" ".join([f"bgp_community.add(({str(c).replace(':',',')}));" for c in sorted([c for c in value[0].get('community', "").split(",") if c])])
|
bgp_community=" ".join([f"bgp_community.add(({str(c).replace(':',',')}));" for c in sorted([c for c in value[0].get('community', "").split(",") if c])])
|
||||||
if os.path.exists(ipv4_out_file):
|
if os.path.exists(ipv4_out_file):
|
||||||
with open(ipv4_bird2_m4, "a") as file:
|
with open(ipv4_bird2_m4, "a") as file:
|
||||||
file.write(f"protocol static static_{clist.lower()}_v4 {{\n\tipv4 {{ import filter {{ {bgp_community}accept; }}; }};\n\tinclude \"{ipv4_out_file}\";\n}}\n")
|
file.write(f"protocol static static_{clist.lower()}_v4 {{\n\tipv4 {{ import filter {{ {bgp_community} accept; }}; }};\n\tinclude \"{ipv4_out_file}\";\n}}\n")
|
||||||
if os.path.exists(ipv6_out_file):
|
if os.path.exists(ipv6_out_file):
|
||||||
with open(ipv6_bird2_m4, "a") as file:
|
with open(ipv6_bird2_m4, "a") as file:
|
||||||
file.write(f"protocol static static_{clist.lower()}_v6 {{\n\tipv4 {{ import filter {{ {bgp_community}accept; }}; }};\n\tinclude \"{ipv6_out_file}\";\n}}\n")
|
file.write(f"protocol static static_{clist.lower()}_v6 {{\n\tipv4 {{ import filter {{ {bgp_community} accept; }}; }};\n\tinclude \"{ipv6_out_file}\";\n}}\n")
|
||||||
|
|
||||||
# проверяем, что временный файл конфигурации ipv4 не пустой, сохраняем в постоянный
|
# проверяем, что временный файл конфигурации ipv4 не пустой, сохраняем в постоянный
|
||||||
if os.path.exists(ipv4_bird2_m4) and os.path.getsize(ipv4_bird2_m4) != 0:
|
if os.path.exists(ipv4_bird2_m4) and os.path.getsize(ipv4_bird2_m4) != 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user