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();
}
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);
}
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));
}
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);
}
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;
}
Aggregations