Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,10 @@ up: env gen-certs control-plane-bake partition-bake
# for some reason an allocated machine will not be able to phone home
# without restarting the metal-core
# TODO: should be investigated and fixed if possible
# check that underlay gets working
sleep 10
ssh -F files/ssh/config leaf01 'systemctl restart metal-core'
ssh -F files/ssh/config leaf02 'systemctl restart metal-core'
# TODO: for community SONiC versions > 202311 a bgp restart is needed in the virtual environment
sleep 15
ssh -F files/ssh/config leaf01 'systemctl restart bgp'
ssh -F files/ssh/config leaf02 'systemctl restart bgp'

.PHONY: restart
restart: down up
Expand Down
8 changes: 8 additions & 0 deletions deploy_partition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,11 @@
- lookup('metal', 'search', 'switch', api_url=metal_partition_metal_api_protocol+'://'+metal_partition_metal_api_addr+':'+metal_partition_metal_api_port|string+metal_partition_metal_api_basepath, api_hmac=metal_partition_metal_api_hmac_edit_key) | length == 2
- lookup('metal', 'search', 'switch', api_url=metal_partition_metal_api_protocol+'://'+metal_partition_metal_api_addr+':'+metal_partition_metal_api_port|string+metal_partition_metal_api_basepath, api_hmac=metal_partition_metal_api_hmac_edit_key)[0]["last_sync"] != None
- lookup('metal', 'search', 'switch', api_url=metal_partition_metal_api_protocol+'://'+metal_partition_metal_api_addr+':'+metal_partition_metal_api_port|string+metal_partition_metal_api_basepath, api_hmac=metal_partition_metal_api_hmac_edit_key)[1]["last_sync"] != None

- name: Wait for underlay
hosts: leaves
any_errors_fatal: true
gather_facts: false
pre_tasks:
- name: Wait until no route entries have "queued"
include_tasks: tasks/check_queued.yaml
33 changes: 33 additions & 0 deletions tasks/check_queued.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---


- name: wait for more than one route
shell: |
set -euo pipefail
vtysh -c 'show bgp ipv4 unicast json' | jq -r '.routes | to_entries | length > 1'
args:
executable: /bin/bash
register: routes_check
until: routes_check.stdout == "true"
retries: 10
delay: 5
changed_when: false

- name: check for queued routes
shell: |
vtysh -c 'show ip route json' | jq -r '[.[] | .[] | .queued == true] | any'
args:
executable: /bin/bash
register: queued_check
delay: 5
changed_when: false

- name: restart bgp
ansible.builtin.systemd:
name: bgp
state: restarted
when: queued_check.stdout == "true"

- name: recheck for queued routes
include_tasks: tasks/check_queued.yaml
when: queued_check.stdout == "true"