use of org.onosproject.openstacknode.api.Constants.INTEGRATION_BRIDGE in project onos by opennetworkinglab.
the class DefaultOpenstackNodeHandler method cleanPhysicalInterfaces.
private void cleanPhysicalInterfaces(OpenstackNode osNode) {
Device device = deviceService.getDevice(osNode.ovsdb());
BridgeConfig bridgeConfig = device.as(BridgeConfig.class);
Set<String> bridgeNames = bridgeConfig.getBridges().stream().map(BridgeDescription::name).collect(Collectors.toSet());
Set<String> phyNetworkNames = osNode.phyIntfs().stream().map(pi -> BRIDGE_PREFIX + pi.network()).collect(Collectors.toSet());
// we remove existing physical bridges and patch ports, if the physical
// bridges are not defined in openstack node
bridgeNames.forEach(brName -> {
if (!phyNetworkNames.contains(brName) && !brName.equals(INTEGRATION_BRIDGE)) {
removePhysicalPatchPorts(osNode, brName.substring(NETWORK_BEGIN));
removePhysicalBridge(osNode, brName.substring(NETWORK_BEGIN));
}
});
}
use of org.onosproject.openstacknode.api.Constants.INTEGRATION_BRIDGE in project onos by opennetworkinglab.
the class OpenstackRecoverPortsCommand method recoverOvsPort.
/**
* Recovers the openvswitch port from conf.db corruption.
*
* @param controller ovsdb controller
* @param ovsdbPort ovsdb port number
* @param node openstack node
* @param osPort an openstack port
* @param ovsPorts set of openvswitch ports
*
* @return a set of recovered port name
*/
private Set<String> recoverOvsPort(OvsdbController controller, int ovsdbPort, OpenstackNode node, Port osPort, List<org.onosproject.net.Port> ovsPorts) {
OvsdbClientService client = getOvsdbClient(node, ovsdbPort, controller);
if (client == null) {
return ImmutableSet.of();
}
Set<String> portNames = ovsPorts.stream().filter(ovsPort -> ovsPort.annotations() != null || ovsPort.annotations().keys().contains(PORT_NAME)).map(ovsPort -> ovsPort.annotations().value(PORT_NAME)).collect(Collectors.toSet());
String tapPort = ifaceNameFromOsPortId(osPort.getId());
Set<String> recoveredPortNames = Sets.newConcurrentHashSet();
if (!portNames.contains(tapPort)) {
Map<String, String> extIdMap = ImmutableMap.of(ATTACHED_MAC, osPort.getMacAddress(), IFACE_ID, osPort.getId(), IFACE_STATUS, StringUtils.lowerCase(osPort.getState().name()), VM_ID, osPort.getDeviceId());
OvsdbInterface ovsIface = OvsdbInterface.builder().name(tapPort).options(ImmutableMap.of()).data(ImmutableMap.of(EXTERNALIDS, extIdMap)).build();
client.createInterface(INTEGRATION_BRIDGE, ovsIface);
recoveredPortNames.add(tapPort);
}
return ImmutableSet.copyOf(recoveredPortNames);
}
Aggregations