forked from openvswitch/ovs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,001 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,11 +51,22 @@ ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */' | |
SUFFIXES = .in | ||
.in: | ||
$(PERL) $(srcdir)/soexpand.pl -I$(srcdir) < $< | \ | ||
sed -e 's,[@]LOGDIR[@],$(LOGDIR),g' \ | ||
sed \ | ||
-e 's,[@]PKIDIR[@],$(PKIDIR),g' \ | ||
-e 's,[@]LOGDIR[@],$(LOGDIR),g' \ | ||
-e 's,[@]PERL[@],$(PERL),g' \ | ||
-e 's,[@]PYTHON[@],$(PYTHON),g' \ | ||
-e 's,[@]RUNDIR[@],$(RUNDIR),g' \ | ||
-e 's,[@]VERSION[@],$(VERSION),g' \ | ||
-e 's,[@]localstatedir[@],$(localstatedir),g' \ | ||
-e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \ | ||
-e 's,[@]PERL[@],$(PERL),g' > $@ | ||
-e 's,[@]sysconfdir[@],$(sysconfdir),g' \ | ||
> [email protected] | ||
@if head -n 1 [email protected] | grep -q '#!'; then \ | ||
echo chmod +x [email protected]; \ | ||
chmod +x [email protected]; \ | ||
fi | ||
mv [email protected] $@ | ||
|
||
include lib/automake.mk | ||
include ofproto/automake.mk | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,257 @@ | ||
AT_BANNER([ovs-vsctl unit tests -- real bridges]) | ||
|
||
dnl RUN_OVS_VSCTL(COMMAND, ...) | ||
dnl | ||
dnl Executes each ovs-vsctl COMMAND on a file named "conf" in the | ||
dnl current directory. Creates "conf" if it does not already exist. | ||
m4_define([RUN_OVS_VSCTL], | ||
[: >> conf | ||
m4_foreach([command], [$@], [ovs-vsctl --no-reload --config=conf command | ||
])]) | ||
|
||
dnl CHECK_BRIDGES(BRIDGE, ...) | ||
dnl | ||
dnl Verifies that "ovs-vsctl list-br" prints the specified list of bridges, | ||
dnl which must be in alphabetical order. | ||
m4_define([CHECK_BRIDGES], | ||
[AT_CHECK( | ||
[RUN_OVS_VSCTL([list-br])], | ||
[0], | ||
[m4_foreach([port], [$@], [port | ||
])]) | ||
m4_foreach([port], [$@], [AT_CHECK([RUN_OVS_VSCTL([br-exists port])])]) | ||
AT_CHECK([RUN_OVS_VSCTL([br-exists nonexistent])], [2])]) | ||
|
||
dnl CHECK_PORTS(BRIDGE, PORT[, PORT...]) | ||
dnl | ||
dnl Verifies that "ovs-vsctl list-ports BRIDGE" prints the specified | ||
dnl list of ports, which must be in alphabetical order. Also checks | ||
dnl that "ovs-vsctl port-to-br" reports that each port is | ||
dnl in BRIDGE. | ||
m4_define([CHECK_PORTS], | ||
[AT_CHECK( | ||
[RUN_OVS_VSCTL([list-ports $1])], | ||
[0], | ||
[m4_foreach([port], m4_cdr($@), [port | ||
])]) | ||
AT_CHECK([RUN_OVS_VSCTL([port-to-br $1])], [1], [], [ovs-vsctl: no port named $1 | ||
]) | ||
m4_foreach( | ||
[port], m4_cdr($@), | ||
[AT_CHECK([RUN_OVS_VSCTL([[port-to-br] port])], [0], [$1 | ||
])])]) | ||
|
||
dnl CHECK_IFACES(BRIDGE, IFACE[, IFACE...]) | ||
dnl | ||
dnl Verifies that "ovs-vsctl list-ifaces BRIDGE" prints the specified | ||
dnl list of ifaces, which must be in alphabetical order. Also checks | ||
dnl that "ovs-vsctl iface-to-br" reports that each interface is | ||
dnl in BRIDGE. | ||
m4_define([CHECK_IFACES], | ||
[AT_CHECK( | ||
[RUN_OVS_VSCTL([list-ifaces $1])], | ||
[0], | ||
[m4_foreach([iface], m4_cdr($@), [iface | ||
])]) | ||
AT_CHECK([RUN_OVS_VSCTL([iface-to-br $1])], [1], [], [ovs-vsctl: no interface named $1 | ||
]) | ||
m4_foreach( | ||
[iface], m4_cdr($@), | ||
[AT_CHECK([RUN_OVS_VSCTL([[iface-to-br] iface])], [0], [$1 | ||
])])]) | ||
|
||
AT_SETUP([add-br a]) | ||
AT_KEYWORDS([ovs-vsctl]) | ||
AT_CHECK([RUN_OVS_VSCTL([add-br a])]) | ||
AT_CHECK([cat conf], [0], [dnl | ||
bridge.a.port=a | ||
]) | ||
CHECK_BRIDGES([a]) | ||
CHECK_PORTS([a]) | ||
CHECK_IFACES([a]) | ||
AT_CLEANUP | ||
|
||
AT_SETUP([add-br a, add-br b]) | ||
AT_KEYWORDS([ovs-vsctl]) | ||
AT_CHECK([RUN_OVS_VSCTL([add-br a], [add-br b])]) | ||
AT_CHECK([cat conf], [0], [dnl | ||
bridge.a.port=a | ||
bridge.b.port=b | ||
]) | ||
CHECK_BRIDGES([a], [b]) | ||
CHECK_PORTS([a]) | ||
CHECK_IFACES([a]) | ||
CHECK_PORTS([b]) | ||
CHECK_IFACES([b]) | ||
AT_CLEANUP | ||
|
||
AT_SETUP([add-br a, add-br b, del-br a]) | ||
AT_KEYWORDS([ovs-vsctl]) | ||
AT_CHECK([RUN_OVS_VSCTL([add-br a], [add-br b], [del-br a])]) | ||
AT_CHECK([cat conf], [0], [dnl | ||
bridge.b.port=b | ||
]) | ||
CHECK_BRIDGES([b]) | ||
CHECK_PORTS([b]) | ||
CHECK_IFACES([b]) | ||
AT_CLEANUP | ||
|
||
AT_SETUP([add-br a b, add-port a a1, add-port b b1, del-br a]) | ||
AT_KEYWORDS([ovs-vsctl]) | ||
AT_CHECK([RUN_OVS_VSCTL( | ||
[add-br a], | ||
[add-br b], | ||
[add-port a a1], | ||
[add-port b b1], | ||
[del-br a])]) | ||
AT_CHECK([cat conf], [0], | ||
[bridge.b.port=b | ||
bridge.b.port=b1 | ||
]) | ||
CHECK_BRIDGES([b]) | ||
CHECK_PORTS([b], [b1]) | ||
CHECK_IFACES([b], [b1]) | ||
AT_CLEANUP | ||
|
||
AT_SETUP([add-br a, add-bond a bond0 a1 a2 a3]) | ||
AT_KEYWORDS([ovs-vsctl]) | ||
AT_CHECK([RUN_OVS_VSCTL( | ||
[add-br a], | ||
[add-bond a bond0 a1 a2 a3])]) | ||
AT_CHECK([cat conf], [0], [dnl | ||
bonding.bond0.slave=a1 | ||
bonding.bond0.slave=a2 | ||
bonding.bond0.slave=a3 | ||
bridge.a.port=a | ||
bridge.a.port=bond0 | ||
]) | ||
CHECK_BRIDGES([a]) | ||
CHECK_PORTS([a], [bond0]) | ||
CHECK_IFACES([a], [a1], [a2], [a3]) | ||
AT_CLEANUP | ||
|
||
AT_SETUP([add-br a b, add-port a a1, add-port b b1, del-port a a1]) | ||
AT_KEYWORDS([ovs-vsctl]) | ||
AT_CHECK([RUN_OVS_VSCTL( | ||
[add-br a], | ||
[add-br b], | ||
[add-port a a1], | ||
[add-port b b1], | ||
[del-port a a1])]) | ||
AT_CHECK([cat conf], [0], [dnl | ||
bridge.a.port=a | ||
bridge.b.port=b | ||
bridge.b.port=b1 | ||
]) | ||
CHECK_BRIDGES([a], [b]) | ||
CHECK_PORTS([a]) | ||
CHECK_IFACES([a]) | ||
CHECK_PORTS([b], [b1]) | ||
CHECK_IFACES([b], [b1]) | ||
AT_CLEANUP | ||
|
||
AT_SETUP([add-br a, add-bond a bond0 a1 a2 a3, del-port a bond0]) | ||
AT_KEYWORDS([ovs-vsctl]) | ||
AT_CHECK([RUN_OVS_VSCTL( | ||
[add-br a], | ||
[add-bond a bond0 a1 a2 a3], | ||
[del-port a bond0])]) | ||
AT_CHECK([cat conf], [0], [dnl | ||
bridge.a.port=a | ||
]) | ||
CHECK_BRIDGES([a]) | ||
CHECK_PORTS([a]) | ||
AT_CLEANUP | ||
|
||
AT_BANNER([ovs-vsctl unit tests -- fake bridges]) | ||
|
||
m4_define([SIMPLE_FAKE_CONF], [dnl | ||
bridge.xenbr0.port=eth0 | ||
bridge.xenbr0.port=eth0.9 | ||
bridge.xenbr0.port=xapi1 | ||
bridge.xenbr0.port=xenbr0 | ||
iface.xapi1.fake-bridge=true | ||
iface.xapi1.internal=true | ||
vlan.eth0.9.tag=9 | ||
vlan.xapi1.tag=9 | ||
]) | ||
|
||
AT_SETUP([simple fake bridge]) | ||
AT_KEYWORDS([ovs-vsctl fake-bridge]) | ||
AT_CHECK([RUN_OVS_VSCTL( | ||
[add-br xenbr0], | ||
[add-port xenbr0 eth0], | ||
[add-br xapi1 xenbr0 9], | ||
[add-port xapi1 eth0.9])]) | ||
AT_CHECK([cat conf], [0], [SIMPLE_FAKE_CONF]) | ||
CHECK_BRIDGES([xenbr0], [xapi1]) | ||
CHECK_PORTS([xenbr0], [eth0]) | ||
CHECK_IFACES([xenbr0], [eth0]) | ||
CHECK_PORTS([xapi1], [eth0.9]) | ||
CHECK_IFACES([xapi1], [eth0.9]) | ||
AT_CLEANUP | ||
|
||
AT_SETUP([simple fake bridge + del-br fake bridge]) | ||
AT_KEYWORDS([ovs-vsctl fake-bridge]) | ||
AT_DATA([conf], [SIMPLE_FAKE_CONF]) | ||
AT_CHECK([RUN_OVS_VSCTL([del-br xapi1])]) | ||
AT_CHECK([cat conf], [0], [dnl | ||
bridge.xenbr0.port=eth0 | ||
bridge.xenbr0.port=xenbr0 | ||
]) | ||
CHECK_BRIDGES([xenbr0]) | ||
CHECK_PORTS([xenbr0], [eth0]) | ||
CHECK_IFACES([xenbr0], [eth0]) | ||
AT_CLEANUP | ||
|
||
AT_SETUP([simple fake bridge + del-br real bridge]) | ||
AT_KEYWORDS([ovs-vsctl fake-bridge]) | ||
AT_DATA([conf], [SIMPLE_FAKE_CONF]) | ||
AT_CHECK([RUN_OVS_VSCTL([del-br xenbr0])]) | ||
AT_CHECK([cat conf], [0], []) | ||
CHECK_BRIDGES | ||
AT_CLEANUP | ||
|
||
m4_define([BOND_FAKE_CONF], [dnl | ||
bonding.bond0.slave=eth0 | ||
bonding.bond0.slave=eth1 | ||
bridge.xapi1.port=bond0 | ||
bridge.xapi1.port=bond0.11 | ||
bridge.xapi1.port=xapi1 | ||
bridge.xapi1.port=xapi2 | ||
iface.xapi2.fake-bridge=true | ||
iface.xapi2.internal=true | ||
vlan.bond0.11.tag=11 | ||
vlan.xapi2.tag=11 | ||
]) | ||
|
||
AT_SETUP([fake bridge on bond]) | ||
AT_KEYWORDS([ovs-vsctl fake-bridge]) | ||
AT_CHECK([RUN_OVS_VSCTL( | ||
[add-br xapi1], | ||
[add-bond xapi1 bond0 eth0 eth1], | ||
[add-br xapi2 xapi1 11], | ||
[add-port xapi2 bond0.11])]) | ||
AT_CHECK([cat conf], [0], [BOND_FAKE_CONF]) | ||
CHECK_BRIDGES([xapi1], [xapi2]) | ||
CHECK_PORTS([xapi1], [bond0]) | ||
CHECK_IFACES([xapi1], [eth0], [eth1]) | ||
CHECK_PORTS([xapi2], [bond0.11]) | ||
CHECK_IFACES([xapi2], [bond0.11]) | ||
AT_CLEANUP | ||
|
||
AT_SETUP([fake bridge on bond + del-br fake bridge]) | ||
AT_KEYWORDS([ovs-vsctl fake-bridge]) | ||
AT_DATA([conf], [BOND_FAKE_CONF]) | ||
AT_CHECK([RUN_OVS_VSCTL([del-br xapi2])]) | ||
CHECK_BRIDGES([xapi1]) | ||
CHECK_PORTS([xapi1], [bond0]) | ||
CHECK_IFACES([xapi1], [eth0], [eth1]) | ||
AT_CLEANUP | ||
|
||
AT_SETUP([fake bridge on bond + del-br real bridge]) | ||
AT_KEYWORDS([ovs-vsctl fake-bridge]) | ||
AT_DATA([conf], [BOND_FAKE_CONF]) | ||
AT_CHECK([RUN_OVS_VSCTL([del-br xapi1])]) | ||
CHECK_BRIDGES | ||
AT_CLEANUP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.