use of org.onosproject.net.behaviour.BridgeDescription 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.net.behaviour.BridgeDescription in project onos by opennetworkinglab.
the class DefaultKubevirtNodeHandler method cleanPhysicalInterfaces.
private void cleanPhysicalInterfaces(KubevirtNode node) {
Device device = deviceService.getDevice(node.ovsdb());
BridgeConfig bridgeConfig = device.as(BridgeConfig.class);
Set<String> bridgeNames = bridgeConfig.getBridges().stream().map(BridgeDescription::name).collect(Collectors.toSet());
Set<String> phyNetworkNames = node.phyIntfs().stream().map(pi -> BRIDGE_PREFIX + pi.network()).collect(Collectors.toSet());
// bridges are not defined in kubevirt node
for (String brName : bridgeNames) {
// physical bridges
if (brName.equals(INTEGRATION_BRIDGE) || brName.equals(TUNNEL_BRIDGE) || brName.startsWith(TENANT_BRIDGE_PREFIX)) {
continue;
}
if (!phyNetworkNames.contains(brName)) {
removePhysicalPatchPorts(node, brName.substring(NETWORK_BEGIN));
removePhysicalBridge(node, brName.substring(NETWORK_BEGIN));
log.info("Removing physical bridge {}...", brName);
}
}
}
use of org.onosproject.net.behaviour.BridgeDescription in project onos by opennetworkinglab.
the class OvsdbBridgeConfig method getBridges.
@Override
public Collection<BridgeDescription> getBridges() {
OvsdbClientService client = getOvsdbClientService(handler());
if (client == null) {
return Collections.emptyList();
}
Set<OvsdbBridge> bridges = client.getBridges();
return bridges.stream().map(bridge -> DefaultBridgeDescription.builder().name(bridge.name()).datapathId(bridge.datapathId().get()).build()).collect(Collectors.toSet());
}
Aggregations