ovn: Add VLAN support for localnet ports.
authorRussell Bryant <rbryant@redhat.com>
Thu, 1 Oct 2015 18:26:25 +0000 (14:26 -0400)
committerBen Pfaff <blp@nicira.com>
Fri, 2 Oct 2015 14:53:49 +0000 (07:53 -0700)
commit779e72cc57a106251cc9e6696e8c9aabb56d30b5
tree0842b502c5379208242027e6579f0a797d2df278
parent2ff63ae014f8fcc7bc86d1f4fb037ccb25d77c30
ovn: Add VLAN support for localnet ports.

This patch makes it possible use a localnet port for connecting to a
specific VLAN on a locally accessible network.  The only logical
modeling change is that it is now valid to set the "tag" field on
logical ports with a type of "localnet".  Previously, the "tag" field
was only use for child ports.

We still use a single automatically created patch port between br-int
and the bridge configured to provide connectivity to a given network
(the ovn-controller bridge-mappings configuration).  We use flows when
necessary to either match on VLAN ID or to add the VLAN ID before
sending the packet out.

Matching for a localnet port with a VLAN ID is done at priority 150 in
table 0, and is similar to how we match traffic from container child
ports.  These cases are conceptually similar in that they're separate
logical ports on the same physical port.

Most of the code changes are due to a change in data structures.  We
have to keep track of all of the localnet ports and then add flows for
them at the end.  Previously this code tracked them as:

    hash of localnet bindings, hased on network name

    localnet bindings:
        openflow port number
        list of port bindings

Now we have:

    hash of localnet bindings, hased on network name

    localnet bindings:
        openflow port number
        hash of localnet vlans

    localnet vlans:
        VLAN ID (0 for untagged traffic)
        list of port bindings

A detailed example of using localnet ports with a VLAN ID is provided in
a later patch as a part of a larger OVN tutorial.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ovn/controller/physical.c
ovn/ovn-nb.xml
ovn/ovn-sb.xml