diff mbox

[ovs-dev,4/4] ovn: Test that port state goes up and down.

Message ID 1466797931-23871-5-git-send-email-russell@ovn.org
State Accepted
Headers show

Commit Message

Russell Bryant June 24, 2016, 7:52 p.m. UTC
Some previous commits broke ovn-controller binding handling such that
ovn-controller never cleared out the chassis column of the Port_Binding
table.  This broke OpenStack CI for OVN.  This patch adds an OVN test
case that would have caught this issue.

Signed-off-by: Russell Bryant <russell@ovn.org>
---
 tests/ovn.at | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

Comments

Russell Bryant June 24, 2016, 7:56 p.m. UTC | #1
On Fri, Jun 24, 2016 at 3:52 PM, Russell Bryant <russell@ovn.org> wrote:

> Some previous commits broke ovn-controller binding handling such that
> ovn-controller never cleared out the chassis column of the Port_Binding
> table.  This broke OpenStack CI for OVN.  This patch adds an OVN test
> case that would have caught this issue.
>
> Signed-off-by: Russell Bryant <russell@ovn.org>
> ---
>  tests/ovn.at | 46 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 46 insertions(+)
>
> diff --git a/tests/ovn.at b/tests/ovn.at
> index 297070c..5aa1fd6 100644
> --- a/tests/ovn.at
> +++ b/tests/ovn.at
> @@ -3182,3 +3182,49 @@ OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
>  OVS_APP_EXIT_AND_WAIT([ovsdb-server])
>
>  AT_CLEANUP
> +
> +# 1 hypervisor, 1 port
> +# make sure that the port state is properly set to up and back down
> +# when created and deleted.
> +AT_SETUP([ovn -- port state up and down])
> +AT_KEYWORDS([ovn])
> +ovn_start
> +
> +ovn-nbctl ls-add ls1
> +ovn-nbctl lsp-add ls1 lp1
> +ovn-nbctl lsp-set-addresses lp1 unknown
> +
> +net_add n1
> +sim_add hv1
> +echo 1
> +as hv1 ovs-vsctl add-br br-phys
> +echo 2
> +as hv1 ovn_attach n1 br-phys 192.168.0.1
> +echo 3
> +
> +as hv1 ovs-vsctl add-port br-int vif1 -- set Interface vif1
> external-ids:iface-id=lp1
> +OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lp1` = xup])
> +echo 4
> +
> +as hv1 ovs-vsctl del-port br-int vif1
> +OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lp1` = xdown])
> +
> +echo 5
>

All these debug "echo" commands should be removed ... oops.
Ryan Moats June 24, 2016, 9:24 p.m. UTC | #2
Russell Bryant <russell@ovn.org> wrote on 06/24/2016 02:52:11 PM:

> From: Russell Bryant <russell@ovn.org>
> To: dev@openvswitch.org
> Cc: Ryan Moats/Omaha/IBM@IBMUS, blp@ovn.org, Russell Bryant
<russell@ovn.org>
> Date: 06/24/2016 02:52 PM
> Subject: [PATCH 4/4] ovn: Test that port state goes up and down.
>
> Some previous commits broke ovn-controller binding handling such that
> ovn-controller never cleared out the chassis column of the Port_Binding
> table.  This broke OpenStack CI for OVN.  This patch adds an OVN test
> case that would have caught this issue.
>
> Signed-off-by: Russell Bryant <russell@ovn.org>
> ---
>  tests/ovn.at | 46 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 46 insertions(+)
>
> diff --git a/tests/ovn.at b/tests/ovn.at
> index 297070c..5aa1fd6 100644
> --- a/tests/ovn.at
> +++ b/tests/ovn.at
> @@ -3182,3 +3182,49 @@ OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
>  OVS_APP_EXIT_AND_WAIT([ovsdb-server])
>
>  AT_CLEANUP
> +
> +# 1 hypervisor, 1 port
> +# make sure that the port state is properly set to up and back down
> +# when created and deleted.
> +AT_SETUP([ovn -- port state up and down])
> +AT_KEYWORDS([ovn])
> +ovn_start
> +
> +ovn-nbctl ls-add ls1
> +ovn-nbctl lsp-add ls1 lp1
> +ovn-nbctl lsp-set-addresses lp1 unknown
> +
> +net_add n1
> +sim_add hv1
> +echo 1
> +as hv1 ovs-vsctl add-br br-phys
> +echo 2
> +as hv1 ovn_attach n1 br-phys 192.168.0.1
> +echo 3
> +
> +as hv1 ovs-vsctl add-port br-int vif1 -- set Interface vif1
> external-ids:iface-id=lp1
> +OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lp1` = xup])
> +echo 4
> +
> +as hv1 ovs-vsctl del-port br-int vif1
> +OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lp1` = xdown])
> +
> +echo 5
> +as hv1
> +OVS_APP_EXIT_AND_WAIT([ovn-controller])
> +OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
> +OVS_APP_EXIT_AND_WAIT([ovsdb-server])
> +
> +as ovn-sb
> +OVS_APP_EXIT_AND_WAIT([ovsdb-server])
> +
> +as ovn-nb
> +OVS_APP_EXIT_AND_WAIT([ovsdb-server])
> +
> +as northd
> +OVS_APP_EXIT_AND_WAIT([ovn-northd])
> +
> +as main
> +OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
> +OVS_APP_EXIT_AND_WAIT([ovsdb-server])
> +AT_CLEANUP
> --
> 2.7.4
>

With the changes that Russell has suggested (i.e.
removing the echo statements)...

Acked-by: Ryan Moats <rmoats@us.ibm.com>

Having this would have prevented today's fire drill :)
Russell Bryant July 1, 2016, 5:32 p.m. UTC | #3
On Fri, Jun 24, 2016 at 5:24 PM, Ryan Moats <rmoats@us.ibm.com> wrote:
>
> Acked-by: Ryan Moats <rmoats@us.ibm.com>
>
> Having this would have prevented today's fire drill :)
>
> Thanks, Ryan.  I applied this patch to master.
diff mbox

Patch

diff --git a/tests/ovn.at b/tests/ovn.at
index 297070c..5aa1fd6 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -3182,3 +3182,49 @@  OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
 OVS_APP_EXIT_AND_WAIT([ovsdb-server])
 
 AT_CLEANUP
+
+# 1 hypervisor, 1 port
+# make sure that the port state is properly set to up and back down
+# when created and deleted.
+AT_SETUP([ovn -- port state up and down])
+AT_KEYWORDS([ovn])
+ovn_start
+
+ovn-nbctl ls-add ls1
+ovn-nbctl lsp-add ls1 lp1
+ovn-nbctl lsp-set-addresses lp1 unknown
+
+net_add n1
+sim_add hv1
+echo 1
+as hv1 ovs-vsctl add-br br-phys
+echo 2
+as hv1 ovn_attach n1 br-phys 192.168.0.1
+echo 3
+
+as hv1 ovs-vsctl add-port br-int vif1 -- set Interface vif1 external-ids:iface-id=lp1
+OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lp1` = xup])
+echo 4
+
+as hv1 ovs-vsctl del-port br-int vif1
+OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lp1` = xdown])
+
+echo 5
+as hv1
+OVS_APP_EXIT_AND_WAIT([ovn-controller])
+OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
+OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+
+as ovn-sb
+OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+
+as ovn-nb
+OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+
+as northd
+OVS_APP_EXIT_AND_WAIT([ovn-northd])
+
+as main
+OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
+OVS_APP_EXIT_AND_WAIT([ovsdb-server])
+AT_CLEANUP