Re: [ovs-dev] [PATCH v3] tests: Test for ovs-ofctl snoop command

2018-08-06 Thread Ben Pfaff
On Mon, Aug 06, 2018 at 03:53:37PM -0700, Ashish Varma wrote:
> Added test for snoop command to check for the initial handshake messages
> when a bridge connects to a controller via 'unix' connection method.
> 
> Signed-off-by: Ashish Varma 
> ---
> v2-v3:
> 
> Moved 'on_exit kill" command before the start of the command to avoid the 
> race 
> condition between start of the process and registering to have it killed on
> interrupt.
> Removed deletion of snoopbr0.txt to debug any failure.
> Cleaner shell re-direct.

Thanks, applied to master.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v3] tests: Test for ovs-ofctl snoop command

2018-08-06 Thread Ashish Varma
Added test for snoop command to check for the initial handshake messages
when a bridge connects to a controller via 'unix' connection method.

Signed-off-by: Ashish Varma 
---
v2-v3:

Moved 'on_exit kill" command before the start of the command to avoid the race 
condition between start of the process and registering to have it killed on
interrupt.
Removed deletion of snoopbr0.txt to debug any failure.
Cleaner shell re-direct.

---
 tests/ovs-ofctl.at | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at
index 06597d7..21a576a 100644
--- a/tests/ovs-ofctl.at
+++ b/tests/ovs-ofctl.at
@@ -3184,3 +3184,30 @@ AT_CHECK([grep -q "ct_dpif|DBG|.*ct_flush: zone 123" 
ovs-vswitchd.log])
 
 OVS_VSWITCHD_STOP
 AT_CLEANUP
+
+
+AT_SETUP([ovs-ofctl snoop-unix-connection])
+OVS_VSWITCHD_START
+
+dnl setup controller for br0 before starting the controller
+AT_CHECK([ovs-vsctl -vsyslog:off set-controller br0 unix:testcontroller])
+
+dnl then start listening on the '.snoop' connection
+on_exit 'kill `cat ovs-ofctl-snoop.pid`'
+AT_CHECK([ovs-ofctl -vsyslog:off --detach --pidfile=ovs-ofctl-snoop.pid snoop 
br0 > snoopbr0.txt 2>&1])
+
+dnl finally start the controller
+on_exit 'kill `cat ovs-testcontroller.pid`'
+AT_CHECK([ovs-testcontroller -vsyslog:off --detach --pidfile 
punix:testcontroller], [0], [ignore])
+OVS_WAIT_UNTIL([test -e testcontroller])
+
+dnl check for some of the initial handshake messages
+OVS_WAIT_UNTIL([egrep "OFPT_FEATURES_REQUEST" snoopbr0.txt 1> /dev/null 2>&1])
+OVS_WAIT_UNTIL([egrep "OFPT_FEATURES_REPLY" snoopbr0.txt 1> /dev/null 2>&1])
+OVS_WAIT_UNTIL([egrep "OFPT_SET_CONFIG" snoopbr0.txt 1> /dev/null 2>&1])
+
+dnl need to suppress the 'connection failed' WARN message in ovs-vswitchd
+dnl because we need ovs-vswitchd to have the controller config before starting
+dnl the controller to 'snoop' the OpenFlow messages from beginning
+OVS_VSWITCHD_STOP(["/connection failed (No such file or directory)/d"])
+AT_CLEANUP
-- 
2.7.4

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev