X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fovs-vsctl.at;h=439bd2d33a6e20e84fcd8b20281c66f27783eb92;hb=a6e73618f53138eb6f55e2c66ff8c649794fd8dd;hp=6a1cc35677b91aacb6b3dea37e0abc6cf3e361e3;hpb=401d5a6d16438ceb2e09c19677b97504593b4b51;p=sliver-openvswitch.git diff --git a/tests/ovs-vsctl.at b/tests/ovs-vsctl.at index 6a1cc3567..439bd2d33 100644 --- a/tests/ovs-vsctl.at +++ b/tests/ovs-vsctl.at @@ -15,17 +15,17 @@ dnl RUN_OVS_VSCTL(COMMAND, ...) dnl dnl Executes each ovs-vsctl COMMAND. m4_define([RUN_OVS_VSCTL], - [m4_foreach([command], [$@], [ovs-vsctl --timeout=5 --no-wait -vreconnect:emer --db=unix:socket command + [m4_foreach([command], [$@], [ovs-vsctl --no-wait -vreconnect:emer --db=unix:socket command ])]) m4_define([RUN_OVS_VSCTL_ONELINE], - [m4_foreach([command], [$@], [ovs-vsctl --timeout=5 --no-wait -vreconnect:emer --db=unix:socket --oneline -- command + [m4_foreach([command], [$@], [ovs-vsctl --no-wait -vreconnect:emer --db=unix:socket --oneline -- command ])]) dnl RUN_OVS_VSCTL_TOGETHER(COMMAND, ...) dnl dnl Executes each ovs-vsctl COMMAND in a single run of ovs-vsctl. m4_define([RUN_OVS_VSCTL_TOGETHER], - [ovs-vsctl --timeout=5 --no-wait -vreconnect:emer --db=unix:socket --oneline dnl + [ovs-vsctl --no-wait -vreconnect:emer --db=unix:socket --oneline dnl m4_foreach([command], [$@], [ -- command])]) dnl CHECK_BRIDGES([BRIDGE, PARENT, VLAN], ...) @@ -139,6 +139,40 @@ m4_define([CHECK_IFACES], ], [], [OVS_VSCTL_CLEANUP])])]) +dnl ---------------------------------------------------------------------- +AT_BANNER([ovs-vsctl unit tests]) + +AT_SETUP([ovs-vsctl connection retry]) +OVS_RUNDIR=$PWD; export OVS_RUNDIR + +dnl Without --retry, there should be no retry for active connections. +AT_CHECK([ovs-vsctl --db=unix:foo --timeout=10 -vreconnect:emer -- init], + [1], [], [stderr]) +AT_CHECK([[sed 's/([^()]*)/(...reason...)/' stderr]], [0], + [ovs-vsctl: unix:foo: database connection failed (...reason...) +]) + +dnl With --retry, we should retry for active connections. +AT_CHECK( + [ovs-vsctl --db=unix:foo --timeout=1 --retry -vreconnect:emer -vPATTERN:console:'%c|%p|%m' -- init + echo $? > status], + [0], [], [stderr]) +AT_CHECK([grep -c 'terminating with signal' stderr], [0], [1 +]) +AT_CHECK([kill -l `cat status`], [0], [ALRM +]) + +dnl Without --retry, we should retry for passive connections. +AT_CHECK( + [ovs-vsctl --db=punix:foo --timeout=1 -vreconnect:emer -vPATTERN:console:'%c|%p|%m' -- init + echo $? > status], + [0], [], [stderr]) +AT_CHECK([grep -c 'terminating with signal' stderr], [0], [1 +]) +AT_CHECK([kill -l `cat status`], [0], [ALRM +]) +AT_CLEANUP + dnl ---------------------------------------------------------------------- AT_BANNER([ovs-vsctl unit tests -- real bridges]) @@ -587,7 +621,7 @@ cp stdout out1 AT_CHECK([RUN_OVS_VSCTL([list b], [get b br0 _uuid])], [0], [stdout], [], [OVS_VSCTL_CLEANUP]) cp stdout out2 -AT_CHECK([perl $srcdir/uuidfilt.pl out1 out2], [0], +AT_CHECK([${PERL} $srcdir/uuidfilt.pl out1 out2], [0], [[<0> _uuid : <0> @@ -598,6 +632,7 @@ external_ids : {} fail_mode : [] flood_vlans : [] flow_tables : {} +ipfix : [] mirrors : [] name : "br0" netflow : [] @@ -666,6 +701,18 @@ AT_CHECK([RUN_OVS_VSCTL_TOGETHER([destroy b br0], [0], [stdout], [], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([list b])], [0], [], [], [OVS_VSCTL_CLEANUP]) +AT_CHECK([RUN_OVS_VSCTL([--if-exists get b x datapath_id])], + [0], [], [], [OVS_VSCTL_CLEANUP]) +AT_CHECK([RUN_OVS_VSCTL([--if-exists list b x])], + [0], [], [], [OVS_VSCTL_CLEANUP]) +AT_CHECK([RUN_OVS_VSCTL([--if-exists set controller x connection_mode=standalone])], + [0], [], [], [OVS_VSCTL_CLEANUP]) +AT_CHECK( + [RUN_OVS_VSCTL([--if-exists remove netflow x targets '"1.2.3.4:567"'])], + [0], [], [], [OVS_VSCTL_CLEANUP]) +AT_CHECK( + [RUN_OVS_VSCTL([--if-exists clear netflow x targets])], + [0], [], [], [OVS_VSCTL_CLEANUP]) OVS_VSCTL_CLEANUP AT_CLEANUP @@ -696,7 +743,7 @@ AT_CHECK([ cp stdout netflow-uuid AT_CHECK([RUN_OVS_VSCTL([list netflow `cat netflow-uuid`])], [0], [stdout], [], [OVS_VSCTL_CLEANUP]) -AT_CHECK([perl $srcdir/uuidfilt.pl netflow-uuid stdout], [0], +AT_CHECK([${PERL} $srcdir/uuidfilt.pl netflow-uuid stdout], [0], [[<0> _uuid : <0> @@ -713,6 +760,9 @@ AT_CHECK([RUN_OVS_VSCTL([list interx x])], AT_CHECK([RUN_OVS_VSCTL([list b x])], [1], [], [ovs-vsctl: no row "x" in table Bridge ], [OVS_VSCTL_CLEANUP]) +AT_CHECK([RUN_OVS_VSCTL([get b x datapath_id])], + [1], [], [ovs-vsctl: no row "x" in table Bridge +], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([get b br0 d])], [1], [], [ovs-vsctl: Bridge contains more than one column whose name matches "d" ], [OVS_VSCTL_CLEANUP]) @@ -728,6 +778,9 @@ AT_CHECK([RUN_OVS_VSCTL([get b br0 datapath_id:y=z])], AT_CHECK([RUN_OVS_VSCTL([set b br0 'datapath_id:y>=z'])], [1], [], [ovs-vsctl: datapath_id:y>=z: argument does not end in "=" followed by a value. ], [OVS_VSCTL_CLEANUP]) +AT_CHECK([RUN_OVS_VSCTL([set controller x connection_mode=standalone])], + [1], [], [ovs-vsctl: no row "x" in table Controller +], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([wait-until b br0 datapath_id:y,z])], [1], [], [ovs-vsctl: datapath_id:y,z: argument does not end in "=", "!=", "<", ">", "<=", ">=", "{=}", "{!=}", "{<}", "{>}", "{<=}", or "{>=}" followed by a value. ], [OVS_VSCTL_CLEANUP]) @@ -758,13 +811,19 @@ AT_CHECK([RUN_OVS_VSCTL([add b br1 datapath_id x y])], AT_CHECK([RUN_OVS_VSCTL([remove netflow `cat netflow-uuid` targets '"1.2.3.4:567"'])], [1], [], [ovs-vsctl: "remove" operation would put 0 values in column targets of table NetFlow but the minimum number is 1 ], [OVS_VSCTL_CLEANUP]) +AT_CHECK([RUN_OVS_VSCTL([remove netflow x targets '"1.2.3.4:567"'])], + [1], [], [ovs-vsctl: no row "x" in table NetFlow +], [OVS_VSCTL_CLEANUP]) +AT_CHECK([RUN_OVS_VSCTL([clear netflow x targets])], + [1], [], [ovs-vsctl: no row "x" in table NetFlow +], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([clear netflow `cat netflow-uuid` targets])], [1], [], [ovs-vsctl: "clear" operation cannot be applied to column targets of table NetFlow, which is not allowed to be empty ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([destroy b br2])], [1], [], [ovs-vsctl: no row "br2" in table Bridge ], [OVS_VSCTL_CLEANUP]) -AT_CHECK([RUN_OVS_VSCTL([add i br1 name x])], +AT_CHECK([RUN_OVS_VSCTL([add in br1 name x])], [1], [], [ovs-vsctl: cannot modify read-only column name in table Interface ], [OVS_VSCTL_CLEANUP]) AT_CHECK([RUN_OVS_VSCTL([set port br1 name br2])], @@ -809,7 +868,7 @@ AT_CHECK( ]) m4_define([VSCTL_CHECK_FIND], - [AT_CHECK([echo `ovs-vsctl --bare --timeout=5 --no-wait -vreconnect:emer --db=unix:socket -- --columns=name find bridge '$1' | sort`], [0], [$2 + [AT_CHECK([echo `ovs-vsctl --bare --no-wait -vreconnect:emer --db=unix:socket -- --columns=name find bridge '$1' | sort`], [0], [$2 ])]) # Arithmetic relational operators without keys. @@ -981,7 +1040,7 @@ AT_CHECK( [--id=@m create mirror name=mymirror select-dst-port=@eth0 select-src-port=@eth0 output-port=@eth1])], [0], [stdout], [], [OVS_VSCTL_CLEANUP]) AT_CHECK( - [perl $srcdir/uuidfilt.pl stdout], [0], [dnl + [${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl @@ -995,7 +1054,7 @@ AT_CHECK( [list bridge br0])], [0], [stdout], [], [OVS_VSCTL_CLEANUP]) AT_CHECK( - [sed -n -e '/uuid/p' -e '/name/p' -e '/mirrors/p' -e '/select/p' -e '/output/p' < stdout | $srcdir/uuidfilt.pl], [0], [dnl + [sed -n -e '/uuid/p' -e '/name/p' -e '/mirrors/p' -e '/select/p' -e '/output/p' < stdout | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl [_uuid : <0> name : "eth0" _uuid : <1> @@ -1020,24 +1079,24 @@ AT_SETUP([unreferenced record warnings]) AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK( - [ovs-vsctl -vPATTERN:console:'%c|%p|%m' --timeout=5 --no-wait -vreconnect:emer --db=unix:socket \ - -- create Bridge name=br0 | $srcdir/uuidfilt.pl], + [ovs-vsctl -vPATTERN:console:'%c|%p|%m' --no-wait -vreconnect:emer --db=unix:socket \ + -- create Bridge name=br0 | ${PERL} $srcdir/uuidfilt.pl], [0], [<0> ], [vsctl|WARN|applying "create" command to table Bridge without --id option will have no effect ], [OVS_VSCTL_CLEANUP]) AT_CHECK( - [ovs-vsctl -vPATTERN:console:'%c|%p|%m' --timeout=5 --no-wait -vreconnect:emer --db=unix:socket \ - -- --id=@br0 create Bridge name=br0 | $srcdir/uuidfilt.pl], + [ovs-vsctl -vPATTERN:console:'%c|%p|%m' --no-wait -vreconnect:emer --db=unix:socket \ + -- --id=@br0 create Bridge name=br0 | ${PERL} $srcdir/uuidfilt.pl], [0], [<0> ], [vsctl|WARN|row id "@br0" was created but no reference to it was inserted, so it will not actually appear in the database ], [OVS_VSCTL_CLEANUP]) AT_CHECK( - [ovs-vsctl -vPATTERN:console:'%c|%p|%m' --timeout=5 --no-wait -vreconnect:emer --db=unix:socket \ + [ovs-vsctl -vPATTERN:console:'%c|%p|%m' --no-wait -vreconnect:emer --db=unix:socket \ -- --id=@eth0_iface create Interface name=eth0 \ -- --id=@eth0 create Port name=eth0 interfaces=@eth0_iface \ -- --id=@m0 create Mirror name=m0 output_port=@eth0 \ -- --id=@br0 create Bridge name=br0 mirrors=@m0 \ - -- set Open_vSwitch . bridges=@br0 | $srcdir/uuidfilt.pl], + -- set Open_vSwitch . bridges=@br0 | ${PERL} $srcdir/uuidfilt.pl], [0], [<0> <1> <2> @@ -1055,7 +1114,7 @@ AT_KEYWORDS([ovs-vsctl]) OVS_VSCTL_SETUP AT_CHECK([RUN_OVS_VSCTL([--id=@br0 create Bridge name=br0 -- add Open_vSwitch . bridges @br0 -- list b])], [0], [stdout], [], [OVS_VSCTL_CLEANUP]) -AT_CHECK([perl $srcdir/uuidfilt.pl stdout], [0], +AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [[<0> _uuid : <1> controller : [] @@ -1065,6 +1124,7 @@ external_ids : {} fail_mode : [] flood_vlans : [] flow_tables : {} +ipfix : [] mirrors : [] name : "br0" netflow : []