Search in sources :

Example 81 with ConnectPoint

use of org.onosproject.net.ConnectPoint 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)

Example 82 with ConnectPoint

use of org.onosproject.net.ConnectPoint in project onos by opennetworkinglab.

the class OplinkHandshakerUtil method removeLink.

// Remove incoming link with port if there are any.
private void removeLink(PortNumber portNumber) {
    ConnectPoint dst = new ConnectPoint(driver.handler().data().deviceId(), portNumber);
    // Check so only incoming links are removed
    Set<Link> links = driver.handler().get(LinkService.class).getIngressLinks(dst);
    // If link exists, remove it, otherwise return
    if (links.isEmpty()) {
        return;
    }
    log.debug("Remove link for {}.", dst);
    driver.handler().get(OpticalAdjacencyLinkService.class).linksVanished(dst);
}
Also used : OpticalAdjacencyLinkService(org.onosproject.drivers.optical.OpticalAdjacencyLinkService) ConnectPoint(org.onosproject.net.ConnectPoint) OpticalAdjacencyLinkService(org.onosproject.drivers.optical.OpticalAdjacencyLinkService) LinkService(org.onosproject.net.link.LinkService) Link(org.onosproject.net.Link)

Example 83 with ConnectPoint

use of org.onosproject.net.ConnectPoint in project onos by opennetworkinglab.

the class OplinkHandshakerUtil method addLink.

// Add incoming link with port
private void addLink(PortNumber portNumber, OplinkPortAdjacency neighbor) {
    ConnectPoint dst = new ConnectPoint(driver.handler().data().deviceId(), portNumber);
    Set<Link> links = driver.handler().get(LinkService.class).getIngressLinks(dst);
    // find out if the new report link is the same as before
    for (Link link : links) {
        if (link.src().port().equals(neighbor.getPort())) {
            return;
        }
    }
    OpticalAdjacencyLinkService adService = driver.handler().get(OpticalAdjacencyLinkService.class);
    // remove the old link of destination connect point
    if (!links.isEmpty()) {
        log.debug("Remove link of destination {}.", dst);
        adService.linksVanished(dst);
    }
    // add the new link
    ConnectPoint src = new ConnectPoint(neighbor.getDeviceId(), neighbor.getPort());
    log.debug("Add link from {} to {}.", src, dst);
    adService.linkDetected(new DefaultLinkDescription(src, dst, Link.Type.OPTICAL));
}
Also used : OpticalAdjacencyLinkService(org.onosproject.drivers.optical.OpticalAdjacencyLinkService) ConnectPoint(org.onosproject.net.ConnectPoint) OpticalAdjacencyLinkService(org.onosproject.drivers.optical.OpticalAdjacencyLinkService) LinkService(org.onosproject.net.link.LinkService) Link(org.onosproject.net.Link) DefaultLinkDescription(org.onosproject.net.link.DefaultLinkDescription)

Example 84 with ConnectPoint

use of org.onosproject.net.ConnectPoint in project onos by opennetworkinglab.

the class OplinkOpticalProtectionSwitchConfig method getProtectionEndpointConfigs.

@Override
public CompletableFuture<Map<ConnectPoint, ProtectedTransportEndpointDescription>> getProtectionEndpointConfigs() {
    // There are two underlying transport entity endpoints in the device.
    Map<ConnectPoint, ProtectedTransportEndpointDescription> map = new HashMap<>();
    map.put(new ConnectPoint(data().deviceId(), PORT_VIRTUAL), buildProtectedTransportEndpointDescription());
    return CompletableFuture.completedFuture(map);
}
Also used : ProtectedTransportEndpointDescription(org.onosproject.net.behaviour.protection.ProtectedTransportEndpointDescription) HashMap(java.util.HashMap) ConnectPoint(org.onosproject.net.ConnectPoint) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint)

Example 85 with ConnectPoint

use of org.onosproject.net.ConnectPoint in project onos by opennetworkinglab.

the class OplinkSwitchProtection method createProtectionEndpoint.

@Override
public CompletableFuture<ConnectPoint> createProtectionEndpoint(ProtectedTransportEndpointDescription configuration) {
    // This OPS device only support one protection group of port 2 and port 3
    CompletableFuture result = new CompletableFuture<ConnectPoint>();
    // add flow from client port to virtual port. This set device in auto switch mode
    addFlow(PortNumber.portNumber(VIRTUAL_PORT));
    // add a virtual link between two virtual ports of this device and peer
    addLinkToPeer(configuration.peer());
    result.complete(new ConnectPoint(data().deviceId(), PortNumber.portNumber(VIRTUAL_PORT)));
    return result;
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) ConnectPoint(org.onosproject.net.ConnectPoint) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint)

Aggregations

ConnectPoint (org.onosproject.net.ConnectPoint)536 Test (org.junit.Test)149 DeviceId (org.onosproject.net.DeviceId)125 FilteredConnectPoint (org.onosproject.net.FilteredConnectPoint)91 Link (org.onosproject.net.Link)88 Set (java.util.Set)86 PortNumber (org.onosproject.net.PortNumber)86 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)83 VlanId (org.onlab.packet.VlanId)78 TrafficSelector (org.onosproject.net.flow.TrafficSelector)75 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)72 Logger (org.slf4j.Logger)71 Port (org.onosproject.net.Port)70 List (java.util.List)69 Ethernet (org.onlab.packet.Ethernet)69 DeviceService (org.onosproject.net.device.DeviceService)67 Collectors (java.util.stream.Collectors)66 MacAddress (org.onlab.packet.MacAddress)64 DefaultTrafficSelector (org.onosproject.net.flow.DefaultTrafficSelector)64 Intent (org.onosproject.net.intent.Intent)62