Search in sources :

Example 1 with TUNNEL_BRIDGE

use of org.onosproject.kubevirtnode.api.Constants.TUNNEL_BRIDGE 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);
        }
    }
}
Also used : INTEGRATION_BRIDGE(org.onosproject.kubevirtnode.api.Constants.INTEGRATION_BRIDGE) DefaultBridgeDescription(org.onosproject.net.behaviour.DefaultBridgeDescription) GRE(org.onosproject.kubevirtnode.api.Constants.GRE) GATEWAY(org.onosproject.kubevirtnode.api.KubevirtNode.Type.GATEWAY) CoreService(org.onosproject.core.CoreService) DeviceService(org.onosproject.net.device.DeviceService) Tools.groupedThreads(org.onlab.util.Tools.groupedThreads) KubevirtNodeUtil.getOvsdbClient(org.onosproject.kubevirtnode.util.KubevirtNodeUtil.getOvsdbClient) DEVICE_CREATED(org.onosproject.kubevirtnode.api.KubevirtNodeState.DEVICE_CREATED) TpPort.tpPort(org.onlab.packet.TpPort.tpPort) GENEVE(org.onosproject.kubevirtnode.api.Constants.GENEVE) FlowRuleService(org.onosproject.net.flow.FlowRuleService) OvsdbController(org.onosproject.ovsdb.controller.OvsdbController) AUTO_RECOVERY(org.onosproject.kubevirtnode.impl.OsgiPropertyConstants.AUTO_RECOVERY) Port(org.onosproject.net.Port) ApplicationId(org.onosproject.core.ApplicationId) Thread.sleep(java.lang.Thread.sleep) NodeId(org.onosproject.cluster.NodeId) Device(org.onosproject.net.Device) AUTO_RECOVERY_DEFAULT(org.onosproject.kubevirtnode.impl.OsgiPropertyConstants.AUTO_RECOVERY_DEFAULT) Deactivate(org.osgi.service.component.annotations.Deactivate) KubevirtNodeUtil.isOvsdbConnected(org.onosproject.kubevirtnode.util.KubevirtNodeUtil.isOvsdbConnected) BridgeName(org.onosproject.net.behaviour.BridgeName) Set(java.util.Set) Executors.newSingleThreadExecutor(java.util.concurrent.Executors.newSingleThreadExecutor) KubevirtPhyInterface(org.onosproject.kubevirtnode.api.KubevirtPhyInterface) Collectors(java.util.stream.Collectors) INTEGRATION_TO_TUNNEL(org.onosproject.kubevirtnode.api.Constants.INTEGRATION_TO_TUNNEL) OVSDB_PORT(org.onosproject.kubevirtnode.impl.OsgiPropertyConstants.OVSDB_PORT) DefaultPatchDescription(org.onosproject.net.behaviour.DefaultPatchDescription) Objects(java.util.Objects) KubevirtNodeAdminService(org.onosproject.kubevirtnode.api.KubevirtNodeAdminService) List(java.util.List) TunnelEndPoints(org.onosproject.net.behaviour.TunnelEndPoints) INIT(org.onosproject.kubevirtnode.api.KubevirtNodeState.INIT) DeviceEvent(org.onosproject.net.device.DeviceEvent) ClusterService(org.onosproject.cluster.ClusterService) KubevirtNodeState(org.onosproject.kubevirtnode.api.KubevirtNodeState) DeviceId(org.onosproject.net.DeviceId) Dictionary(java.util.Dictionary) BridgeConfig(org.onosproject.net.behaviour.BridgeConfig) InterfaceConfig(org.onosproject.net.behaviour.InterfaceConfig) KubevirtNodeUtil.resolveHostname(org.onosproject.kubevirtnode.util.KubevirtNodeUtil.resolveHostname) Tools(org.onlab.util.Tools) BridgeDescription(org.onosproject.net.behaviour.BridgeDescription) ComponentContext(org.osgi.service.component.ComponentContext) TUNNEL_BRIDGE(org.onosproject.kubevirtnode.api.Constants.TUNNEL_BRIDGE) PORT_NAME(org.onosproject.net.AnnotationKeys.PORT_NAME) TunnelKey(org.onosproject.net.behaviour.TunnelKey) APP_ID(org.onosproject.kubevirtnode.api.KubevirtNodeService.APP_ID) COMPLETE(org.onosproject.kubevirtnode.api.KubevirtNodeState.COMPLETE) INCOMPLETE(org.onosproject.kubevirtnode.api.KubevirtNodeState.INCOMPLETE) KubevirtNodeHandler(org.onosproject.kubevirtnode.api.KubevirtNodeHandler) PHYSICAL_TO_INTEGRATION_SUFFIX(org.onosproject.kubevirtnode.api.Constants.PHYSICAL_TO_INTEGRATION_SUFFIX) INTEGRATION_TO_PHYSICAL_PREFIX(org.onosproject.kubevirtnode.api.Constants.INTEGRATION_TO_PHYSICAL_PREFIX) KubevirtApiConfigService(org.onosproject.kubevirtnode.api.KubevirtApiConfigService) Component(org.osgi.service.component.annotations.Component) WORKER(org.onosproject.kubevirtnode.api.KubevirtNode.Type.WORKER) Lists(com.google.common.collect.Lists) DefaultTunnelDescription(org.onosproject.net.behaviour.DefaultTunnelDescription) TENANT_BRIDGE_PREFIX(org.onosproject.kubevirtnode.api.Constants.TENANT_BRIDGE_PREFIX) KubevirtNodeUtil.structurePortName(org.onosproject.kubevirtnode.util.KubevirtNodeUtil.structurePortName) Activate(org.osgi.service.component.annotations.Activate) ExecutorService(java.util.concurrent.ExecutorService) IpAddress(org.onlab.packet.IpAddress) ComponentConfigService(org.onosproject.cfg.ComponentConfigService) KubevirtNode(org.onosproject.kubevirtnode.api.KubevirtNode) ControllerInfo(org.onosproject.net.behaviour.ControllerInfo) DeviceListener(org.onosproject.net.device.DeviceListener) Logger(org.slf4j.Logger) BRIDGE_PREFIX(org.onosproject.kubevirtnode.api.Constants.BRIDGE_PREFIX) STT(org.onosproject.kubevirtnode.api.Constants.STT) PatchDescription(org.onosproject.net.behaviour.PatchDescription) TunnelDescription(org.onosproject.net.behaviour.TunnelDescription) FLOW_KEY(org.onosproject.kubevirtnode.api.Constants.FLOW_KEY) OVSDB_PORT_NUM_DEFAULT(org.onosproject.kubevirtnode.impl.OsgiPropertyConstants.OVSDB_PORT_NUM_DEFAULT) ReferenceCardinality(org.osgi.service.component.annotations.ReferenceCardinality) DeviceAdminService(org.onosproject.net.device.DeviceAdminService) KubevirtNodeEvent(org.onosproject.kubevirtnode.api.KubevirtNodeEvent) KubevirtNodeListener(org.onosproject.kubevirtnode.api.KubevirtNodeListener) Modified(org.osgi.service.component.annotations.Modified) LoggerFactory.getLogger(org.slf4j.LoggerFactory.getLogger) OvsdbClientService(org.onosproject.ovsdb.controller.OvsdbClientService) TUNNEL_TO_INTEGRATION(org.onosproject.kubevirtnode.api.Constants.TUNNEL_TO_INTEGRATION) VXLAN(org.onosproject.kubevirtnode.api.Constants.VXLAN) Reference(org.osgi.service.component.annotations.Reference) KubevirtNodeUtil.addOrRemoveSystemInterface(org.onosproject.kubevirtnode.util.KubevirtNodeUtil.addOrRemoveSystemInterface) LeadershipService(org.onosproject.cluster.LeadershipService) KubevirtNodeUtil.getBooleanProperty(org.onosproject.kubevirtnode.util.KubevirtNodeUtil.getBooleanProperty) Device(org.onosproject.net.Device) BridgeConfig(org.onosproject.net.behaviour.BridgeConfig)

Aggregations

Lists (com.google.common.collect.Lists)1 Thread.sleep (java.lang.Thread.sleep)1 Dictionary (java.util.Dictionary)1 List (java.util.List)1 Objects (java.util.Objects)1 Set (java.util.Set)1 ExecutorService (java.util.concurrent.ExecutorService)1 Executors.newSingleThreadExecutor (java.util.concurrent.Executors.newSingleThreadExecutor)1 Collectors (java.util.stream.Collectors)1 IpAddress (org.onlab.packet.IpAddress)1 TpPort.tpPort (org.onlab.packet.TpPort.tpPort)1 Tools (org.onlab.util.Tools)1 Tools.groupedThreads (org.onlab.util.Tools.groupedThreads)1 ComponentConfigService (org.onosproject.cfg.ComponentConfigService)1 ClusterService (org.onosproject.cluster.ClusterService)1 LeadershipService (org.onosproject.cluster.LeadershipService)1 NodeId (org.onosproject.cluster.NodeId)1 ApplicationId (org.onosproject.core.ApplicationId)1 CoreService (org.onosproject.core.CoreService)1 BRIDGE_PREFIX (org.onosproject.kubevirtnode.api.Constants.BRIDGE_PREFIX)1