d58075cad0b467c11026db1a72dc67673212c52f
[netvirt.git] / openstack / net-virt / src / main / java / org / opendaylight / ovsdb / openstack / netvirt / api / BridgeConfigurationManager.java
1 /*
2  * Copyright (c) 2014, 2015 Red Hat, Inc. and others. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.ovsdb.openstack.netvirt.api;
10
11 import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork;
12 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
13
14 import java.util.List;
15
16 /**
17  * OpenStack Neutron with the Open vSwitch plugin relies on a typical bridge configuration that
18  * consists of br-int (Integration Bridge), br-net (Network bridge), br-ex (External bridge).
19  *
20  * This class ensures that the bridges on each {@link Node}
21  * are correctly configured for OpenStack Neutron
22  *
23  */
24 public interface BridgeConfigurationManager {
25
26     /**
27      * A helper function to get the UUID of a given Bridge
28      * @param node the {@link Node} where the bridge is configured
29      * @param bridgeName the name of the bridge
30      * @return the UUID of the bridge
31      */
32     String getBridgeUuid(Node node, String bridgeName);
33
34     /**
35      * Checks for the existence of the Integration Bridge on a given Node
36      * @param node the {@link Node} where the bridge should be configured
37      * @return True if the bridge exists, False if it does not
38      */
39     boolean isNodeNeutronReady(Node node);
40
41     /**
42      * Checks for the existence of the Network Bridge on a given Node
43      * @param node the {@link Node} where the bridge should be configured
44      * @return True if the bridge exists, False if it does not
45      */
46     boolean isNodeOverlayReady(Node node);
47
48     /**
49      * Checks for the existence of the Network Bridge on a given Node
50      * @param node the {@link Node} where the bridge should be configured
51      * @return True if the bridge exists, False if it does not
52      */
53
54     /**
55      * Checks that a Node is ready for a Tunnel Network Provider
56      * For OpenFlow 1.0 the Integration, Network Bridge and corresponding patch ports are required
57      * For OpenFlow 1.3 only the Integration Bridge is required
58      * @param bridgeNode the {@link Node} that represents bridge
59      * @param ovsdbNode the {@link Node} where the bridge is configured
60      * @return True or False
61      */
62     boolean isNodeTunnelReady(Node bridgeNode, Node ovsdbNode);
63
64     /* Determine if internal network is ready for vlan network types.
65      * - OF 1.0 requires br-int, br-net, a patch connecting them and
66      * physical device added to br-net.
67      * - OF 1.3 requires br-int and physical device added to br-int.
68      */
69
70     /**
71      * Checks that a Node is ready for a VLAN Network Provider for the given Network
72      * For OpenFlow 1.0 the Integration Bridge, Network Bridge, patch ports and a physical device connected to the
73      * Network Bridge are required.
74      * For OpenFlow 1.3 the Integration Bridge is required and must have a physical device connected.
75      * @param bridgeNode the {@link Node} that represents bridge
76      * @param ovsdbNode the {@link Node} where the bridge is configured
77      * @param network the {@link org.opendaylight.ovsdb.openstack.netvirt.translator}
78      * @return True or False
79      */
80     boolean isNodeVlanReady(Node bridgeNode, Node ovsdbNode, NeutronNetwork network);
81
82     /**
83      * A helper function to determine if a port exists on a given bridge
84      * @param node the {@link Node} where the bridge is configured
85      * @param portName the name of the port to search for
86      * @return True if the port exists, otherwise False
87      */
88     boolean isPortOnBridge(Node node, String portName);
89
90
91     /**
92      * Returns true if the bridges required for the provider network type are created
93      * If the bridges are not created, this method will attempt to create them
94      * @param node the {@link Node} to query
95      * @param network the {@link org.opendaylight.ovsdb.openstack.netvirt.translator}
96      * @return True or False
97      */
98     boolean createLocalNetwork(Node node, NeutronNetwork network);
99
100     /**
101      * Prepares the given Node for Neutron Networking by creating the Integration Bridge
102      * @param node the {@link Node} to prepare
103      */
104     void prepareNode(Node node);
105
106     /**
107      * Returns the physical interface mapped to the given neutron physical network.
108      * @param node the {@link Node} to query
109      * @param physicalNetwork neutron physical network
110      * @return name of the physical interface
111      */
112     String getPhysicalInterfaceName(Node node, String physicalNetwork);
113
114     /** Returns all physical interfaces configured in the bridge mapping
115      * Bridge mappings will be of the following format:
116      * @param node the {@link Node} to query
117      * @return a List in the format {eth1, eth2} given bridge_mappings=physnet1:eth1,physnet2:eth2
118      */
119     List<String> getAllPhysicalInterfaceNames(Node node);
120 }