* @return a List in the format {eth1, eth2} given bridge_mappings=physnet1:eth1,physnet2:eth2
*/
List<String> getAllPhysicalInterfaceNames(Node node);
+
+ /*
+ * Return br-ex interface configured in the bridge_mappings.
+ * Return null if br-ex is not configured in bridge_mappings.
+ * @param node the {@link Node} to query
+ * @param externalNetwork
+ * @return the interface as a string like eth3 given bridge_mappings=br-ex:eth3
+ */
+ String getExternalInterfaceName (Node node, String externalNetwork);
+
}
return isCreated;
}
+
+
+ @Override
+ public String getExternalInterfaceName (Node node, String extNetwork) {
+ String phyIf = null;
+ String providerMaps = southbound.getOtherConfig(node, OvsdbTables.OPENVSWITCH,
+ configurationService.getProviderMappingsKey());
+ if (providerMaps != null) {
+ for (String map : providerMaps.split(",")) {
+ String[] pair = map.split(":");
+ if (pair[0].equals(extNetwork)) {
+ phyIf = pair[1];
+ break;
+ }
+ }
+ }
+ if (phyIf == null) {
+ LOG.error("External interface not found for Node: {}, Network {}",
+ node, extNetwork);
+ }
+ else {
+ LOG.info("External interface found for Node: {}, Network {} is {}",node,extNetwork,phyIf);
+ }
+ return phyIf;
+ }
+
+
+
@Override
public String getPhysicalInterfaceName (Node node, String physicalNetwork) {
String phyIf = null;
LOG.error("Add Port {} to Bridge {} failed", portNameExt, brExt);
return false;
}
+ String extNetName = getExternalInterfaceName(extBridgeNode, brExt);
+ if ( extNetName != null) {
+ if (!addPortToBridge(extBridgeNode, brExt, extNetName)) {
+ LOG.error("Add External Port {} to Bridge {} failed", extNetName, brExt);
+ return false;
+ }
+ LOG.info("Add External Port {} to Ext Bridge {} success", extNetName, brExt);
+ }
}
-
/* For vlan network types add physical port to br-int. */
if (network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VLAN)) {
String phyNetName = this.getPhysicalInterfaceName(bridgeNode, network.getProviderPhysicalNetwork());
}
}
- LOG.debug("createBridges: node: {}, status: success", bridgeNode);
+ LOG.info("createBridges: node: {}, status: success", bridgeNode);
return true;
}