tests: Set enable-dummy=system for ovn-controller-vtep tests.
[cascardo/ovs.git] / tests / system-common-macros.at
index f0da589..fcd7792 100644 (file)
@@ -43,6 +43,18 @@ m4_define([NS_CHECK_EXEC],
 # appropriate type, and allows additional arguments to be passed.
 m4_define([ADD_BR], [ovs-vsctl _ADD_BR([$1]) -- $2])
 
+# ADD_INT([port], [namespace], [ovs-br], [ip_addr])
+#
+# Add an internal port to 'ovs-br', then shift it into 'namespace' and
+# configure it with 'ip_addr' (specified in CIDR notation).
+m4_define([ADD_INT],
+    [ AT_CHECK([ovs-vsctl add-port $3 $1 -- set int $1 type=internal])
+      AT_CHECK([ip link set $1 netns $2])
+      NS_CHECK_EXEC([$2], [ip addr add $4 dev $1])
+      NS_CHECK_EXEC([$2], [ip link set dev $1 up])
+    ]
+)
+
 # ADD_VETH([port], [namespace], [ovs-br], [ip_addr])
 #
 # Add a pair of veth ports. 'port' will be added to name space 'namespace',
@@ -119,15 +131,13 @@ m4_define([ADD_NATIVE_TUNNEL],
 #
 m4_define([FORMAT_PING], [grep "transmitted" | sed 's/time.*ms$/time 0ms/'])
 
-# FORMAT_CT()
+# FORMAT_CT([ip-addr])
 #
-# Strip content from the piped input which would differ from test to test.
+# Strip content from the piped input which would differ from test to test
+# and limit the output to the rows containing 'ip-addr'.
 #
 m4_define([FORMAT_CT],
-    [[grep "dst=$1" | sed -e 's/port=[0-9]*/port=<cleared>/g' -e 's/  */ /g' \
-                          -e 's/secctx[^ ]* //' \
-                          -e 's/id=[0-9]*/id=<cleared>/g' \
-                    | cut -d' ' -f4- | sort | uniq]])
+    [[grep "dst=$1" | sed -e 's/port=[0-9]*/port=<cleared>/g' -e 's/id=[0-9]*/id=<cleared>/g' | sort | uniq]])
 
 # NETNS_DAEMONIZE([namespace], [command], [pidfile])
 #
@@ -139,3 +149,9 @@ m4_define([NETNS_DAEMONIZE],
      echo "kill \`cat $3\`" >> cleanup
    ]
 )
+
+# OVS_CHECK_VXLAN()
+#
+# Do basic check for vxlan functionality, skip the test if it's not there.
+m4_define([OVS_CHECK_VXLAN],
+    [AT_SKIP_IF([! ip link add foo type vxlan help 2>&1 | grep dstport >/dev/null])])