diff --git a/tests/roles/dataplane_adoption/defaults/main.yaml b/tests/roles/dataplane_adoption/defaults/main.yaml index 58609faa1..2b5aa54e7 100644 --- a/tests/roles/dataplane_adoption/defaults/main.yaml +++ b/tests/roles/dataplane_adoption/defaults/main.yaml @@ -397,6 +397,9 @@ dataplane_cr: | ovn_monitor_all: true edpm_ovn_remote_probe_interval: 60000 edpm_ovn_ofctrl_wait_before_clear: 8000 + {% if edpm_ovn_dbs_nodeset is defined -%} + edpm_ovn_dbs: {{ edpm_ovn_dbs_nodeset }} + {%+ endif +%} nodes: dpa_dir: "../.." diff --git a/tests/roles/dataplane_adoption/tasks/main.yaml b/tests/roles/dataplane_adoption/tasks/main.yaml index 7c31119f7..d73f69281 100644 --- a/tests/roles/dataplane_adoption/tasks/main.yaml +++ b/tests/roles/dataplane_adoption/tasks/main.yaml @@ -43,6 +43,69 @@ EOF when: configure_ipam | bool +# DCN requires routes in the internalapi NAD so OVN SB pods can reach DCN compute nodes. +# Macvlan pods don't inherit routes from the node interface, so we add them to the NAD. +- name: Patch internalapi NAD with routes to DCN subnets + when: edpm_nodes_dcn1 is defined or edpm_nodes_dcn2 is defined + no_log: "{{ use_no_log }}" + ansible.builtin.shell: | + {{ shell_header }} + {{ oc_header }} + + # Get current NAD config + CURRENT_CONFIG=$(oc get net-attach-def internalapi -n openstack -o jsonpath='{.spec.config}') + + # Check if routes already exist + if echo "$CURRENT_CONFIG" | grep -q '"routes"'; then + echo "Routes already exist in internalapi NAD, skipping" + exit 0 + fi + + # Build routes array for DCN subnets + # DCN1: 172.17.10.0/24, DCN2: 172.17.20.0/24, gateway: 172.17.0.1 + ROUTES='[{"dst":"172.17.10.0/24","gw":"172.17.0.1"},{"dst":"172.17.20.0/24","gw":"172.17.0.1"}]' + + # Add routes to IPAM config + NEW_CONFIG=$(echo "$CURRENT_CONFIG" | python3 -c " + import json, sys + config = json.load(sys.stdin) + config['ipam']['routes'] = json.loads('$ROUTES') + print(json.dumps(config)) + ") + + # Apply updated NAD + oc apply -f - </dev/null; then + # Get current services list and replace 'ovn' with 'ovn-dcn' + SERVICES=$(oc get openstackdataplanenodeset dcn1 -n openstack -o jsonpath='{.spec.services}' | \ + sed 's/"ovn"/"ovn-dcn"/g') + + # Apply the patch + oc patch openstackdataplanenodeset dcn1 -n openstack --type=merge --patch " + spec: + services: $SERVICES + " + echo "Patched dcn1 nodeset to use ovn-dcn service" + fi + {% endif %} + + # Patch dcn2 nodeset if it exists + {% if edpm_nodes_dcn2 is defined %} + if oc get openstackdataplanenodeset dcn2 -n openstack &>/dev/null; then + # Get current services list and replace 'ovn' with 'ovn-dcn' + SERVICES=$(oc get openstackdataplanenodeset dcn2 -n openstack -o jsonpath='{.spec.services}' | \ + sed 's/"ovn"/"ovn-dcn"/g') + + # Apply the patch + oc patch openstackdataplanenodeset dcn2 -n openstack --type=merge --patch " + spec: + services: $SERVICES + " + echo "Patched dcn2 nodeset to use ovn-dcn service" + fi + {% endif %} + # TODO(bogdando): Apply the ceph backend config for Cinder in the original openstack CR, via kustomize perhaps? - name: prepare the adopted data plane workloads to use Ceph backend for Cinder, if configured so no_log: "{{ use_no_log }}"