2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

tests: Rewrite unit tests to not expect bridge with odp zero.

A future commit will make all bridges of a particular type share a
single backing datapath.  That backing datapath will have a datapath
port number of zero and bridges will be assigned other numbers.  This
commit modifies the tests so that they don't expect port zero.

It adopts the convention that bridges of type "dummy" with a name of the
form "br<n>" will be assigned a port number of 100+<n>.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
This commit is contained in:
Justin Pettit
2012-10-13 17:45:00 -07:00
parent e1b1d06afd
commit e44768b755
5 changed files with 171 additions and 139 deletions

View File

@@ -197,11 +197,51 @@ create_dpif_netdev(struct dp_netdev *dp)
return &dpif->dpif;
}
static int
choose_port(struct dp_netdev *dp, const char *name)
{
int port_no;
if (dp->class != &dpif_netdev_class) {
const char *p;
int start_no = 0;
/* If the port name begins with "br", start the number search at
* 100 to make writing tests easier. */
if (!strncmp(name, "br", 2)) {
start_no = 100;
}
/* If the port name contains a number, try to assign that port number.
* This can make writing unit tests easier because port numbers are
* predictable. */
for (p = name; *p != '\0'; p++) {
if (isdigit((unsigned char) *p)) {
port_no = start_no + strtol(p, NULL, 10);
if (port_no > 0 && port_no < MAX_PORTS
&& !dp->ports[port_no]) {
return port_no;
}
break;
}
}
}
for (port_no = 1; port_no < MAX_PORTS; port_no++) {
if (!dp->ports[port_no]) {
return port_no;
}
}
return -1;
}
static int
create_dp_netdev(const char *name, const struct dpif_class *class,
struct dp_netdev **dpp)
{
struct dp_netdev *dp;
int port_no;
int error;
int i;
@@ -214,7 +254,9 @@ create_dp_netdev(const char *name, const struct dpif_class *class,
}
hmap_init(&dp->flow_table);
list_init(&dp->port_list);
error = do_add_port(dp, name, "internal", OVSP_LOCAL);
port_no = !strncmp(name, "br", 2) ? choose_port(dp, name) : OVSP_LOCAL;
error = do_add_port(dp, name, "internal", port_no);
if (error) {
dp_netdev_free(dp);
return error;
@@ -370,39 +412,6 @@ do_add_port(struct dp_netdev *dp, const char *devname, const char *type,
return 0;
}
static int
choose_port(struct dpif *dpif, struct netdev *netdev)
{
struct dp_netdev *dp = get_dp_netdev(dpif);
int port_no;
if (dpif->dpif_class != &dpif_netdev_class) {
/* If the port name contains a number, try to assign that port number.
* This can make writing unit tests easier because port numbers are
* predictable. */
const char *p;
for (p = netdev_get_name(netdev); *p != '\0'; p++) {
if (isdigit((unsigned char) *p)) {
port_no = strtol(p, NULL, 10);
if (port_no > 0 && port_no < MAX_PORTS
&& !dp->ports[port_no]) {
return port_no;
}
break;
}
}
}
for (port_no = 0; port_no < MAX_PORTS; port_no++) {
if (!dp->ports[port_no]) {
return port_no;
}
}
return -1;
}
static int
dpif_netdev_port_add(struct dpif *dpif, struct netdev *netdev,
uint32_t *port_nop)
@@ -418,7 +427,7 @@ dpif_netdev_port_add(struct dpif *dpif, struct netdev *netdev,
}
port_no = *port_nop;
} else {
port_no = choose_port(dpif, netdev);
port_no = choose_port(dp, netdev_get_name(netdev));
}
if (port_no >= 0) {
*port_nop = port_no;

View File

@@ -61,9 +61,9 @@ AT_CLEANUP
AT_SETUP([learning action - standard VLAN+MAC learning])
OVS_VSWITCHD_START(
[add-port br0 eth0 -- set Interface eth0 type=dummy -- \
add-port br0 eth1 -- set Interface eth1 type=dummy -- \
add-port br0 eth2 -- set Interface eth2 type=dummy])
[add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2 -- \
add-port br0 p3 -- set Interface p3 type=dummy ofport_request=3])
# Set up flow table for VLAN+MAC learning.
AT_DATA([flows.txt], [[
table=0 actions=learn(table=1, hard_timeout=60, NXM_OF_VLAN_TCI[0..11], NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], output:NXM_OF_IN_PORT[]), resubmit(,1)
@@ -72,9 +72,14 @@ table=1 priority=0 actions=flood
AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
# Trace an ARP packet arriving on port 3, to create a MAC learning entry.
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=192.168.0.1,tip=192.168.0.2,op=1,sha=50:54:00:00:00:05,tha=00:00:00:00:00:00)' -generate], [0], [stdout])
AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2,0,1
])
flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=192.168.0.1,tip=192.168.0.2,op=1,sha=50:54:00:00:00:05,tha=00:00:00:00:00:00)"
AT_CHECK([ovs-appctl ofproto/trace br0 "$flow" -generate], [0], [stdout])
actual=`tail -1 stdout | sed 's/Datapath actions: //'`
expected="1,2,100"
AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
mv stdout expout
AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
# Check for the MAC learning entry.
AT_CHECK([ovs-ofctl dump-flows br0 table=1 | ofctl_strip | sort], [0], [dnl
@@ -98,9 +103,14 @@ NXST_FLOW reply:
])
# Trace a packet arrival that updates the first learned MAC entry.
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=192.168.0.1,tip=192.168.0.2,op=1,sha=50:54:00:00:00:05,tha=00:00:00:00:00:00)' -generate], [0], [stdout])
AT_CHECK([tail -1 stdout], [0], [Datapath actions: 3,0,1
])
flow="in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=192.168.0.1,tip=192.168.0.2,op=1,sha=50:54:00:00:00:05,tha=00:00:00:00:00:00)"
AT_CHECK([ovs-appctl ofproto/trace br0 "$flow" -generate], [0], [stdout])
actual=`tail -1 stdout | sed 's/Datapath actions: //'`
expected="1,3,100"
AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
mv stdout expout
AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
# Check that the MAC learning entry was updated.
AT_CHECK([ovs-ofctl dump-flows br0 table=1 | ofctl_strip | sort], [0], [dnl
@@ -114,16 +124,21 @@ AT_CLEANUP
AT_SETUP([learning action - TCPv4 port learning])
OVS_VSWITCHD_START(
[add-port br0 eth0 -- set Interface eth0 type=dummy -- \
add-port br0 eth1 -- set Interface eth1 type=dummy -- \
add-port br0 eth2 -- set Interface eth2 type=dummy])
[add-port br0 p1 -- set Interface p1 type=dummy -- \
add-port br0 p2 -- set Interface p2 type=dummy -- \
add-port br0 p3 -- set Interface p3 type=dummy])
# Set up flow table for TCPv4 port learning.
AT_CHECK([[ovs-ofctl add-flow br0 'table=0 tcp actions=learn(table=1, hard_timeout=60, eth_type=0x800, nw_proto=6, NXM_OF_IP_SRC[]=NXM_OF_IP_DST[], NXM_OF_IP_DST[]=NXM_OF_IP_SRC[], NXM_OF_TCP_SRC[]=NXM_OF_TCP_DST[], NXM_OF_TCP_DST[]=NXM_OF_TCP_SRC[]), flood']])
# Trace a TCPv4 packet arriving on port 3.
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(3),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:06),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=40000,dst=80)' -generate], [0], [stdout])
AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2,0,1
])
flow="in_port(3),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:06),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=40000,dst=80)"
AT_CHECK([ovs-appctl ofproto/trace br0 "$flow" -generate], [0], [stdout])
actual=`tail -1 stdout | sed 's/Datapath actions: //'`
expected="1,2,100"
AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
mv stdout expout
AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
# Check for the learning entry.
AT_CHECK([ovs-ofctl dump-flows br0 table=1 | ofctl_strip | sort], [0], [dnl
@@ -135,18 +150,23 @@ AT_CLEANUP
AT_SETUP([learning action - TCPv6 port learning])
OVS_VSWITCHD_START(
[add-port br0 eth0 -- set Interface eth0 type=dummy -- \
add-port br0 eth1 -- set Interface eth1 type=dummy -- \
add-port br0 eth2 -- set Interface eth2 type=dummy])
[add-port br0 p1 -- set Interface p1 type=dummy -- \
add-port br0 p2 -- set Interface p2 type=dummy -- \
add-port br0 p3 -- set Interface p3 type=dummy])
# Set up flow table for TCPv6 port learning.
# Also add a 128-bit-wide "load" action and a 128-bit literal match to check
# that they work.
AT_CHECK([[ovs-ofctl add-flow br0 'table=0 tcp6 actions=learn(table=1, hard_timeout=60, eth_type=0x86dd, nw_proto=6, NXM_NX_IPV6_SRC[]=NXM_NX_IPV6_DST[], ipv6_dst=2001:0db8:85a3:0000:0000:8a2e:0370:7334, NXM_OF_TCP_SRC[]=NXM_OF_TCP_DST[], NXM_OF_TCP_DST[]=NXM_OF_TCP_SRC[], load(0x20010db885a308d313198a2e03707348->NXM_NX_IPV6_DST[])), flood']])
# Trace a TCPv6 packet arriving on port 3.
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(3),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:06),eth_type(0x86dd),ipv6(src=fec0::2,dst=fec0::1,label=0,proto=6,tclass=0,hlimit=255,frag=no),tcp(src=40000,dst=80)' -generate], [0], [stdout])
AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2,0,1
])
flow="in_port(3),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:06),eth_type(0x86dd),ipv6(src=fec0::2,dst=fec0::1,label=0,proto=6,tclass=0,hlimit=255,frag=no),tcp(src=40000,dst=80)"
AT_CHECK([ovs-appctl ofproto/trace br0 "$flow" -generate], [0], [stdout])
actual=`tail -1 stdout | sed 's/Datapath actions: //'`
expected="1,2,100"
AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
mv stdout expout
AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
# Check for the learning entry.
AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl

View File

@@ -110,9 +110,8 @@ AT_CLEANUP
AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port])
OVS_VSWITCHD_START(
[add-port br0 p1 -- set Interface p1 type=dummy --\
add-port br0 p2 -- set Interface p2 type=dummy])
OVS_VSWITCHD_START
ADD_OF_PORTS([br0], [1], [2])
AT_CHECK([ovs-ofctl add-flow br0 action=normal])
@@ -121,7 +120,7 @@ flow="eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src
AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
actual=`tail -1 stdout | sed 's/Datapath actions: //'`
expected="0,1,2"
expected="1,2,100"
AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
mv stdout expout
AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
@@ -143,14 +142,14 @@ AT_CHECK([ovs-vsctl -- \
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(9),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0xff,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
AT_CHECK([tail -1 stdout], [0],
[Datapath actions: dnl
0,dnl
100,dnl
set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0x7,ttl=128,frag=no)),set(priority(1)),1,dnl
set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0xb,ttl=128,frag=no)),set(priority(2)),1,dnl
1,dnl
set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0x7,ttl=128,frag=no)),set(priority(1)),1,dnl
set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0xff,ttl=128,frag=no)),set(priority(0)),1,dnl
set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0x3,ttl=128,frag=no)),1,dnl
0
100
])
OVS_VSWITCHD_STOP
AT_CLEANUP
@@ -170,7 +169,7 @@ AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
AT_CHECK([ovs-ofctl mod-port br0 6 noflood])
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(0),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(100),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
AT_CHECK([tail -1 stdout \
| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
1
@@ -183,7 +182,7 @@ AT_CHECK([tail -1 stdout \
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(1),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
AT_CHECK([tail -1 stdout \
| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
0
100
2
3
4
@@ -193,8 +192,8 @@ AT_CHECK([tail -1 stdout \
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(2),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
AT_CHECK([tail -1 stdout \
| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
0
1
100
3
4
6
@@ -203,12 +202,12 @@ AT_CHECK([tail -1 stdout \
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(3),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
AT_CHECK([tail -1 stdout], [0],
[Datapath actions: 0,1,2,4,6,7
[Datapath actions: 100,1,2,4,6,7
])
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(4),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
AT_CHECK([tail -1 stdout], [0],
[Datapath actions: set(priority(1)),0,1,2,set(priority(2)),3,set(priority(1)),6,7
[Datapath actions: set(priority(1)),100,1,2,set(priority(2)),3,set(priority(1)),6,7
])
OVS_VSWITCHD_STOP
AT_CLEANUP
@@ -427,87 +426,87 @@ dnl Each of these specifies an in_port by number, a VLAN VID (or "none"),
dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath
dnl actions.
for tuple in \
"0 none 0 drop" \
"0 0 0 drop" \
"0 0 1 drop" \
"0 10 0 1,5,6,7,8,pop_vlan,2" \
"0 10 1 1,5,6,7,8,pop_vlan,2" \
"0 11 0 5,7" \
"0 11 1 5,7" \
"0 12 0 1,5,6,pop_vlan,3,4,7,8" \
"0 12 1 1,5,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
"100 none 0 drop" \
"100 0 0 drop" \
"100 0 1 drop" \
"100 10 0 1,5,6,7,8,pop_vlan,2" \
"100 10 1 1,5,6,7,8,pop_vlan,2" \
"100 11 0 5,7" \
"100 11 1 5,7" \
"100 12 0 1,5,6,pop_vlan,3,4,7,8" \
"100 12 1 1,5,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
"1 none 0 drop" \
"1 0 0 drop" \
"1 0 1 drop" \
"1 10 0 0,5,6,7,8,pop_vlan,2" \
"1 10 1 0,5,6,7,8,pop_vlan,2" \
"1 10 0 5,6,7,8,100,pop_vlan,2" \
"1 10 1 5,6,7,8,100,pop_vlan,2" \
"1 11 0 drop" \
"1 11 1 drop" \
"1 12 0 0,5,6,pop_vlan,3,4,7,8" \
"1 12 1 0,5,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
"2 none 0 push_vlan(vid=10,pcp=0),0,1,5,6,7,8" \
"2 0 0 pop_vlan,push_vlan(vid=10,pcp=0),0,1,5,6,7,8" \
"2 0 1 pop_vlan,push_vlan(vid=10,pcp=1),0,1,5,6,7,8" \
"1 12 0 5,6,100,pop_vlan,3,4,7,8" \
"1 12 1 5,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
"2 none 0 push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
"2 0 0 pop_vlan,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
"2 0 1 pop_vlan,push_vlan(vid=10,pcp=1),1,5,6,7,8,100" \
"2 10 0 drop" \
"2 10 1 drop" \
"2 11 0 drop" \
"2 11 1 drop" \
"2 12 0 drop" \
"2 12 1 drop" \
"3 none 0 4,7,8,push_vlan(vid=12,pcp=0),0,1,5,6" \
"3 0 0 pop_vlan,4,7,8,push_vlan(vid=12,pcp=0),0,1,5,6" \
"3 0 1 8,pop_vlan,4,7,push_vlan(vid=12,pcp=1),0,1,5,6" \
"3 none 0 4,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
"3 0 0 pop_vlan,4,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
"3 0 1 8,pop_vlan,4,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
"3 10 0 drop" \
"3 10 1 drop" \
"3 11 0 drop" \
"3 11 1 drop" \
"3 12 0 drop" \
"3 12 1 drop" \
"4 none 0 3,7,8,push_vlan(vid=12,pcp=0),0,1,5,6" \
"4 0 0 pop_vlan,3,7,8,push_vlan(vid=12,pcp=0),0,1,5,6" \
"4 0 1 3,8,pop_vlan,7,push_vlan(vid=12,pcp=1),0,1,5,6" \
"4 none 0 3,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
"4 0 0 pop_vlan,3,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
"4 0 1 3,8,pop_vlan,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
"4 10 0 drop" \
"4 10 1 drop" \
"4 11 0 drop" \
"4 11 1 drop" \
"4 12 0 drop" \
"4 12 1 drop" \
"5 none 0 2,push_vlan(vid=10,pcp=0),0,1,6,7,8" \
"5 0 0 pop_vlan,2,push_vlan(vid=10,pcp=0),0,1,6,7,8" \
"5 0 1 pop_vlan,2,push_vlan(vid=10,pcp=1),0,1,6,7,8" \
"5 10 0 0,1,6,7,8,pop_vlan,2" \
"5 10 1 0,1,6,7,8,pop_vlan,2" \
"5 11 0 0,7" \
"5 11 1 0,7" \
"5 12 0 0,1,6,pop_vlan,3,4,7,8" \
"5 12 1 0,1,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
"6 none 0 2,push_vlan(vid=10,pcp=0),0,1,5,7,8" \
"6 0 0 pop_vlan,2,push_vlan(vid=10,pcp=0),0,1,5,7,8" \
"6 0 1 pop_vlan,2,push_vlan(vid=10,pcp=1),0,1,5,7,8" \
"6 10 0 0,1,5,7,8,pop_vlan,2" \
"6 10 1 0,1,5,7,8,pop_vlan,2" \
"5 none 0 2,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
"5 0 0 pop_vlan,2,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
"5 0 1 pop_vlan,2,push_vlan(vid=10,pcp=1),1,6,7,8,100" \
"5 10 0 1,6,7,8,100,pop_vlan,2" \
"5 10 1 1,6,7,8,100,pop_vlan,2" \
"5 11 0 7,100" \
"5 11 1 7,100" \
"5 12 0 1,6,100,pop_vlan,3,4,7,8" \
"5 12 1 1,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
"6 none 0 2,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
"6 0 0 pop_vlan,2,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
"6 0 1 pop_vlan,2,push_vlan(vid=10,pcp=1),1,5,7,8,100" \
"6 10 0 1,5,7,8,100,pop_vlan,2" \
"6 10 1 1,5,7,8,100,pop_vlan,2" \
"6 11 0 drop" \
"6 11 1 drop" \
"6 12 0 0,1,5,pop_vlan,3,4,7,8" \
"6 12 1 0,1,5,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
"7 none 0 3,4,8,push_vlan(vid=12,pcp=0),0,1,5,6" \
"7 0 0 pop_vlan,3,4,8,push_vlan(vid=12,pcp=0),0,1,5,6" \
"7 0 1 3,8,pop_vlan,4,push_vlan(vid=12,pcp=1),0,1,5,6" \
"7 10 0 0,1,5,6,8,pop_vlan,2" \
"7 10 1 0,1,5,6,8,pop_vlan,2" \
"7 11 0 0,5" \
"7 11 1 0,5" \
"7 12 0 0,1,5,6,pop_vlan,3,4,8" \
"7 12 1 0,1,5,6,pop_vlan,4,push_vlan(vid=0,pcp=1),3,8" \
"8 none 0 3,4,7,push_vlan(vid=12,pcp=0),0,1,5,6" \
"8 0 0 pop_vlan,3,4,7,push_vlan(vid=12,pcp=0),0,1,5,6" \
"8 0 1 3,pop_vlan,4,7,push_vlan(vid=12,pcp=1),0,1,5,6" \
"8 10 0 0,1,5,6,7,pop_vlan,2" \
"8 10 1 0,1,5,6,7,pop_vlan,2" \
"6 12 0 1,5,100,pop_vlan,3,4,7,8" \
"6 12 1 1,5,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
"7 none 0 3,4,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
"7 0 0 pop_vlan,3,4,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
"7 0 1 3,8,pop_vlan,4,push_vlan(vid=12,pcp=1),1,5,6,100" \
"7 10 0 1,5,6,8,100,pop_vlan,2" \
"7 10 1 1,5,6,8,100,pop_vlan,2" \
"7 11 0 5,100" \
"7 11 1 5,100" \
"7 12 0 1,5,6,100,pop_vlan,3,4,8" \
"7 12 1 1,5,6,100,pop_vlan,4,push_vlan(vid=0,pcp=1),3,8" \
"8 none 0 3,4,7,push_vlan(vid=12,pcp=0),1,5,6,100" \
"8 0 0 pop_vlan,3,4,7,push_vlan(vid=12,pcp=0),1,5,6,100" \
"8 0 1 3,pop_vlan,4,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
"8 10 0 1,5,6,7,100,pop_vlan,2" \
"8 10 1 1,5,6,7,100,pop_vlan,2" \
"8 11 0 drop" \
"8 11 1 drop" \
"8 12 0 0,1,5,6,pop_vlan,3,4,7" \
"8 12 1 0,1,5,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3"
"8 12 0 1,5,6,100,pop_vlan,3,4,7" \
"8 12 1 1,5,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3"
do
set $tuple
in_port=$1
@@ -690,9 +689,9 @@ AT_CLEANUP
AT_SETUP([ofproto-dpif - mirroring, select_dst])
OVS_VSWITCHD_START(
[add-port br0 p1 -- set Interface p1 type=dummy --\
add-port br0 p2 -- set Interface p2 type=dummy --\
add-port br0 p3 -- set Interface p3 type=dummy --\
[add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 --\
add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2 --\
add-port br0 p3 -- set Interface p3 type=dummy ofport_request=3 --\
set Bridge br0 mirrors=@m --\
--id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
--id=@m create Mirror name=mymirror \
@@ -810,7 +809,7 @@ flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x080
AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
actual=`tail -1 stdout | sed 's/Datapath actions: //'`
expected="2,push_vlan(vid=12,pcp=0),0,1,2"
expected="2,push_vlan(vid=12,pcp=0),1,2,100"
AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
mv stdout expout
AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
@@ -819,7 +818,7 @@ flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x080
AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
actual=`tail -1 stdout | sed 's/Datapath actions: //'`
expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),0,1,2"
expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
mv stdout expout
AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
@@ -852,7 +851,7 @@ OFPROTO_TRACE(
[br0],
[in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
[-generate],
[0,1,2])
[1,2,100])
# Check for the MAC learning entry.
AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
@@ -880,7 +879,7 @@ OFPROTO_TRACE(
[br0],
[in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
[-generate],
[0,1,3])
[1,3,100])
# Check that the MAC learning entry was updated.
AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
@@ -902,12 +901,12 @@ OFPROTO_TRACE(
[br1],
[in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
[-generate],
[0,5])
[5,101])
OFPROTO_TRACE(
[br1],
[in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
[-generate],
[0,4])
[4,101])
# Check that the MAC learning entries were added.
AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl

View File

@@ -28,25 +28,29 @@ OVS_VSWITCHD_START(
[add-port br0 p1 -- set Interface p1 type=dummy --\
add-port br0 p2 -- set Interface p2 type=dummy ofport_request=99])
AT_CHECK([ovs-ofctl -vwarn show br0], [0], [stdout])
AT_CHECK([STRIP_XIDS stdout], [0], [dnl
AT_CHECK([[sed '
s/ (xid=0x[0-9a-fA-F]*)//
s/00:0.$/00:0x/' < stdout]],
[0], [dnl
OFPT_FEATURES_REPLY: dpid:fedcba9876543210
n_tables:255, n_buffers:256
capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE
1(p1): addr:aa:55:aa:55:00:01
1(p1): addr:aa:55:aa:55:00:0x
config: PORT_DOWN
state: LINK_DOWN
speed: 100 Mbps now, 100 Mbps max
99(p2): addr:aa:55:aa:55:00:02
99(p2): addr:aa:55:aa:55:00:0x
config: PORT_DOWN
state: LINK_DOWN
speed: 100 Mbps now, 100 Mbps max
LOCAL(br0): addr:aa:55:aa:55:00:00
LOCAL(br0): addr:aa:55:aa:55:00:0x
config: PORT_DOWN
state: LINK_DOWN
speed: 100 Mbps now, 100 Mbps max
OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
])
OVS_VSWITCHD_STOP
AT_CLEANUP