Skip to content

Commit 1e944b7

Browse files
ausphamsaravanan-nexthop
authored andcommitted
feat: allow previous connection for deploy-l1 (sonic-net#21909)
Description of PR Summary: Fixes # (issue) Currently, deploy-l1 is using overwrite mode. Which replace all the previous connection and add a new one on top. However, this will also not allow us to re-use l1. New changes add a parameter allow_previous_connection which helps to allow existing connections. It only remove if the connection is overlap with the second connection Signed-off-by: Austin Pham <[email protected]> Signed-off-by: Saravanan Sellappa <[email protected]>
1 parent 0174638 commit 1e944b7

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

ansible/roles/testbed/nut/tasks/l1_create_config_patch.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@
4949
l1_links: "{{ device_from_l1_links[inventory_hostname] }}"
5050
l1_cross_connects: "{{ device_l1_cross_connects[inventory_hostname] }}"
5151
l1_existing_cross_connects: "{{ device_l1_existing_cross_connects }}"
52+
reset_previous_connection: "{{ reset_previous_connection | default(true) | bool }}"

ansible/roles/testbed/nut/templates/config_patch/l1/ocs_xconnect.json.j2

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
{%- for port_a, port_b in l1_existing_cross_connects.items() %}
2-
{ "op": "remove", "path": "/OCS_CROSS_CONNECT/{{ port_a }}-{{ port_b }}" },
2+
{%- if reset_previous_connection | bool %}
3+
{ "op": "remove", "path": "/OCS_CROSS_CONNECT/{{ port_a }}-{{ port_b }}" },
4+
{%- else %}
5+
{%- if port_a in l1_cross_connects or port_b in l1_cross_connects %}
6+
{ "op": "remove", "path": "/OCS_CROSS_CONNECT/{{ port_a }}-{{ port_b }}" },
7+
{%- endif %}
8+
{%- endif %}
39
{% endfor %}
10+
411
{%- for port_a, port_b in l1_cross_connects.items() %}
512
{ "op": "add", "path": "/OCS_CROSS_CONNECT/{{ port_a }}A-{{ port_b }}B", "value": {} },
613
{ "op": "add", "path": "/OCS_CROSS_CONNECT/{{ port_a }}A-{{ port_b }}B/a_side", "value": "{{ port_a }}A" },

ansible/testbed-cli.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ function deploy_l1
700700
echo "Devices to generate config for: $devices"
701701
echo ""
702702

703-
ansible-playbook -i "$inventory" deploy_config_on_testbed.yml --vault-password-file="$passfile" -l "$devices" -e testbed_name="$testbed_name" -e testbed_file=$tbfile -e deploy=true -e save=true -e config_duts=false$@
703+
ansible-playbook -i "$inventory" deploy_config_on_testbed.yml --vault-password-file="$passfile" -l "$devices" -e testbed_name="$testbed_name" -e testbed_file=$tbfile -e deploy=true -e save=true -e config_duts=false -e reset_previous_connection=false$@
704704

705705
echo Done
706706
}

0 commit comments

Comments
 (0)