Merge "Removed the tunnelEndpoint cache Tunnel Endpoint address is now pulled directl...
[netvirt.git] / neutron / src / main / java / org / opendaylight / ovsdb / neutron / InternalNetworkManager.java
index aced03c4b3563cfd11eb96157131b9f9297a6f93..a1e128b65ea291c4355e461d3b48ee03ca49b0a0 100644 (file)
@@ -112,8 +112,10 @@ public class InternalNetworkManager {
 
         Status status = this.addInternalBridge(node, brInt, patchTun, patchInt);
         if (!status.isSuccess()) logger.debug("Integration Bridge Creation Status : "+status.toString());
-        status = this.addInternalBridge(node, brTun, patchInt, patchTun);
-        if (!status.isSuccess()) logger.debug("Tunnel Bridge Creation Status : "+status.toString());
+        if (ProviderNetworkManager.getManager().hasPerTenantTunneling()) {
+            status = this.addInternalBridge(node, brTun, patchInt, patchTun);
+            if (!status.isSuccess()) logger.debug("Tunnel Bridge Creation Status : "+status.toString());
+        }
     }
 
     /*
@@ -135,8 +137,20 @@ public class InternalNetworkManager {
         OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
 
         String bridgeUUID = this.getInternalBridgeUUID(node, bridgeName);
+        Bridge bridge = new Bridge();
+        OvsDBSet<String> failMode = new OvsDBSet<String>();
+        failMode.add("secure");
+        bridge.setFail_mode(failMode);
+
+        OvsDBSet<String> protocols = new OvsDBSet<String>();
+        if (!ProviderNetworkManager.getManager().hasPerTenantTunneling()) {
+            protocols.add("OpenFlow13");
+        } else {
+            protocols.add("OpenFlow10");
+        }
+        bridge.setProtocols(protocols);
+
         if (bridgeUUID == null) {
-            Bridge bridge = new Bridge();
             bridge.setName(bridgeName);
 
             StatusWithUuid statusWithUuid = ovsdbTable.insertRow(node, Bridge.NAME.getName(), null, bridge);
@@ -145,12 +159,14 @@ public class InternalNetworkManager {
             Port port = new Port();
             port.setName(bridgeName);
             ovsdbTable.insertRow(node, Port.NAME.getName(), bridgeUUID, port);
+        } else {
+            ovsdbTable.updateRow(node, Bridge.NAME.getName(), null, bridgeUUID, bridge);
         }
 
         IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
         connectionService.setOFController(node, bridgeUUID);
 
-        if (localPathName != null && remotePatchName != null) {
+        if (localPathName != null && remotePatchName != null && ProviderNetworkManager.getManager().hasPerTenantTunneling()) {
             return addPatchPort(node, bridgeUUID, localPathName, remotePatchName);
         }
         return new Status(StatusCode.SUCCESS);