Skip to content

Commit

Permalink
system-common-macros: Add macros to add 802.1ad ports.
Browse files Browse the repository at this point in the history
Add macros ADD_SVLAN() and ADD_CVLAN().

Signed-off-by: Eric Garver <[email protected]>
Signed-off-by: Joe Stringer <[email protected]>
  • Loading branch information
erig0 authored and joestringer committed Oct 18, 2016
1 parent afa0dfc commit f3c6704
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion tests/system-common-macros.at
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,35 @@ m4_define([ADD_VETH_BOND],
# Add a VLAN device named 'port' within 'namespace'. It will be configured
# with the ID 'vlan-id' and the address 'ip-addr'.
m4_define([ADD_VLAN],
[ NS_CHECK_EXEC([$2], [ip link add link $1 name $1.$3 type vlan id $3])
[ NS_CHECK_EXEC([$2], [ip link add link $1 name $1.$3 type vlan proto 802.1q id $3])
NS_CHECK_EXEC([$2], [ip link set dev $1.$3 up])
NS_CHECK_EXEC([$2], [ip addr add dev $1.$3 $4])
]
)

# ADD_SVLAN([port], [namespace], [vlan-id], [ip-addr])
#
# Add a SVLAN device named 'port' within 'namespace'. It will be configured
# with the ID 'vlan-id' and the address 'ip-addr'.
m4_define([ADD_SVLAN],
[ NS_CHECK_EXEC([$2], [ip link add link $1 name $1.$3 type vlan proto 802.1ad id $3])
NS_CHECK_EXEC([$2], [ip link set dev $1.$3 up])
NS_CHECK_EXEC([$2], [ip addr add dev $1.$3 $4])
NS_CHECK_EXEC([$2], [ip link set $1.$3 mtu 1496])
]
)

# ADD_CVLAN([port], [namespace], [vlan-id], [ip-addr])
#
# Similar to ADD_VLAN(), but sets MTU. Lower MTU here instead of increase MTU
# on bridge/SVLAN because older kernels didn't work.
#
m4_define([ADD_CVLAN],
[ ADD_VLAN([$1], [$2], [$3], [$4])
NS_CHECK_EXEC([$2], [ip link set $1.$3 mtu 1492])
]
)

# ADD_OVS_TUNNEL([type], [bridge], [port], [remote-addr], [overlay-addr])
#
# Add an ovs-based tunnel device in the root namespace, with name 'port' and
Expand Down

0 comments on commit f3c6704

Please sign in to comment.