Search in sources :

Example 1 with EDGE

use of org.onosproject.net.Link.Type.EDGE in project onos by opennetworkinglab.

the class HostToHostIntentCompiler method createLinkCollectionIntent.

private Intent createLinkCollectionIntent(Path path, Host src, Host dst, HostToHostIntent intent) {
    // Try to allocate bandwidth
    List<ConnectPoint> pathCPs = path.links().stream().flatMap(l -> Stream.of(l.src(), l.dst())).collect(Collectors.toList());
    allocateBandwidth(intent, pathCPs);
    Link ingressLink = path.links().get(0);
    Link egressLink = path.links().get(path.links().size() - 1);
    FilteredConnectPoint ingressPoint = getFilteredPointFromLink(ingressLink);
    FilteredConnectPoint egressPoint = getFilteredPointFromLink(egressLink);
    TrafficSelector selector = builder(intent.selector()).matchEthSrc(src.mac()).matchEthDst(dst.mac()).build();
    /*
         * The path contains also the edge links, these are not necessary
         * for the LinkCollectionIntent.
         */
    Set<Link> coreLinks = path.links().stream().filter(link -> !link.type().equals(EDGE)).collect(Collectors.toSet());
    return LinkCollectionIntent.builder().key(intent.key()).appId(intent.appId()).selector(selector).treatment(intent.treatment()).links(coreLinks).filteredIngressPoints(ImmutableSet.of(ingressPoint)).filteredEgressPoints(ImmutableSet.of(egressPoint)).applyTreatmentOnEgress(true).constraints(intent.constraints()).priority(intent.priority()).resourceGroup(intent.resourceGroup()).build();
}
Also used : Arrays(java.util.Arrays) Host(org.onosproject.net.Host) AsymmetricPathConstraint(org.onosproject.net.intent.constraint.AsymmetricPathConstraint) IntentCompilationException(org.onosproject.net.intent.IntentCompilationException) Link(org.onosproject.net.Link) HostService(org.onosproject.net.host.HostService) ConnectPoint(org.onosproject.net.ConnectPoint) ArrayList(java.util.ArrayList) Component(org.osgi.service.component.annotations.Component) TrafficSelector(org.onosproject.net.flow.TrafficSelector) ImmutableList(com.google.common.collect.ImmutableList) DefaultPath(org.onosproject.net.DefaultPath) Intent(org.onosproject.net.intent.Intent) Activate(org.osgi.service.component.annotations.Activate) DefaultLink(org.onosproject.net.DefaultLink) ImmutableSet(com.google.common.collect.ImmutableSet) Logger(org.slf4j.Logger) HostToHostIntent(org.onosproject.net.intent.HostToHostIntent) Deactivate(org.osgi.service.component.annotations.Deactivate) Set(java.util.Set) LinkCollectionIntent(org.onosproject.net.intent.LinkCollectionIntent) DefaultTrafficSelector.builder(org.onosproject.net.flow.DefaultTrafficSelector.builder) Collectors(java.util.stream.Collectors) ReferenceCardinality(org.osgi.service.component.annotations.ReferenceCardinality) Objects(java.util.Objects) List(java.util.List) Stream(java.util.stream.Stream) LoggerFactory.getLogger(org.slf4j.LoggerFactory.getLogger) EDGE(org.onosproject.net.Link.Type.EDGE) Path(org.onosproject.net.Path) Reference(org.osgi.service.component.annotations.Reference) DeviceId(org.onosproject.net.DeviceId) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint) TrafficSelector(org.onosproject.net.flow.TrafficSelector) ConnectPoint(org.onosproject.net.ConnectPoint) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint) Link(org.onosproject.net.Link) DefaultLink(org.onosproject.net.DefaultLink) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 List (java.util.List)1 Objects (java.util.Objects)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 ConnectPoint (org.onosproject.net.ConnectPoint)1 DefaultLink (org.onosproject.net.DefaultLink)1 DefaultPath (org.onosproject.net.DefaultPath)1 DeviceId (org.onosproject.net.DeviceId)1 FilteredConnectPoint (org.onosproject.net.FilteredConnectPoint)1 Host (org.onosproject.net.Host)1 Link (org.onosproject.net.Link)1 EDGE (org.onosproject.net.Link.Type.EDGE)1 Path (org.onosproject.net.Path)1 DefaultTrafficSelector.builder (org.onosproject.net.flow.DefaultTrafficSelector.builder)1 TrafficSelector (org.onosproject.net.flow.TrafficSelector)1