[ovs-dev] [PATCH v1] tests: Added NSH related unit test cases for datapath

Ben Pfaff blp at ovn.org
Tue Apr 17 15:19:18 UTC 2018


On Mon, Apr 16, 2018 at 02:58:34PM -0700, Gregory Rose wrote:
> On 4/11/2018 11:13 AM, Ashish Varma wrote:
> >Sure, no problem.
> >
> >Thanks,
> >Ashish
> >
> >On Tue, Apr 10, 2018 at 5:00 PM, Gregory Rose <gvrose8192 at gmail.com
> ><mailto:gvrose8192 at gmail.com>> wrote:
> >
> >    On 4/6/2018 7:35 AM, Gregory Rose wrote:
> >
> >
> >
> >        On 4/4/2018 10:23 AM, Ben Pfaff wrote:
> >
> >            On Thu, Mar 29, 2018 at 04:46:09PM -0700, Ashish Varma wrote:
> >
> >                Added test cases for encap, decap, replace and
> >                forwarding of NSH packets.
> >                Also added a python script 'sendpkt.py' to send hex
> >                ethernet frames.
> >
> >                Signed-off-by: Ashish Varma <ashishvarma.ovs at gmail.com
> >                <mailto:ashishvarma.ovs at gmail.com>>
> >
> >            Ashish, do you have a suggestion who should review this? 
> >            Greg, are you
> >            the right person?
> >
> >        I can have a look at them now that I'm back but need to get
> >        caught up with some other issues first.
> >
> >
> >    Ashish,
> >
> >    I continue to be otherwise occupied so I'm sorry for the delay in
> >    reviewing your patch.  It is still on my radar!
> >
> >    Thanks,
> >
> >    - Greg
> >
> 
> Looks good - tests out alright to me:
> 
> set /bin/bash '../tests/system-kmod-testsuite' -C tests AUTOTEST_PATH='utilities:vswitchd:ovsdb:vtep:tests::/usr:ovn/controller-vtep:ovn/northd:ovn/utilities:ovn/controller'
> -k nsh -j1; \
> "$@" || (test X'' = Xyes && "$@" --recheck)
> ## ------------------------------ ##
> ## openvswitch 2.9.90 test suite. ##
> ## ------------------------------ ##
> 
> nsh-datapath
> 
>  91: nsh - encap header                              ok
>  92: nsh - decap header                              ok
>  93: nsh - replace header                            ok
>  94: nsh - forward                                   ok
> 
> ## ------------- ##
> ## Test results. ##
> ## ------------- ##
> 
> All 4 tests were successful.
> 
> And the script code looks fine to me as well.
> 
> Tested-by: Greg Rose <gvrose8192 at gmail.com>
> Reviewed-by: Greg Rose <gvrose8192 at gmail.com>

Thanks Greg and Ashish.

I folded in the following to make the build-time Python checking OK with
it (also fixed a spelling error "eode" => "code"), added Greg's tags,
and applied this to master.

Thanks again!

Ben

--8<--------------------------cut here-------------------------->8--

diff --git a/tests/sendpkt.py b/tests/sendpkt.py
index 6d16d0f45e9e..50a4795ebf34 100755
--- a/tests/sendpkt.py
+++ b/tests/sendpkt.py
@@ -26,7 +26,6 @@
 
 
 import socket
-import struct
 import sys
 from optparse import OptionParser
 
@@ -72,23 +71,23 @@ pkt = "".join(map(chr, hex_list))
 try:
     sockfd = socket.socket(socket.AF_PACKET, socket.SOCK_RAW)
 except socket.error as msg:
-    print 'unable to create socket! error eode: ' + str(msg[0]) + ' : '\
-                                                                    + msg[1]
+    print('unable to create socket! error code: ' + str(msg[0]) + ' : '
+                                                                    + msg[1])
     sys.exit(2)
 
 try:
     sockfd.bind((args[0], 0))
 except socket.error as msg:
-    print 'unable to bind socket! error eode: ' + str(msg[0]) + ' : '\
-                                                                    + msg[1]
+    print('unable to bind socket! error code: ' + str(msg[0]) + ' : '
+                                                                    + msg[1])
     sys.exit(2)
 
 try:
     sockfd.send(pkt)
 except socket.error as msg:
-    print 'unable to send packet! error eode: ' + str(msg[0]) + ' : '\
-                                                                    + msg[1]
+    print('unable to send packet! error code: ' + str(msg[0]) + ' : '
+                                                                    + msg[1])
     sys.exit(2)
 
-print 'send success!'
+print('send success!')
 sys.exit(0)


More information about the dev mailing list