summaryrefslogtreecommitdiff
path: root/tests/vlan-splinters.at
blob: 3cc6187b06d1b7076c7beffc7fd733fba9a846a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
AT_BANNER([VLAN splinters])

AT_SETUP([VLAN splinters])
OVS_VSWITCHD_START([], [], [=override])
ADD_OF_PORTS([br0], 1, 2, 3, 4)
AT_CHECK([ovs-vsctl \
  -- set Bridge br0 fail-mode=standalone flood_vlans=0,9,11,15 \
  -- set port br0 tag=0 \
  -- set port p1 trunks=0,9,11,15 \
  -- set interface p1 other-config:enable-vlan-splinters=true \
  -- set port p2 tag=9 \
  -- set port p3 tag=11 \
  -- set port p4 tag=15])

ovs-appctl dpif/show | sed -n '
s/\./_/g
s/^[[ 	]]*\([[^ 	]][[^ 	]]*\) [[0-9]]*\/\([[0-9]]*\).*/\1=\2/p
' > port-numbers
cat port-numbers
. ./port-numbers

for args in '9 p2' '11 p3' '15 p4'; do
    set $args
    vlan=$1
    eval access_port=\$$2
    eval splinter_port=\$p1_$vlan

    # Check that when a packet is received on $splinter_port, it is
    # treated as if it had been received on p1 in the correct VLAN.
    AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "in_port($splinter_port)"],
             [0], [stdout])
    AT_CHECK_UNQUOTED([sed -n '/^Flow/p; /^Datapath/p' stdout], [0], [dnl
Flow: metadata=0,in_port=$p1,dl_vlan=$vlan,dl_vlan_pcp=0,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,dl_type=0x05ff
Datapath actions: $access_port
])

    # Check that when an OpenFlow action sends a packet to p1 on
    # splintered VLAN $vlan, it is actually output to $splinter_port.
    AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "in_port($access_port)"],
             [0], [stdout])
    AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: $splinter_port
])
done

OVS_VSWITCHD_STOP
AT_CLEANUP