@@ -56,7 +56,7 @@ m4_define([ADD_INT],
]
)
-# ADD_VETH([port], [namespace], [ovs-br], [ip_addr])
+# ADD_VETH([port], [namespace], [ovs-br], [ip_addr] [mac_addr [gateway]])
#
# Add a pair of veth ports. 'port' will be added to name space 'namespace',
# and "ovs-'port'" will be added to ovs bridge 'ovs-br'.
@@ -64,6 +64,9 @@ m4_define([ADD_INT],
# The 'port' in 'namespace' will be brought up with static IP address
# with 'ip_addr' in CIDR notation.
#
+# Optionally, one can specify the 'mac_addr' for 'port' and the default
+# 'gateway'.
+#
# The existing 'port' or 'ovs-port' will be removed before new ones are added.
#
m4_define([ADD_VETH],
@@ -74,6 +77,12 @@ m4_define([ADD_VETH],
AT_CHECK([ovs-vsctl add-port $3 ovs-$1])
NS_CHECK_EXEC([$2], [ip addr add $4 dev $1])
NS_CHECK_EXEC([$2], [ip link set dev $1 up])
+ if test -n "$5"; then
+ NS_CHECK_EXEC([$2], [ip link set dev $1 address $5])
+ fi
+ if test -n "$6"; then
+ NS_CHECK_EXEC([$2], [ip route add default via $6])
+ fi
on_exit 'ip link del ovs-$1'
]
)
It is useful to set the mac address and gateway while using ADD_VETH to connect a namespace to a OVN logical topology. Upcoming commits use this enhancement. Signed-off-by: Gurucharan Shetty <guru@ovn.org> --- tests/system-common-macros.at | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)