Class SegmentRoutingManager

    • Field Detail

      • neighbourResolutionService

        public org.onosproject.net.neighbour.NeighbourResolutionService neighbourResolutionService
      • coreService

        public org.onosproject.core.CoreService coreService
      • deviceService

        public org.onosproject.net.device.DeviceService deviceService
      • flowObjectiveService

        public org.onosproject.net.flowobjective.FlowObjectiveService flowObjectiveService
      • linkService

        public org.onosproject.net.link.LinkService linkService
      • mastershipService

        public org.onosproject.mastership.MastershipService mastershipService
      • storageService

        public org.onosproject.store.service.StorageService storageService
      • multicastRouteService

        public org.onosproject.mcast.api.MulticastRouteService multicastRouteService
      • topologyService

        public org.onosproject.net.topology.TopologyService topologyService
      • routeService

        public org.onosproject.routeservice.RouteService routeService
      • cfgService

        public org.onosproject.net.config.NetworkConfigRegistry cfgService
      • interfaceService

        public org.onosproject.net.intf.InterfaceService interfaceService
      • clusterService

        public org.onosproject.cluster.ClusterService clusterService
      • workPartitionService

        public org.onosproject.net.intent.WorkPartitionService workPartitionService
      • MIN_DUMMY_VLAN_ID

        public static final int MIN_DUMMY_VLAN_ID
        Minumum and maximum value of dummy VLAN ID to be allocated.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SegmentRoutingManager

        public SegmentRoutingManager()
    • Method Detail

      • activate

        protected void activate​(org.osgi.service.component.ComponentContext context)
      • deactivate

        protected void deactivate()
      • canUseVlanId

        public boolean canUseVlanId​(int vlanId)
        Returns true if given vlan id is not being used in the system currently, either as one of the default system wide vlans or as one of the configured interface vlans.
        Parameters:
        vlanId - given vlan id
        Returns:
        true if vlan is not currently in use
      • getDefaultInternalVlan

        public org.onlab.packet.VlanId getDefaultInternalVlan()
        Description copied from interface: SegmentRoutingService
        Returns the VlanId assigned internally by default to unconfigured ports.
        Specified by:
        getDefaultInternalVlan in interface SegmentRoutingService
        Returns:
        the default internal vlan id
      • getPwTransportVlan

        public org.onlab.packet.VlanId getPwTransportVlan()
        Returns the Vlan id used to transport pseudowire traffic across the network.
        Returns:
        the pseudowire transport vlan id
      • createTunnel

        public TunnelHandler.Result createTunnel​(Tunnel tunnel)
        Description copied from interface: SegmentRoutingService
        Creates a tunnel.
        Specified by:
        createTunnel in interface SegmentRoutingService
        Parameters:
        tunnel - tunnel reference to create
        Returns:
        WRONG_PATH if the tunnel path is wrong, ID_EXISTS if the tunnel ID exists already, TUNNEL_EXISTS if the same tunnel exists, INTERNAL_ERROR if the tunnel creation failed internally, SUCCESS if the tunnel is created successfully
      • removeTunnel

        public TunnelHandler.Result removeTunnel​(Tunnel tunnel)
        Description copied from interface: SegmentRoutingService
        Removes a tunnel.
        Specified by:
        removeTunnel in interface SegmentRoutingService
        Parameters:
        tunnel - tunnel reference to remove
        Returns:
        TUNNEL_NOT_FOUND if the tunnel to remove does not exists, INTERNAL_ERROR if the tunnel creation failed internally, SUCCESS if the tunnel is created successfully.
      • createPolicy

        public PolicyHandler.Result createPolicy​(Policy policy)
        Description copied from interface: SegmentRoutingService
        Creates a policy.
        Specified by:
        createPolicy in interface SegmentRoutingService
        Parameters:
        policy - policy reference to create
        Returns:
        ID_EXISTS if the same policy ID exists, POLICY_EXISTS if the same policy exists, TUNNEL_NOT_FOUND if the tunnel does not exists, UNSUPPORTED_TYPE if the policy type is not supported, SUCCESS if the policy is created successfully.
      • getPwInitNext

        public com.google.common.collect.ImmutableMap<String,​org.onosproject.net.flowobjective.NextObjective> getPwInitNext()
        Description copied from interface: SegmentRoutingService
        Returns the PW init next objective store.
        Specified by:
        getPwInitNext in interface SegmentRoutingService
        Returns:
        current contents of the l2InitiationNextObjStore
      • getPwTermNext

        public com.google.common.collect.ImmutableMap<String,​org.onosproject.net.flowobjective.NextObjective> getPwTermNext()
        Description copied from interface: SegmentRoutingService
        Returns the PW termination next objective store.
        Specified by:
        getPwTermNext in interface SegmentRoutingService
        Returns:
        current contents of the l2TerminationNextObjStore
      • invalidateNextObj

        public void invalidateNextObj​(int nextId)
        Description copied from interface: SegmentRoutingService
        Removes all entries in dst/vlan/port/mcast NextObjectiveStore that are associated with the given nextId.
        Specified by:
        invalidateNextObj in interface SegmentRoutingService
        Parameters:
        nextId - nextId
      • verifyGroups

        public void verifyGroups​(org.onosproject.net.DeviceId id)
        Description copied from interface: SegmentRoutingService
        Triggers the verification of all ECMP groups in the specified device. Adjusts the group buckets if verification finds that there are more or less buckets than what should be there.
        Specified by:
        verifyGroups in interface SegmentRoutingService
        Parameters:
        id - the device identifier
      • getSeenLinks

        public com.google.common.collect.ImmutableMap<org.onosproject.net.Link,​Boolean> getSeenLinks()
        Description copied from interface: SegmentRoutingService
        Returns the internal link state as seen by this instance of the controller.
        Specified by:
        getSeenLinks in interface SegmentRoutingService
        Returns:
        the internal link state
      • getDownedPortState

        public com.google.common.collect.ImmutableMap<org.onosproject.net.DeviceId,​Set<org.onosproject.net.PortNumber>> getDownedPortState()
        Description copied from interface: SegmentRoutingService
        Returns the ports administratively disabled by the controller.
        Specified by:
        getDownedPortState in interface SegmentRoutingService
        Returns:
        a map of devices and port numbers for administratively disabled ports. Does not include ports manually disabled by the operator.
      • getMcastNextIds

        public Map<McastStoreKey,​Integer> getMcastNextIds​(org.onlab.packet.IpAddress mcastIp)
        Description copied from interface: SegmentRoutingService
        Returns the associated next ids to the mcast groups or to the single group if mcastIp is present.
        Specified by:
        getMcastNextIds in interface SegmentRoutingService
        Parameters:
        mcastIp - the group ip
        Returns:
        the mapping mcastIp-device to next id
      • getMcastRoles

        public Map<McastRoleStoreKey,​McastRole> getMcastRoles​(org.onlab.packet.IpAddress mcastIp,
                                                                    org.onosproject.net.ConnectPoint sourcecp)
        Description copied from interface: SegmentRoutingService
        Returns the associated roles to the mcast groups.
        Specified by:
        getMcastRoles in interface SegmentRoutingService
        Parameters:
        mcastIp - the group ip
        sourcecp - the source connect point
        Returns:
        the mapping mcastIp-device to mcast role
      • getMcastTrees

        public com.google.common.collect.Multimap<org.onosproject.net.ConnectPoint,​List<org.onosproject.net.ConnectPoint>> getMcastTrees​(org.onlab.packet.IpAddress mcastIp,
                                                                                                                                               org.onosproject.net.ConnectPoint sourcecp)
        Description copied from interface: SegmentRoutingService
        Returns the associated trees to the mcast group.
        Specified by:
        getMcastTrees in interface SegmentRoutingService
        Parameters:
        mcastIp - the group ip
        sourcecp - the source connect point
        Returns:
        the mapping egress point to mcast path
      • getMcastLeaders

        public Map<org.onlab.packet.IpAddress,​org.onosproject.cluster.NodeId> getMcastLeaders​(org.onlab.packet.IpAddress mcastIp)
        Description copied from interface: SegmentRoutingService
        Return the leaders of the mcast groups.
        Specified by:
        getMcastLeaders in interface SegmentRoutingService
        Parameters:
        mcastIp - the group ip
        Returns:
        the mapping group-node
      • shouldProgram

        public boolean shouldProgram​(org.onosproject.net.DeviceId deviceId)
        Description copied from interface: SegmentRoutingService
        Determines whether this controller instance should program the given deviceId, based on work partition service and pairDeviceId if one exists.

        Once an instance is elected, it will be the only instance responsible for programming both devices in the pair until it goes down.

        Specified by:
        shouldProgram in interface SegmentRoutingService
        Parameters:
        deviceId - device identifier to consider for routing
        Returns:
        true if current instance should handle the routing for given device
      • isRoutingStable

        public boolean isRoutingStable()
        Description copied from interface: SegmentRoutingService
        Determines if routing in the network has been stable in the last STABILITY_THRESHOLD seconds, by comparing the current time to the last routing change timestamp.
        Specified by:
        isRoutingStable in interface SegmentRoutingService
        Returns:
        true if stable
      • initHost

        public void initHost​(org.onosproject.net.DeviceId deviceId)
        Description copied from interface: SegmentRoutingService
        Invoke hostHandler.init() for given device.
        Specified by:
        initHost in interface SegmentRoutingService
        Parameters:
        deviceId - device ID
      • initRoute

        public void initRoute​(org.onosproject.net.DeviceId deviceId)
        Description copied from interface: SegmentRoutingService
        Invoke routeHandler.init() for given device.
        Specified by:
        initRoute in interface SegmentRoutingService
        Parameters:
        deviceId - device ID
      • deviceConfiguration

        public DeviceConfiguration deviceConfiguration()
        Returns the device configuration.
        Returns:
        device configuration
      • dsNextObjStore

        public org.onosproject.store.service.EventuallyConsistentMap<DestinationSetNextObjectiveStoreKey,​NextNeighbors> dsNextObjStore()
        Per device next objective ID store with (device id + destination set) as key. Used to keep track on MPLS group information.
        Returns:
        next objective ID store
      • vlanNextObjStore

        public org.onosproject.store.service.EventuallyConsistentMap<VlanNextObjectiveStoreKey,​Integer> vlanNextObjStore()
        Per device next objective ID store with (device id + vlanid) as key. Used to keep track on L2 flood group information.
        Returns:
        vlan next object store
      • macVlanNextObjStore

        public org.onosproject.store.service.EventuallyConsistentMap<MacVlanNextObjectiveStoreKey,​Integer> macVlanNextObjStore()
        Per device next objective ID store with (device id + MAC address + vlan) as key. Used to keep track on L3 Unicast group information for indirect hosts.
        Returns:
        mac vlan next object store
      • portNextObjStore

        public org.onosproject.store.service.EventuallyConsistentMap<PortNextObjectiveStoreKey,​Integer> portNextObjStore()
        Per device next objective ID store with (device id + port + treatment + meta) as key. Used to keep track on L2 interface group and L3 unicast group information for direct hosts.
        Returns:
        port next object store.
      • getMplsEcmp

        public boolean getMplsEcmp()
        Returns the MPLS-ECMP configuration which indicates whether ECMP on labeled packets should be programmed or not.
        Returns:
        MPLS-ECMP value
      • getTunnel

        public Tunnel getTunnel​(String tunnelId)
        Returns the tunnel object with the tunnel ID.
        Parameters:
        tunnelId - Tunnel ID
        Returns:
        Tunnel reference
      • getInternalVlanId

        public org.onlab.packet.VlanId getInternalVlanId​(org.onosproject.net.ConnectPoint connectPoint)
        Description copied from interface: SegmentRoutingService
        Returns internal VLAN for untagged hosts on given connect point.

        The internal VLAN is either vlan-untagged for an access port, or vlan-native for a trunk port.

        Specified by:
        getInternalVlanId in interface SegmentRoutingService
        Parameters:
        connectPoint - connect point
        Returns:
        internal VLAN or null if both vlan-untagged and vlan-native are undefined
      • getPairDeviceId

        public Optional<org.onosproject.net.DeviceId> getPairDeviceId​(org.onosproject.net.DeviceId deviceId)
        Description copied from interface: SegmentRoutingService
        Returns optional pair device ID of given device.
        Specified by:
        getPairDeviceId in interface SegmentRoutingService
        Parameters:
        deviceId - device ID
        Returns:
        optional pair device ID. Might be empty if pair device is not configured
      • getPairLocalPort

        public Optional<org.onosproject.net.PortNumber> getPairLocalPort​(org.onosproject.net.DeviceId deviceId)
        Description copied from interface: SegmentRoutingService
        Returns optional pair device local port of given device.
        Specified by:
        getPairLocalPort in interface SegmentRoutingService
        Parameters:
        deviceId - device ID
        Returns:
        optional pair device ID. Might be empty if pair device is not configured
      • getInfraPorts

        public Set<org.onosproject.net.PortNumber> getInfraPorts​(org.onosproject.net.DeviceId deviceId)
        Description copied from interface: SegmentRoutingService
        Returns a set of infrastructure ports on the given device.
        Specified by:
        getInfraPorts in interface SegmentRoutingService
        Parameters:
        deviceId - device ID
        Returns:
        a set of ports that does not have interface configuration
      • getEdgePorts

        public Set<org.onosproject.net.PortNumber> getEdgePorts​(org.onosproject.net.DeviceId deviceId)
        Description copied from interface: SegmentRoutingService
        Returns a set of edge ports on the given device.
        Specified by:
        getEdgePorts in interface SegmentRoutingService
        Parameters:
        deviceId - device ID
        Returns:
        a set of ports that has interface configuration
      • getDeviceMacAddress

        public org.onlab.packet.MacAddress getDeviceMacAddress​(org.onosproject.net.DeviceId deviceId)
                                                        throws org.onosproject.segmentrouting.config.DeviceConfigNotFoundException
        Description copied from interface: SegmentRoutingService
        Returns the configured mac address of the device.
        Specified by:
        getDeviceMacAddress in interface SegmentRoutingService
        Parameters:
        deviceId - the device id
        Returns:
        the configured mac address
        Throws:
        org.onosproject.segmentrouting.config.DeviceConfigNotFoundException - if config is not present
      • nextHopLocations

        public Set<org.onosproject.net.ConnectPoint> nextHopLocations​(org.onosproject.routeservice.ResolvedRoute resolvedRoute)
        Returns locations of given resolved route.
        Parameters:
        resolvedRoute - resolved route
        Returns:
        locations of nexthop. Might be empty if next hop is not found
      • getVlanPortMap

        public com.google.common.collect.Multimap<org.onlab.packet.VlanId,​org.onosproject.net.PortNumber> getVlanPortMap​(org.onosproject.net.DeviceId deviceId)
        Returns vlan port map of given device.
        Parameters:
        deviceId - device id
        Returns:
        vlan-port multimap
      • getPortNextObjectiveId

        public int getPortNextObjectiveId​(org.onosproject.net.DeviceId deviceId,
                                          org.onosproject.net.PortNumber portNum,
                                          org.onosproject.net.flow.TrafficTreatment treatment,
                                          org.onosproject.net.flow.TrafficSelector meta,
                                          boolean createIfMissing)
        Returns the next objective ID for the given portNumber, given the treatment. There could be multiple different treatments to the same outport, which would result in different objectives. If the next object does not exist, and should be created, a new one is created and its id is returned.
        Parameters:
        deviceId - Device ID
        portNum - port number on device for which NextObjective is queried
        treatment - the actions to apply on the packets (should include outport)
        meta - metadata passed into the creation of a Next Objective if necessary
        createIfMissing - true if a next object should be created if not found
        Returns:
        next objective ID or -1 if an error occurred during retrieval or creation
      • getMacVlanNextObjectiveId

        public int getMacVlanNextObjectiveId​(org.onosproject.net.DeviceId deviceId,
                                             org.onlab.packet.MacAddress macAddr,
                                             org.onlab.packet.VlanId vlanId,
                                             org.onosproject.net.PortNumber port,
                                             boolean createIfMissing)
        Returns the next Objective ID for the given mac and vlan, given the treatment. There could be multiple different treatments to the same outport, which would result in different objectives. If the next object does not exist, and should be created, a new one is created and its id is returned.
        Parameters:
        deviceId - Device ID
        macAddr - mac of host for which Next ID is required.
        vlanId - vlan of host for which Next ID is required.
        port - port with which to create the Next Obj.
        createIfMissing - true if a next object should be created if not found
        Returns:
        next objective ID or -1 if an error occurred during retrieval or creation
      • updateMacVlanTreatment

        public void updateMacVlanTreatment​(org.onosproject.net.DeviceId deviceId,
                                           org.onlab.packet.MacAddress hostMac,
                                           org.onlab.packet.VlanId hostVlanId,
                                           org.onosproject.net.PortNumber port,
                                           int nextId)
        Updates the next objective for the given nextId .
        Parameters:
        deviceId - Device ID
        hostMac - mac of host for which Next obj is to be updated.
        hostVlanId - vlan of host for which Next obj is to be updated.
        port - port with which to update the Next Obj.
        nextId - of Next Obj which needs to be updated.
      • getRoutingHandler

        public DefaultRoutingHandler getRoutingHandler()
        Returns the default routing handler object.
        Returns:
        the default routing handler object
      • registerConnectPoint

        public void registerConnectPoint​(org.onosproject.net.ConnectPoint portToRegister)
        Registers the given connect point with the NRS, this is necessary to receive the NDP and ARP packets from the NRS.
        Parameters:
        portToRegister - connect point to register