diff --git a/ansible/roles/neutron/defaults/main.yml b/ansible/roles/neutron/defaults/main.yml index b4e2eb92f7..998195a40e 100644 --- a/ansible/roles/neutron/defaults/main.yml +++ b/ansible/roles/neutron/defaults/main.yml @@ -393,7 +393,7 @@ mechanism_drivers: - name: "baremetal" enabled: "{{ enable_ironic_neutron_agent | bool }}" - name: "l2population" - enabled: "{{ not enable_hyperv | bool or neutron_plugin_agent != 'ovn' }}" + enabled: "{{ not enable_hyperv | bool and neutron_plugin_agent != 'ovn' }}" - name: "ovn" enabled: "{{ neutron_plugin_agent == 'ovn' }}" diff --git a/ansible/roles/ovn/templates/ovn-nb-db.json.j2 b/ansible/roles/ovn/templates/ovn-nb-db.json.j2 index 5255566511..f634874119 100644 --- a/ansible/roles/ovn/templates/ovn-nb-db.json.j2 +++ b/ansible/roles/ovn/templates/ovn-nb-db.json.j2 @@ -1,7 +1,5 @@ -{% set ovnctl_cmd = '/usr/share/ovn/scripts/ovn-ctl' %} - { - "command": "{{ ovnctl_cmd }} run_nb_ovsdb --db-nb-create-insecure-remote=yes --db-nb-addr={{ api_interface_address }} --db-nb-cluster-local-addr={{ api_interface_address }} {% if groups['ovn-nb-db'] | length > 1 and inventory_hostname != groups['ovn-nb-db'][0] %} --db-nb-cluster-remote-addr={{ 'api' | kolla_address(groups['ovn-nb-db'][0]) }} {% endif %} --db-sock=/run/ovn/ovnnb_db.sock --db-nb-pid=/run/ovn/ovnnb_db.pid --db-nb-file=/var/lib/openvswitch/ovn-nb/ovnnb.db --ovn-nb-logfile=/var/log/kolla/openvswitch/ovn-nb-db.log", + "command": "/usr/share/ovn/scripts/ovn-ctl run_nb_ovsdb --db-nb-create-insecure-remote=yes --db-nb-addr={{ api_interface_address }} --db-nb-cluster-local-addr={{ api_interface_address }} {% if groups['ovn-nb-db'] | length > 1 and inventory_hostname != groups['ovn-nb-db'][0] %} --db-nb-cluster-remote-addr={{ 'api' | kolla_address(groups['ovn-nb-db'][0]) }} {% endif %} --db-sock=/run/ovn/ovnnb_db.sock --db-nb-pid=/run/ovn/ovnnb_db.pid --db-nb-file=/var/lib/openvswitch/ovn-nb/ovnnb.db --ovn-nb-logfile=/var/log/kolla/openvswitch/ovn-nb-db.log", "permissions": [ { "path": "/var/log/kolla/openvswitch", diff --git a/ansible/roles/ovn/templates/ovn-sb-db.json.j2 b/ansible/roles/ovn/templates/ovn-sb-db.json.j2 index 5777b1f5ad..30f6596cd6 100644 --- a/ansible/roles/ovn/templates/ovn-sb-db.json.j2 +++ b/ansible/roles/ovn/templates/ovn-sb-db.json.j2 @@ -1,7 +1,5 @@ -{% set ovnctl_cmd = '/usr/share/ovn/scripts/ovn-ctl' %} - { - "command": "{{ ovnctl_cmd }} run_sb_ovsdb --db-sb-create-insecure-remote=yes --db-sb-addr={{ api_interface_address }} --db-sb-cluster-local-addr={{ api_interface_address }} {% if groups['ovn-sb-db'] | length > 1 and inventory_hostname != groups['ovn-sb-db'][0] %} --db-sb-cluster-remote-addr={{ 'api' | kolla_address(groups['ovn-sb-db'][0]) }} {% endif %} --db-sock=/run/ovn/ovnsb_db.sock --db-sb-pid=/run/ovn/ovnsb_db.pid --db-sb-file=/var/lib/openvswitch/ovn-sb/ovnsb.db --ovn-sb-logfile=/var/log/kolla/openvswitch/ovn-sb-db.log", + "command": "/usr/share/ovn/scripts/ovn-ctl run_sb_ovsdb --db-sb-create-insecure-remote=yes --db-sb-addr={{ api_interface_address }} --db-sb-cluster-local-addr={{ api_interface_address }} {% if groups['ovn-sb-db'] | length > 1 and inventory_hostname != groups['ovn-sb-db'][0] %} --db-sb-cluster-remote-addr={{ 'api' | kolla_address(groups['ovn-sb-db'][0]) }} {% endif %} --db-sock=/run/ovn/ovnsb_db.sock --db-sb-pid=/run/ovn/ovnsb_db.pid --db-sb-file=/var/lib/openvswitch/ovn-sb/ovnsb.db --ovn-sb-logfile=/var/log/kolla/openvswitch/ovn-sb-db.log", "permissions": [ { "path": "/var/log/kolla/openvswitch", diff --git a/releasenotes/notes/implement-ovn-80b3a73e6c8a44e7.yaml b/releasenotes/notes/implement-ovn-80b3a73e6c8a44e7.yaml index 2fd23d6d8a..fc40103a4f 100644 --- a/releasenotes/notes/implement-ovn-80b3a73e6c8a44e7.yaml +++ b/releasenotes/notes/implement-ovn-80b3a73e6c8a44e7.yaml @@ -1,7 +1,8 @@ --- features: - | - Implement OVN and integration with Neutron. This includes deployment of: + Implement OVN and its integration with Neutron. This includes deployment + of: * OVN databases (``ovn-sb-db`` and ``ovn-nb-db``) * Southbound and Northbound databases connector (``ovn-northd``) diff --git a/tests/test-ovn.sh b/tests/test-ovn.sh index bfb2dd99a2..fb13682daa 100755 --- a/tests/test-ovn.sh +++ b/tests/test-ovn.sh @@ -4,22 +4,37 @@ set -o xtrace set -o errexit set -o pipefail -# Enable unbuffered output for Ansible in Jenkins. +# Enable unbuffered output export PYTHONUNBUFFERED=1 function test_ovn_logged { + # List OVN NB/SB entries + echo "OVN NB DB entries:" + sudo docker exec ovn_northd ovn-nbctl --db "tcp:192.0.2.1:6641,tcp:192.0.2.2:6641,tcp:192.0.2.3:6641" show + + echo "OVN SB DB entries:" + sudo docker exec ovn_northd ovn-sbctl --db "tcp:192.0.2.1:6642,tcp:192.0.2.2:6642,tcp:192.0.2.3:6642" show + # Test OVSDB cluster state if [[ $BASE_DISTRO =~ ^(debian|ubuntu)$ ]]; then - sudo docker exec ovn_nb_db ovs-appctl -t /var/run/openvswitch/ovnnb_db.ctl cluster/status OVN_Northbound - sudo docker exec ovn_sb_db ovs-appctl -t /var/run/openvswitch/ovnsb_db.ctl cluster/status OVN_Southbound + OVNNB_STATUS=$(sudo docker exec ovn_nb_db ovs-appctl -t /var/run/openvswitch/ovnnb_db.ctl cluster/status OVN_Northbound) + OVNSB_STATUS=$(sudo docker exec ovn_sb_db ovs-appctl -t /var/run/openvswitch/ovnsb_db.ctl cluster/status OVN_Southbound) else - sudo docker exec ovn_nb_db ovs-appctl -t /var/run/ovn/ovnnb_db.ctl cluster/status OVN_Northbound - sudo docker exec ovn_sb_db ovs-appctl -t /var/run/ovn/ovnsb_db.ctl cluster/status OVN_Southbound + OVNNB_STATUS=$(sudo docker exec ovn_nb_db ovs-appctl -t /var/run/ovn/ovnnb_db.ctl cluster/status OVN_Northbound) + OVNSB_STATUS=$(sudo docker exec ovn_sb_db ovs-appctl -t /var/run/ovn/ovnsb_db.ctl cluster/status OVN_Southbound) fi - # List OVN NB/SB entries - sudo docker exec ovn_northd ovn-nbctl --db "tcp:192.0.2.1:6641,tcp:192.0.2.2:6641,tcp:192.0.2.3:6641" show - sudo docker exec ovn_northd ovn-sbctl --db "tcp:192.0.2.1:6642,tcp:192.0.2.2:6642,tcp:192.0.2.3:6642" show + if [[ $(grep -o "at tcp:" <<< ${OVNNB_STATUS} | wc -l) != "3" ]]; then + echo "ERR: NB Cluster does not have 3 nodes" + echo "Output: ${OVNNB_STATUS}" + exit 1 + fi + + if [[ $(grep -o "at tcp:" <<< ${OVNSB_STATUS} | wc -l) != "3" ]]; then + echo "ERR: SB Cluster does not have 3 nodes" + echo "Output: ${OVNSB_STATUS}" + exit 1 + fi } function test_ovn {