Search in sources :

Example 21 with DeviceId

use of org.onosproject.net.DeviceId in project trellis-control by opennetworkinglab.

the class RoutingRulePopulator method getMplsForwardingObjective.

/**
 * Returns a Forwarding Objective builder for the MPLS rule that references
 * the desired Next Objective. Creates a DestinationSet that allows the
 * groupHandler to create or find the required next objective.
 *
 * @param targetSw the target sw
 * @param nextHops the set of next hops
 * @param phpRequired true if penultimate-hop-popping is required
 * @param isBos true if matched label is bottom-of-stack
 * @param meta metadata for creating next objective
 * @param routerIp the router ip representing the destination switch
 * @param destSw the destination sw
 * @return the mpls forwarding objective builder
 */
private ForwardingObjective.Builder getMplsForwardingObjective(DeviceId targetSw, Set<DeviceId> nextHops, boolean phpRequired, boolean isBos, TrafficSelector meta, IpAddress routerIp, int segmentId, DeviceId destSw) {
    ForwardingObjective.Builder fwdBuilder = DefaultForwardingObjective.builder().withFlag(ForwardingObjective.Flag.SPECIFIC);
    TrafficTreatment.Builder tbuilder = DefaultTrafficTreatment.builder();
    DestinationSet ds = null;
    DestinationSet.DestinationSetType dstType = null;
    boolean simple = false;
    if (phpRequired) {
        // php case - pop should always be flow-action
        log.debug("getMplsForwardingObjective: php required");
        tbuilder.deferred().copyTtlIn();
        if (isBos) {
            if (routerIp.isIp4()) {
                tbuilder.deferred().popMpls(EthType.EtherType.IPV4.ethType());
            } else {
                tbuilder.deferred().popMpls(EthType.EtherType.IPV6.ethType());
            }
            tbuilder.decNwTtl();
            // standard case -> BoS == True; pop results in IP packet and forwarding
            // is via an ECMP group
            ds = DestinationSet.createTypePopBos(destSw);
        } else {
            tbuilder.deferred().popMpls(EthType.EtherType.MPLS_UNICAST.ethType()).decMplsTtl();
            // double-label case -> BoS == False, pop results in MPLS packet
            // depending on configuration we can ECMP this packet or choose one output
            ds = DestinationSet.createTypePopNotBos(destSw);
            if (!srManager.getMplsEcmp()) {
                simple = true;
            }
        }
    } else {
        // swap with self case - SR CONTINUE
        log.debug("getMplsForwardingObjective: swap with self");
        tbuilder.deferred().decMplsTtl();
        // swap results in MPLS packet with same BoS bit regardless of bit value
        // depending on configuration we can ECMP this packet or choose one output
        // differentiate here between swap with not bos or swap with bos
        ds = isBos ? DestinationSet.createTypeSwapBos(segmentId, destSw) : DestinationSet.createTypeSwapNotBos(segmentId, destSw);
        if (!srManager.getMplsEcmp()) {
            simple = true;
        }
    }
    fwdBuilder.withTreatment(tbuilder.build());
    log.debug("Trying to get a nextObjId for mpls rule on device:{} to ds:{}", targetSw, ds);
    DefaultGroupHandler gh = srManager.getGroupHandler(targetSw);
    if (gh == null) {
        log.warn("getNextObjectiveId query - groupHandler for device {} " + "not found", targetSw);
        return null;
    }
    Map<DeviceId, Set<DeviceId>> dstNextHops = new HashMap<>();
    dstNextHops.put(destSw, nextHops);
    int nextId = gh.getNextObjectiveId(ds, dstNextHops, meta, simple);
    if (nextId <= 0) {
        log.warn("No next objective in {} for ds: {}", targetSw, ds);
        return null;
    } else {
        log.debug("nextObjId found:{} for mpls rule on device:{} to ds:{}", nextId, targetSw, ds);
    }
    fwdBuilder.nextStep(nextId);
    return fwdBuilder;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) DestinationSet(org.onosproject.segmentrouting.grouphandler.DestinationSet) DestinationSet(org.onosproject.segmentrouting.grouphandler.DestinationSet) HashMap(java.util.HashMap) DeviceId(org.onosproject.net.DeviceId) Builder(org.onosproject.net.flowobjective.ForwardingObjective.Builder) ForwardingObjective(org.onosproject.net.flowobjective.ForwardingObjective) DefaultForwardingObjective(org.onosproject.net.flowobjective.DefaultForwardingObjective) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) ConnectPoint(org.onosproject.net.ConnectPoint) DefaultGroupHandler(org.onosproject.segmentrouting.grouphandler.DefaultGroupHandler)

Example 22 with DeviceId

use of org.onosproject.net.DeviceId in project trellis-control by opennetworkinglab.

the class RoutingRulePopulator method anyDoubleTaggedHost.

/**
 * Checks if there is any double tagged host attached to given location.
 * This method will match on the effective location of a host.
 * That is, it will match on auxLocations when auxLocations is not null. Otherwise, it will match on locations.
 *
 * @param deviceId device ID
 * @param portNum port number
 * @return true if there is any host attached to given location.
 */
private boolean anyDoubleTaggedHost(DeviceId deviceId, PortNumber portNum) {
    ConnectPoint cp = new ConnectPoint(deviceId, portNum);
    Set<Host> connectedHosts = srManager.hostService.getConnectedHosts(cp, false);
    Set<Host> auxConnectedHosts = srManager.hostService.getConnectedHosts(cp, true);
    return !auxConnectedHosts.isEmpty() || connectedHosts.stream().anyMatch(host -> host.auxLocations() == null);
}
Also used : DeviceConfigNotFoundException(org.onosproject.segmentrouting.config.DeviceConfigNotFoundException) TYPE_IPV6(org.onlab.packet.Ethernet.TYPE_IPV6) CLEANUP_DOUBLE_TAGGED_HOST_ENTRIES(org.onosproject.segmentrouting.metadata.SRObjectiveMetadata.CLEANUP_DOUBLE_TAGGED_HOST_ENTRIES) Interface(org.onosproject.net.intf.Interface) INTERFACE_CONFIG_UPDATE(org.onosproject.segmentrouting.metadata.SRObjectiveMetadata.INTERFACE_CONFIG_UPDATE) ROUTER_ADVERTISEMENT(org.onlab.packet.ICMP6.ROUTER_ADVERTISEMENT) PortNumber(org.onosproject.net.PortNumber) LoggerFactory(org.slf4j.LoggerFactory) TYPE_ARP(org.onlab.packet.Ethernet.TYPE_ARP) ForwardingObjective(org.onosproject.net.flowobjective.ForwardingObjective) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) ConnectPoint(org.onosproject.net.ConnectPoint) ObjectiveError(org.onosproject.net.flowobjective.ObjectiveError) Ethernet(org.onlab.packet.Ethernet) NEIGHBOR_SOLICITATION(org.onlab.packet.ICMP6.NEIGHBOR_SOLICITATION) Port(org.onosproject.net.Port) Map(java.util.Map) EDGE_PORT(org.onosproject.segmentrouting.metadata.SRObjectiveMetadata.EDGE_PORT) Ip6Address(org.onlab.packet.Ip6Address) Ip4Address(org.onlab.packet.Ip4Address) Device(org.onosproject.net.Device) DefaultFilteringObjective(org.onosproject.net.flowobjective.DefaultFilteringObjective) FilteringObjective(org.onosproject.net.flowobjective.FilteringObjective) Collection(java.util.Collection) Set(java.util.Set) Builder(org.onosproject.net.flowobjective.ForwardingObjective.Builder) DefaultForwardingObjective(org.onosproject.net.flowobjective.DefaultForwardingObjective) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) EthType(org.onlab.packet.EthType) List(java.util.List) ObjectiveContext(org.onosproject.net.flowobjective.ObjectiveContext) Optional(java.util.Optional) NEIGHBOR_ADVERTISEMENT(org.onlab.packet.ICMP6.NEIGHBOR_ADVERTISEMENT) DeviceId(org.onosproject.net.DeviceId) IpPrefix(org.onlab.packet.IpPrefix) Host(org.onosproject.net.Host) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) INFRA_PORT(org.onosproject.segmentrouting.metadata.SRObjectiveMetadata.INFRA_PORT) Flag(org.onosproject.net.flowobjective.ForwardingObjective.Flag) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Lists(com.google.common.collect.Lists) TrafficSelector(org.onosproject.net.flow.TrafficSelector) DefaultGroupHandler(org.onosproject.segmentrouting.grouphandler.DefaultGroupHandler) PAIR_PORT(org.onosproject.segmentrouting.metadata.SRObjectiveMetadata.PAIR_PORT) Criteria(org.onosproject.net.flow.criteria.Criteria) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) DefaultObjectiveContext(org.onosproject.net.flowobjective.DefaultObjectiveContext) IpAddress(org.onlab.packet.IpAddress) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) Logger(org.slf4j.Logger) MplsLabel(org.onlab.packet.MplsLabel) VlanId(org.onlab.packet.VlanId) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) PROTOCOL_ICMP6(org.onlab.packet.IPv6.PROTOCOL_ICMP6) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) IPv6(org.onlab.packet.IPv6) ExecutionException(java.util.concurrent.ExecutionException) AtomicLong(java.util.concurrent.atomic.AtomicLong) DestinationSet(org.onosproject.segmentrouting.grouphandler.DestinationSet) Objective(org.onosproject.net.flowobjective.Objective) MacAddress(org.onlab.packet.MacAddress) PacketPriority(org.onosproject.net.packet.PacketPriority) Collections(java.util.Collections) ROUTER_SOLICITATION(org.onlab.packet.ICMP6.ROUTER_SOLICITATION) Host(org.onosproject.net.Host) ConnectPoint(org.onosproject.net.ConnectPoint)

Example 23 with DeviceId

use of org.onosproject.net.DeviceId in project trellis-control by opennetworkinglab.

the class SegmentRoutingManager method updateInterface.

private void updateInterface(InterfaceConfig conf, InterfaceConfig prevConf) {
    try {
        Set<Interface> intfs = conf.getInterfaces();
        Set<Interface> prevIntfs = prevConf.getInterfaces();
        // Now we only handle one interface config at each port.
        if (intfs.size() != 1 || prevIntfs.size() != 1) {
            log.warn("Interface update aborted - one at a time is allowed, " + "but {} / {}(prev) received.", intfs.size(), prevIntfs.size());
            return;
        }
        // The system is in an incoherent state, abort
        if (defaultRoutingHandler == null) {
            log.warn("Interface update aborted, defaultRoutingHandler is null");
            return;
        }
        Interface intf = intfs.stream().findFirst().get();
        Interface prevIntf = prevIntfs.stream().findFirst().get();
        DeviceId deviceId = intf.connectPoint().deviceId();
        PortNumber portNum = intf.connectPoint().port();
        if (!shouldProgram(deviceId)) {
            log.debug("Not leading the programming of {} skip update interface {}", deviceId, intf);
            return;
        }
        // We need to do nexthop update al least one time for each
        // interface config change. There is no difference when it is done;
        boolean updateNexthop = false;
        removeSubnetConfig(prevIntf.connectPoint(), Sets.difference(new HashSet<>(prevIntf.ipAddressesList()), new HashSet<>(intf.ipAddressesList())));
        if (!prevIntf.vlanNative().equals(VlanId.NONE) && !prevIntf.vlanNative().equals(intf.vlanUntagged()) && !prevIntf.vlanNative().equals(intf.vlanNative())) {
            if (intf.vlanTagged().contains(prevIntf.vlanNative())) {
                // Update filtering objective and L2IG group bucket
                updatePortVlanTreatment(deviceId, portNum, prevIntf.vlanNative(), false);
            } else {
                // RemoveVlanNative - affected scenarios:
                // (T,N)->U; (T*,N)->U; (T,N)->(T,N); (T,N)->T
                updateVlanConfigInternal(deviceId, portNum, prevIntf.vlanNative(), true, false);
                // Update the nexthops of the indirect routes
                updateNexthop = true;
                routeEventExecutor.execute(() -> routeHandler.processIntfVlanUpdatedEvent(deviceId, portNum));
            }
        }
        if (!prevIntf.vlanUntagged().equals(VlanId.NONE) && !prevIntf.vlanUntagged().equals(intf.vlanUntagged()) && !prevIntf.vlanUntagged().equals(intf.vlanNative())) {
            if (intf.vlanTagged().contains(prevIntf.vlanUntagged())) {
                // Update filtering objective and L2IG group bucket - affected scenarios:
                // U->(T*,N); U->T*
                updatePortVlanTreatment(deviceId, portNum, prevIntf.vlanUntagged(), false);
                if (!updateNexthop) {
                    updateNexthop = true;
                    routeEventExecutor.execute(() -> routeHandler.processIntfVlanUpdatedEvent(deviceId, portNum));
                }
            } else {
                // RemoveVlanUntagged - affected scenarios:
                // U->U; U->(T,N); U->T
                updateVlanConfigInternal(deviceId, portNum, prevIntf.vlanUntagged(), true, false);
                if (!updateNexthop) {
                    updateNexthop = true;
                    routeEventExecutor.execute(() -> routeHandler.processIntfVlanUpdatedEvent(deviceId, portNum));
                }
            }
        }
        if (!prevIntf.vlanTagged().isEmpty() && !intf.vlanTagged().equals(prevIntf.vlanTagged())) {
            // RemoveVlanTagged - affected scenarios:
            // T->U; T->T; (T,N*)->U; (T,N)->(T,N)
            Sets.difference(prevIntf.vlanTagged(), intf.vlanTagged()).stream().filter(i -> !intf.vlanUntagged().equals(i)).filter(i -> !intf.vlanNative().equals(i)).forEach(vlanId -> updateVlanConfigInternal(deviceId, portNum, vlanId, false, false));
        }
        if (!intf.vlanNative().equals(VlanId.NONE) && !prevIntf.vlanNative().equals(intf.vlanNative()) && !prevIntf.vlanUntagged().equals(intf.vlanNative())) {
            if (prevIntf.vlanTagged().contains(intf.vlanNative())) {
                // Update filtering objective and L2IG group bucket
                updatePortVlanTreatment(deviceId, portNum, intf.vlanNative(), true);
            } else {
                // AddVlanNative - affected scenarios
                // U->(T,N); U->(T*,N); T->(T,N)
                updateVlanConfigInternal(deviceId, portNum, intf.vlanNative(), true, true);
                if (!updateNexthop) {
                    updateNexthop = true;
                    routeEventExecutor.execute(() -> routeHandler.processIntfVlanUpdatedEvent(deviceId, portNum));
                }
            }
        }
        if (!intf.vlanTagged().isEmpty() && !intf.vlanTagged().equals(prevIntf.vlanTagged())) {
            // AddVlanTagged - affected scenarios
            // U->T; U->(T,N*); T->T; (T,N)->(T,N)
            Sets.difference(intf.vlanTagged(), prevIntf.vlanTagged()).stream().filter(i -> !prevIntf.vlanUntagged().equals(i)).filter(i -> !prevIntf.vlanNative().equals(i)).forEach(vlanId -> updateVlanConfigInternal(deviceId, portNum, vlanId, false, true));
        }
        if (!intf.vlanUntagged().equals(VlanId.NONE) && !prevIntf.vlanUntagged().equals(intf.vlanUntagged()) && !prevIntf.vlanNative().equals(intf.vlanUntagged())) {
            if (prevIntf.vlanTagged().contains(intf.vlanUntagged())) {
                // Update filtering objective and L2IG group bucket - affected scenarios
                // (T*,N)->U; T*->U
                updatePortVlanTreatment(deviceId, portNum, intf.vlanUntagged(), true);
                if (!updateNexthop) {
                    routeEventExecutor.execute(() -> routeHandler.processIntfVlanUpdatedEvent(deviceId, portNum));
                }
            } else {
                // AddVlanUntagged - affected scenarios
                // U->U; (T,N)->U; T->U
                updateVlanConfigInternal(deviceId, portNum, intf.vlanUntagged(), true, true);
                if (!updateNexthop) {
                    routeEventExecutor.execute(() -> routeHandler.processIntfVlanUpdatedEvent(deviceId, portNum));
                }
            }
        }
        addSubnetConfig(prevIntf.connectPoint(), Sets.difference(new HashSet<>(intf.ipAddressesList()), new HashSet<>(prevIntf.ipAddressesList())));
    } catch (ConfigException e) {
        log.error("Error in configuration");
    }
}
Also used : DeviceConfigNotFoundException(org.onosproject.segmentrouting.config.DeviceConfigNotFoundException) NetworkConfigRegistry(org.onosproject.net.config.NetworkConfigRegistry) ROUTE_SIMPLIFICATION_DEFAULT(org.onosproject.segmentrouting.OsgiPropertyConstants.ROUTE_SIMPLIFICATION_DEFAULT) McastStoreKey(org.onosproject.segmentrouting.mcast.McastStoreKey) PROP_ACTIVE_PROBING(org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_ACTIVE_PROBING) PortNumber(org.onosproject.net.PortNumber) DeviceService(org.onosproject.net.device.DeviceService) TYPE_ARP(org.onlab.packet.Ethernet.TYPE_ARP) DefaultL2TunnelDescription(org.onosproject.segmentrouting.pwaas.DefaultL2TunnelDescription) ROUTE_DOUBLE_TAGGED_HOSTS_DEFAULT(org.onosproject.segmentrouting.OsgiPropertyConstants.ROUTE_DOUBLE_TAGGED_HOSTS_DEFAULT) NeighbourResolutionService(org.onosproject.net.neighbour.NeighbourResolutionService) L2TunnelDescription(org.onosproject.segmentrouting.pwaas.L2TunnelDescription) ConnectPoint(org.onosproject.net.ConnectPoint) StorageService(org.onosproject.store.service.StorageService) SubjectFactories(org.onosproject.net.config.basics.SubjectFactories) McastEvent(org.onosproject.mcast.api.McastEvent) Port(org.onosproject.net.Port) Map(java.util.Map) ApplicationId(org.onosproject.core.ApplicationId) NextObjective(org.onosproject.net.flowobjective.NextObjective) MulticastRouteService(org.onosproject.mcast.api.MulticastRouteService) KryoNamespaces(org.onosproject.store.serializers.KryoNamespaces) MastershipService(org.onosproject.mastership.MastershipService) SYMMETRIC_PROBING_DEFAULT(org.onosproject.segmentrouting.OsgiPropertyConstants.SYMMETRIC_PROBING_DEFAULT) Deactivate(org.osgi.service.component.annotations.Deactivate) Set(java.util.Set) PacketService(org.onosproject.net.packet.PacketService) WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) ReferencePolicy(org.osgi.service.component.annotations.ReferencePolicy) DEFAULT_INTERNAL_VLAN_DEFAULT(org.onosproject.segmentrouting.OsgiPropertyConstants.DEFAULT_INTERNAL_VLAN_DEFAULT) Executors(java.util.concurrent.Executors) RouteListener(org.onosproject.routeservice.RouteListener) ConfigFactory(org.onosproject.net.config.ConfigFactory) LinkListener(org.onosproject.net.link.LinkListener) DeviceEvent(org.onosproject.net.device.DeviceEvent) DeviceId(org.onosproject.net.DeviceId) ConfigException(org.onosproject.net.config.ConfigException) Dictionary(java.util.Dictionary) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) Tools(org.onlab.util.Tools) Host(org.onosproject.net.Host) LinkEvent(org.onosproject.net.link.LinkEvent) NetworkConfigEvent(org.onosproject.net.config.NetworkConfigEvent) VlanNextObjectiveStoreKey(org.onosproject.segmentrouting.storekey.VlanNextObjectiveStoreKey) ComponentContext(org.osgi.service.component.ComponentContext) RouteEvent(org.onosproject.routeservice.RouteEvent) KryoNamespace(org.onlab.util.KryoNamespace) HostListener(org.onosproject.net.host.HostListener) InterfaceService(org.onosproject.net.intf.InterfaceService) HostService(org.onosproject.net.host.HostService) ArrayList(java.util.ArrayList) McastListener(org.onosproject.mcast.api.McastListener) CONFIG_UNREGISTERED(org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_UNREGISTERED) RESPOND_TO_UNKNOWN_HOSTS_DEFAULT(org.onosproject.segmentrouting.OsgiPropertyConstants.RESPOND_TO_UNKNOWN_HOSTS_DEFAULT) MastershipEvent(org.onosproject.mastership.MastershipEvent) SegmentRoutingAppConfig(org.onosproject.segmentrouting.config.SegmentRoutingAppConfig) Component(org.osgi.service.component.annotations.Component) Lists(com.google.common.collect.Lists) TrafficSelector(org.onosproject.net.flow.TrafficSelector) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) NextNeighbors(org.onosproject.segmentrouting.grouphandler.NextNeighbors) DefaultL2TunnelHandler(org.onosproject.segmentrouting.pwaas.DefaultL2TunnelHandler) ComponentConfigService(org.onosproject.cfg.ComponentConfigService) DeviceListener(org.onosproject.net.device.DeviceListener) VlanId(org.onlab.packet.VlanId) PW_TRANSPORT_VLAN_DEFAULT(org.onosproject.segmentrouting.OsgiPropertyConstants.PW_TRANSPORT_VLAN_DEFAULT) IPv6(org.onlab.packet.IPv6) ExecutionException(java.util.concurrent.ExecutionException) IPv4(org.onlab.packet.IPv4) CONFIG_REGISTERED(org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_REGISTERED) DestinationSetNextObjectiveStoreKey(org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey) MacAddress(org.onlab.packet.MacAddress) PROP_PW_TRANSPORT_VLAN(org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_PW_TRANSPORT_VLAN) ResolvedRoute(org.onosproject.routeservice.ResolvedRoute) PROP_ROUTE_DOUBLE_TAGGED_HOSTS(org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_ROUTE_DOUBLE_TAGGED_HOSTS) NetworkConfigListener(org.onosproject.net.config.NetworkConfigListener) PortNextObjectiveStoreKey(org.onosproject.segmentrouting.storekey.PortNextObjectiveStoreKey) XconnectService(org.onosproject.segmentrouting.xconnect.api.XconnectService) ScheduledFuture(java.util.concurrent.ScheduledFuture) Interface(org.onosproject.net.intf.Interface) CoreService(org.onosproject.core.CoreService) L2Tunnel(org.onosproject.segmentrouting.pwaas.L2Tunnel) LoggerFactory(org.slf4j.LoggerFactory) Tools.groupedThreads(org.onlab.util.Tools.groupedThreads) McastConfig(org.onosproject.net.config.basics.McastConfig) TopologyService(org.onosproject.net.topology.TopologyService) EventuallyConsistentMapBuilder(org.onosproject.store.service.EventuallyConsistentMapBuilder) Link(org.onosproject.net.Link) Ethernet(org.onlab.packet.Ethernet) HashMultimap(com.google.common.collect.HashMultimap) DefaultL2TunnelPolicy(org.onosproject.segmentrouting.pwaas.DefaultL2TunnelPolicy) McastFilteringObjStoreKey(org.onosproject.segmentrouting.mcast.McastFilteringObjStoreKey) PROP_ROUTE_SIMPLIFICATION(org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_ROUTE_SIMPLIFICATION) WorkPartitionService(org.onosproject.net.intent.WorkPartitionService) PROP_DEFAULT_INTERNAL_VLAN(org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_DEFAULT_INTERNAL_VLAN) Event(org.onosproject.event.Event) NodeId(org.onosproject.cluster.NodeId) RouteService(org.onosproject.routeservice.RouteService) McastHandler(org.onosproject.segmentrouting.mcast.McastHandler) TopologyEvent(org.onosproject.net.topology.TopologyEvent) ClusterEvent(org.onosproject.cluster.ClusterEvent) ImmutableMap(com.google.common.collect.ImmutableMap) Device(org.onosproject.net.Device) PacketProcessor(org.onosproject.net.packet.PacketProcessor) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Instant(java.time.Instant) InterfaceIpAddress(org.onosproject.net.host.InterfaceIpAddress) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) Preconditions.checkState(com.google.common.base.Preconditions.checkState) PROP_RESPOND_TO_UNKNOWN_HOSTS(org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_RESPOND_TO_UNKNOWN_HOSTS) List(java.util.List) InboundPacket(org.onosproject.net.packet.InboundPacket) PacketContext(org.onosproject.net.packet.PacketContext) LinkService(org.onosproject.net.link.LinkService) Optional(java.util.Optional) ClusterService(org.onosproject.cluster.ClusterService) IpPrefix(org.onlab.packet.IpPrefix) McastRole(org.onosproject.segmentrouting.mcast.McastRole) McastRoleStoreKey(org.onosproject.segmentrouting.mcast.McastRoleStoreKey) MacVlanNextObjectiveStoreKey(org.onosproject.segmentrouting.storekey.MacVlanNextObjectiveStoreKey) ICMP6(org.onlab.packet.ICMP6) InterfaceConfig(org.onosproject.net.config.basics.InterfaceConfig) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) SegmentRoutingDeviceConfig(org.onosproject.segmentrouting.config.SegmentRoutingDeviceConfig) CompletableFuture(java.util.concurrent.CompletableFuture) Multimap(com.google.common.collect.Multimap) XConnectStoreKey(org.onosproject.segmentrouting.storekey.XConnectStoreKey) ACTIVE_PROBING_DEFAULT(org.onosproject.segmentrouting.OsgiPropertyConstants.ACTIVE_PROBING_DEFAULT) FlowObjectiveService(org.onosproject.net.flowobjective.FlowObjectiveService) HashSet(java.util.HashSet) L2TunnelHandler(org.onosproject.segmentrouting.pwaas.L2TunnelHandler) DefaultGroupHandler(org.onosproject.segmentrouting.grouphandler.DefaultGroupHandler) PROP_SYMMETRIC_PROBING(org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_SYMMETRIC_PROBING) PhasedRecoveryService(org.onosproject.segmentrouting.phasedrecovery.api.PhasedRecoveryService) HostEvent(org.onosproject.net.host.HostEvent) HostProbingService(org.onosproject.net.host.HostProbingService) Activate(org.osgi.service.component.annotations.Activate) EventuallyConsistentMap(org.onosproject.store.service.EventuallyConsistentMap) HostId(org.onosproject.net.HostId) SINGLE_HOMED_DOWN_DEFAULT(org.onosproject.segmentrouting.OsgiPropertyConstants.SINGLE_HOMED_DOWN_DEFAULT) ExecutorService(java.util.concurrent.ExecutorService) IpAddress(org.onlab.packet.IpAddress) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) ClusterEventListener(org.onosproject.cluster.ClusterEventListener) DefaultL2Tunnel(org.onosproject.segmentrouting.pwaas.DefaultL2Tunnel) Logger(org.slf4j.Logger) Maps(com.google.common.collect.Maps) ReferenceCardinality(org.osgi.service.component.annotations.ReferenceCardinality) TimeUnit(java.util.concurrent.TimeUnit) DeviceAdminService(org.onosproject.net.device.DeviceAdminService) L2TunnelPolicy(org.onosproject.segmentrouting.pwaas.L2TunnelPolicy) DestinationSet(org.onosproject.segmentrouting.grouphandler.DestinationSet) Modified(org.osgi.service.component.annotations.Modified) MastershipListener(org.onosproject.mastership.MastershipListener) PROP_SINGLE_HOMED_DOWN(org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_SINGLE_HOMED_DOWN) Reference(org.osgi.service.component.annotations.Reference) Collections(java.util.Collections) TopologyListener(org.onosproject.net.topology.TopologyListener) DeviceId(org.onosproject.net.DeviceId) ConfigException(org.onosproject.net.config.ConfigException) PortNumber(org.onosproject.net.PortNumber) Interface(org.onosproject.net.intf.Interface) HashSet(java.util.HashSet)

Example 24 with DeviceId

use of org.onosproject.net.DeviceId in project trellis-control by opennetworkinglab.

the class SegmentRoutingManager method removeSubnetConfig.

private void removeSubnetConfig(ConnectPoint cp, Set<InterfaceIpAddress> ipAddressSet) {
    Set<IpPrefix> ipPrefixSet = ipAddressSet.stream().map(InterfaceIpAddress::subnetAddress).collect(Collectors.toSet());
    Set<InterfaceIpAddress> deviceIntfIpAddrs = interfaceService.getInterfaces().stream().filter(intf -> intf.connectPoint().deviceId().equals(cp.deviceId())).filter(intf -> !intf.connectPoint().equals(cp)).flatMap(intf -> intf.ipAddressesList().stream()).collect(Collectors.toSet());
    // 1. Partial subnet population
    // Remove routing rules for removed subnet from previous configuration,
    // which does not also exist in other interfaces in the same device
    Set<IpPrefix> deviceIpPrefixSet = deviceIntfIpAddrs.stream().map(InterfaceIpAddress::subnetAddress).collect(Collectors.toSet());
    Set<IpPrefix> subnetsToBeRevoked = ipPrefixSet.stream().filter(ipPrefix -> !deviceIpPrefixSet.contains(ipPrefix)).collect(Collectors.toSet());
    // Check if any of the subnets to be revoked is configured in the pairDevice.
    // If any, repopulate the subnet with pairDevice connectPoint instead of revoking.
    Optional<DeviceId> pairDevice = getPairDeviceId(cp.deviceId());
    if (pairDevice.isPresent()) {
        Set<IpPrefix> pairDeviceIpPrefix = getDeviceSubnetMap().get(pairDevice.get());
        Set<IpPrefix> subnetsExistingInPairDevice = subnetsToBeRevoked.stream().filter(ipPrefix -> pairDeviceIpPrefix.contains(ipPrefix)).collect(Collectors.toSet());
        // Update the subnets existing in pair device with pair device connect point.
        if (!subnetsExistingInPairDevice.isEmpty()) {
            // PortNumber of connect point is not relevant in populate subnet and hence providing as ANY.
            ConnectPoint pairDeviceCp = new ConnectPoint(pairDevice.get(), PortNumber.ANY);
            log.debug("Updating the subnets: {} with pairDevice connectPoint as it exists in the Pair device: {}", subnetsExistingInPairDevice, pairDeviceCp);
            defaultRoutingHandler.populateSubnet(Collections.singleton(pairDeviceCp), subnetsExistingInPairDevice);
        }
        // Remove only the subnets that are not configured in the pairDevice.
        subnetsToBeRevoked = Sets.difference(subnetsToBeRevoked, subnetsExistingInPairDevice);
    }
    if (!subnetsToBeRevoked.isEmpty()) {
        log.debug("Removing subnets for connectPoint: {}, subnets: {}", cp, subnetsToBeRevoked);
        defaultRoutingHandler.revokeSubnet(subnetsToBeRevoked, cp.deviceId());
    }
    // 2. Interface IP punts
    // Remove IP punts for old Intf address
    Set<IpAddress> deviceIpAddrs = deviceIntfIpAddrs.stream().map(InterfaceIpAddress::ipAddress).collect(Collectors.toSet());
    ipAddressSet.stream().map(InterfaceIpAddress::ipAddress).filter(interfaceIpAddress -> !deviceIpAddrs.contains(interfaceIpAddress)).forEach(interfaceIpAddress -> routingRulePopulator.revokeSingleIpPunts(cp.deviceId(), interfaceIpAddress));
    // 3. Host unicast routing rule
    // Remove unicast routing rule
    hostEventExecutor.execute(() -> hostHandler.processIntfIpUpdatedEvent(cp, ipPrefixSet, false));
}
Also used : IpPrefix(org.onlab.packet.IpPrefix) DeviceConfigNotFoundException(org.onosproject.segmentrouting.config.DeviceConfigNotFoundException) NetworkConfigRegistry(org.onosproject.net.config.NetworkConfigRegistry) ROUTE_SIMPLIFICATION_DEFAULT(org.onosproject.segmentrouting.OsgiPropertyConstants.ROUTE_SIMPLIFICATION_DEFAULT) McastStoreKey(org.onosproject.segmentrouting.mcast.McastStoreKey) PROP_ACTIVE_PROBING(org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_ACTIVE_PROBING) PortNumber(org.onosproject.net.PortNumber) DeviceService(org.onosproject.net.device.DeviceService) TYPE_ARP(org.onlab.packet.Ethernet.TYPE_ARP) DefaultL2TunnelDescription(org.onosproject.segmentrouting.pwaas.DefaultL2TunnelDescription) ROUTE_DOUBLE_TAGGED_HOSTS_DEFAULT(org.onosproject.segmentrouting.OsgiPropertyConstants.ROUTE_DOUBLE_TAGGED_HOSTS_DEFAULT) NeighbourResolutionService(org.onosproject.net.neighbour.NeighbourResolutionService) L2TunnelDescription(org.onosproject.segmentrouting.pwaas.L2TunnelDescription) ConnectPoint(org.onosproject.net.ConnectPoint) StorageService(org.onosproject.store.service.StorageService) SubjectFactories(org.onosproject.net.config.basics.SubjectFactories) McastEvent(org.onosproject.mcast.api.McastEvent) Port(org.onosproject.net.Port) Map(java.util.Map) ApplicationId(org.onosproject.core.ApplicationId) NextObjective(org.onosproject.net.flowobjective.NextObjective) MulticastRouteService(org.onosproject.mcast.api.MulticastRouteService) KryoNamespaces(org.onosproject.store.serializers.KryoNamespaces) MastershipService(org.onosproject.mastership.MastershipService) SYMMETRIC_PROBING_DEFAULT(org.onosproject.segmentrouting.OsgiPropertyConstants.SYMMETRIC_PROBING_DEFAULT) Deactivate(org.osgi.service.component.annotations.Deactivate) Set(java.util.Set) PacketService(org.onosproject.net.packet.PacketService) WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) ReferencePolicy(org.osgi.service.component.annotations.ReferencePolicy) DEFAULT_INTERNAL_VLAN_DEFAULT(org.onosproject.segmentrouting.OsgiPropertyConstants.DEFAULT_INTERNAL_VLAN_DEFAULT) Executors(java.util.concurrent.Executors) RouteListener(org.onosproject.routeservice.RouteListener) ConfigFactory(org.onosproject.net.config.ConfigFactory) LinkListener(org.onosproject.net.link.LinkListener) DeviceEvent(org.onosproject.net.device.DeviceEvent) DeviceId(org.onosproject.net.DeviceId) ConfigException(org.onosproject.net.config.ConfigException) Dictionary(java.util.Dictionary) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) Tools(org.onlab.util.Tools) Host(org.onosproject.net.Host) LinkEvent(org.onosproject.net.link.LinkEvent) NetworkConfigEvent(org.onosproject.net.config.NetworkConfigEvent) VlanNextObjectiveStoreKey(org.onosproject.segmentrouting.storekey.VlanNextObjectiveStoreKey) ComponentContext(org.osgi.service.component.ComponentContext) RouteEvent(org.onosproject.routeservice.RouteEvent) KryoNamespace(org.onlab.util.KryoNamespace) HostListener(org.onosproject.net.host.HostListener) InterfaceService(org.onosproject.net.intf.InterfaceService) HostService(org.onosproject.net.host.HostService) ArrayList(java.util.ArrayList) McastListener(org.onosproject.mcast.api.McastListener) CONFIG_UNREGISTERED(org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_UNREGISTERED) RESPOND_TO_UNKNOWN_HOSTS_DEFAULT(org.onosproject.segmentrouting.OsgiPropertyConstants.RESPOND_TO_UNKNOWN_HOSTS_DEFAULT) MastershipEvent(org.onosproject.mastership.MastershipEvent) SegmentRoutingAppConfig(org.onosproject.segmentrouting.config.SegmentRoutingAppConfig) Component(org.osgi.service.component.annotations.Component) Lists(com.google.common.collect.Lists) TrafficSelector(org.onosproject.net.flow.TrafficSelector) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) NextNeighbors(org.onosproject.segmentrouting.grouphandler.NextNeighbors) DefaultL2TunnelHandler(org.onosproject.segmentrouting.pwaas.DefaultL2TunnelHandler) ComponentConfigService(org.onosproject.cfg.ComponentConfigService) DeviceListener(org.onosproject.net.device.DeviceListener) VlanId(org.onlab.packet.VlanId) PW_TRANSPORT_VLAN_DEFAULT(org.onosproject.segmentrouting.OsgiPropertyConstants.PW_TRANSPORT_VLAN_DEFAULT) IPv6(org.onlab.packet.IPv6) ExecutionException(java.util.concurrent.ExecutionException) IPv4(org.onlab.packet.IPv4) CONFIG_REGISTERED(org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_REGISTERED) DestinationSetNextObjectiveStoreKey(org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey) MacAddress(org.onlab.packet.MacAddress) PROP_PW_TRANSPORT_VLAN(org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_PW_TRANSPORT_VLAN) ResolvedRoute(org.onosproject.routeservice.ResolvedRoute) PROP_ROUTE_DOUBLE_TAGGED_HOSTS(org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_ROUTE_DOUBLE_TAGGED_HOSTS) NetworkConfigListener(org.onosproject.net.config.NetworkConfigListener) PortNextObjectiveStoreKey(org.onosproject.segmentrouting.storekey.PortNextObjectiveStoreKey) XconnectService(org.onosproject.segmentrouting.xconnect.api.XconnectService) ScheduledFuture(java.util.concurrent.ScheduledFuture) Interface(org.onosproject.net.intf.Interface) CoreService(org.onosproject.core.CoreService) L2Tunnel(org.onosproject.segmentrouting.pwaas.L2Tunnel) LoggerFactory(org.slf4j.LoggerFactory) Tools.groupedThreads(org.onlab.util.Tools.groupedThreads) McastConfig(org.onosproject.net.config.basics.McastConfig) TopologyService(org.onosproject.net.topology.TopologyService) EventuallyConsistentMapBuilder(org.onosproject.store.service.EventuallyConsistentMapBuilder) Link(org.onosproject.net.Link) Ethernet(org.onlab.packet.Ethernet) HashMultimap(com.google.common.collect.HashMultimap) DefaultL2TunnelPolicy(org.onosproject.segmentrouting.pwaas.DefaultL2TunnelPolicy) McastFilteringObjStoreKey(org.onosproject.segmentrouting.mcast.McastFilteringObjStoreKey) PROP_ROUTE_SIMPLIFICATION(org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_ROUTE_SIMPLIFICATION) WorkPartitionService(org.onosproject.net.intent.WorkPartitionService) PROP_DEFAULT_INTERNAL_VLAN(org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_DEFAULT_INTERNAL_VLAN) Event(org.onosproject.event.Event) NodeId(org.onosproject.cluster.NodeId) RouteService(org.onosproject.routeservice.RouteService) McastHandler(org.onosproject.segmentrouting.mcast.McastHandler) TopologyEvent(org.onosproject.net.topology.TopologyEvent) ClusterEvent(org.onosproject.cluster.ClusterEvent) ImmutableMap(com.google.common.collect.ImmutableMap) Device(org.onosproject.net.Device) PacketProcessor(org.onosproject.net.packet.PacketProcessor) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Instant(java.time.Instant) InterfaceIpAddress(org.onosproject.net.host.InterfaceIpAddress) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) Preconditions.checkState(com.google.common.base.Preconditions.checkState) PROP_RESPOND_TO_UNKNOWN_HOSTS(org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_RESPOND_TO_UNKNOWN_HOSTS) List(java.util.List) InboundPacket(org.onosproject.net.packet.InboundPacket) PacketContext(org.onosproject.net.packet.PacketContext) LinkService(org.onosproject.net.link.LinkService) Optional(java.util.Optional) ClusterService(org.onosproject.cluster.ClusterService) IpPrefix(org.onlab.packet.IpPrefix) McastRole(org.onosproject.segmentrouting.mcast.McastRole) McastRoleStoreKey(org.onosproject.segmentrouting.mcast.McastRoleStoreKey) MacVlanNextObjectiveStoreKey(org.onosproject.segmentrouting.storekey.MacVlanNextObjectiveStoreKey) ICMP6(org.onlab.packet.ICMP6) InterfaceConfig(org.onosproject.net.config.basics.InterfaceConfig) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) SegmentRoutingDeviceConfig(org.onosproject.segmentrouting.config.SegmentRoutingDeviceConfig) CompletableFuture(java.util.concurrent.CompletableFuture) Multimap(com.google.common.collect.Multimap) XConnectStoreKey(org.onosproject.segmentrouting.storekey.XConnectStoreKey) ACTIVE_PROBING_DEFAULT(org.onosproject.segmentrouting.OsgiPropertyConstants.ACTIVE_PROBING_DEFAULT) FlowObjectiveService(org.onosproject.net.flowobjective.FlowObjectiveService) HashSet(java.util.HashSet) L2TunnelHandler(org.onosproject.segmentrouting.pwaas.L2TunnelHandler) DefaultGroupHandler(org.onosproject.segmentrouting.grouphandler.DefaultGroupHandler) PROP_SYMMETRIC_PROBING(org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_SYMMETRIC_PROBING) PhasedRecoveryService(org.onosproject.segmentrouting.phasedrecovery.api.PhasedRecoveryService) HostEvent(org.onosproject.net.host.HostEvent) HostProbingService(org.onosproject.net.host.HostProbingService) Activate(org.osgi.service.component.annotations.Activate) EventuallyConsistentMap(org.onosproject.store.service.EventuallyConsistentMap) HostId(org.onosproject.net.HostId) SINGLE_HOMED_DOWN_DEFAULT(org.onosproject.segmentrouting.OsgiPropertyConstants.SINGLE_HOMED_DOWN_DEFAULT) ExecutorService(java.util.concurrent.ExecutorService) IpAddress(org.onlab.packet.IpAddress) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) ClusterEventListener(org.onosproject.cluster.ClusterEventListener) DefaultL2Tunnel(org.onosproject.segmentrouting.pwaas.DefaultL2Tunnel) Logger(org.slf4j.Logger) Maps(com.google.common.collect.Maps) ReferenceCardinality(org.osgi.service.component.annotations.ReferenceCardinality) TimeUnit(java.util.concurrent.TimeUnit) DeviceAdminService(org.onosproject.net.device.DeviceAdminService) L2TunnelPolicy(org.onosproject.segmentrouting.pwaas.L2TunnelPolicy) DestinationSet(org.onosproject.segmentrouting.grouphandler.DestinationSet) Modified(org.osgi.service.component.annotations.Modified) MastershipListener(org.onosproject.mastership.MastershipListener) PROP_SINGLE_HOMED_DOWN(org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_SINGLE_HOMED_DOWN) Reference(org.osgi.service.component.annotations.Reference) Collections(java.util.Collections) TopologyListener(org.onosproject.net.topology.TopologyListener) DeviceId(org.onosproject.net.DeviceId) InterfaceIpAddress(org.onosproject.net.host.InterfaceIpAddress) IpAddress(org.onlab.packet.IpAddress) ConnectPoint(org.onosproject.net.ConnectPoint) InterfaceIpAddress(org.onosproject.net.host.InterfaceIpAddress)

Example 25 with DeviceId

use of org.onosproject.net.DeviceId in project trellis-control by opennetworkinglab.

the class TopologyHandler method processTopologyChange.

/**
 * Process the TOPOLOGY_CHANGE event. An initial optimization
 * is performed to avoid the processing of not relevant events.
 *
 * @param reasons list of events that triggered topology change
 */
void processTopologyChange(List<Event> reasons) {
    // Store temporary in the map all the link events,
    // events having the same subject will be automatically
    // overridden.
    Map<Link, LinkEvent> linkEvents = Maps.newHashMap();
    // Store temporary in the map all the device events,
    // events having the same subject will be automatically
    // overridden.
    Map<DeviceId, DeviceEvent> deviceEvents = Maps.newHashMap();
    // Pre-process all the events putting them in the right map
    reasons.forEach(reason -> {
        // Relevant events for devices
        if (reason.type() == DeviceEvent.Type.DEVICE_ADDED || reason.type() == DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED || reason.type() == DeviceEvent.Type.DEVICE_UPDATED) {
            // Take the event and save in the map
            DeviceEvent deviceEvent = (DeviceEvent) reason;
            deviceEvents.put(deviceEvent.subject().id(), deviceEvent);
        // / Relevant events for links
        } else if (reason.type() == LinkEvent.Type.LINK_ADDED || reason.type() == LinkEvent.Type.LINK_UPDATED || reason.type() == LinkEvent.Type.LINK_REMOVED) {
            // Take the event and store the link in the map
            LinkEvent linkEvent = (LinkEvent) reason;
            linkEvents.put(linkEvent.subject(), linkEvent);
        // Other events are not relevant
        } else {
            log.debug("Unhandled event type: {}", reason.type());
        }
    });
    // Verify if the link events are valid
    // before sent for mcast handling
    List<LinkEvent> toProcessLinkEvent = linkEvents.values().stream().filter(this::isValid).collect(Collectors.toList());
    // Verify if the device events are valid
    // before sent for mcast handling
    List<DeviceEvent> toProcessDeviceEvent = deviceEvents.values().stream().filter(this::isValid).collect(Collectors.toList());
    // Processing part of the received events
    // We don't need to process all LINK_ADDED
    boolean isLinkAdded = false;
    // Iterate on link events
    for (LinkEvent linkEvent : toProcessLinkEvent) {
        // We process just the first one
        if (linkEvent.type() == LinkEvent.Type.LINK_ADDED || linkEvent.type() == LinkEvent.Type.LINK_UPDATED) {
            // Other ones are skipped
            if (isLinkAdded) {
                continue;
            }
            log.info("Processing - Event: {}", linkEvent);
            // First time, let's process it
            isLinkAdded = true;
            // McastHandler, reroute all the mcast tree
            srManager.mcastHandler.init();
        } else {
            log.info("Processing - Event: {}", linkEvent);
            // We compute each time a LINK_DOWN event
            srManager.mcastHandler.processLinkDown(linkEvent.subject());
        }
    }
    // Process all the device events
    toProcessDeviceEvent.forEach(deviceEvent -> {
        log.info("Processing - Event: {}", deviceEvent);
        srManager.mcastHandler.processDeviceDown(deviceEvent.subject().id());
    });
}
Also used : DeviceEvent(org.onosproject.net.device.DeviceEvent) LinkEvent(org.onosproject.net.link.LinkEvent) DeviceId(org.onosproject.net.DeviceId) Link(org.onosproject.net.Link)

Aggregations

DeviceId (org.onosproject.net.DeviceId)782 List (java.util.List)178 PortNumber (org.onosproject.net.PortNumber)170 Collectors (java.util.stream.Collectors)152 ConnectPoint (org.onosproject.net.ConnectPoint)152 Set (java.util.Set)138 DeviceService (org.onosproject.net.device.DeviceService)122 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)118 ArrayList (java.util.ArrayList)115 VlanId (org.onlab.packet.VlanId)115 Logger (org.slf4j.Logger)114 Collections (java.util.Collections)109 DefaultTrafficSelector (org.onosproject.net.flow.DefaultTrafficSelector)109 Device (org.onosproject.net.Device)107 Collection (java.util.Collection)106 Test (org.junit.Test)104 CoreService (org.onosproject.core.CoreService)103 FlowRule (org.onosproject.net.flow.FlowRule)101 ImmutableSet (com.google.common.collect.ImmutableSet)99 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)96