Java Code Examples for org.onosproject.net.ConnectPoint#equals()

The following examples show how to use org.onosproject.net.ConnectPoint#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TroubleshootManagerTest.java    From onos with Apache License 2.0 6 votes vote down vote up
@Override
public Set<Host> getConnectedHosts(ConnectPoint connectPoint) {
    if (connectPoint.equals(TOPO_FLOW_3_OUT_CP)) {
        return ImmutableSet.of(H2);
    } else if (connectPoint.equals(DUAL_LINK_1_CP_2_OUT) || connectPoint.equals(DUAL_LINK_1_CP_3_OUT) ||
            connectPoint.equals(DUAL_LINK_2_CP_2_OUT) || connectPoint.equals(DUAL_LINK_2_CP_3_OUT)) {
        return ImmutableSet.of();
    }
    if (connectPoint.equals(SINGLE_FLOW_OUT_CP) ||
            connectPoint.equals(DUAL_FLOW_OUT_CP) ||
            connectPoint.equals(GROUP_FLOW_OUT_CP) ||
            connectPoint.equals(HARDWARE_DEVICE_OUT_CP) ||
            connectPoint.equals(HARDWARE_DEVICE_10_OUT_CP) ||
            connectPoint.equals(DEFERRED_CP_2_OUT) ||
            connectPoint.equals(DUAL_LINK_3_CP_3_OUT) ||
            connectPoint.equals(ACTION_ORDER_OUT_CP)) {
        return ImmutableSet.of(H1);
    }
    if (connectPoint.equals(DUAL_HOME_CP_2_2) || connectPoint.equals(DUAL_HOME_CP_3_2)) {
        return ImmutableSet.of(DUAL_HOME_H);
    }
    return ImmutableSet.of();
}
 
Example 2
Source File: TopoIntentFilter.java    From onos with Apache License 2.0 5 votes vote down vote up
private boolean isIntentRelevant(PointToPointIntent intent,
                                 Iterable<ConnectPoint> edgePoints) {
    for (ConnectPoint point : edgePoints) {
        // Bail if intent does not involve this edge point.
        if (!point.equals(intent.filteredEgressPoint().connectPoint()) &&
                !point.equals(intent.filteredIngressPoint().connectPoint())) {
            return false;
        }
    }
    return true;
}
 
Example 3
Source File: TopoIntentFilter.java    From onos with Apache License 2.0 5 votes vote down vote up
private boolean isIntentRelevant(MultiPointToSinglePointIntent intent,
                                 Iterable<ConnectPoint> edgePoints) {
    for (ConnectPoint point : edgePoints) {
        // Bail if intent does not involve this edge point.
        if (!point.equals(intent.egressPoint()) &&
                !intent.ingressPoints().contains(point)) {
            return false;
        }
    }
    return true;
}
 
Example 4
Source File: TopoIntentFilter.java    From onos with Apache License 2.0 5 votes vote down vote up
private Link getFirstLink(ConnectPoint point, boolean ingress) {
    for (Link link : linkService.getLinks(point)) {
        if (point.equals(ingress ? link.src() : link.dst())) {
            return link;
        }
    }
    return null;
}
 
Example 5
Source File: BasicPceccHandler.java    From onos with Apache License 2.0 5 votes vote down vote up
private LinkedList<PcepValueType> createEroSubObj(Path path) {
    LinkedList<PcepValueType> subObjects = new LinkedList<>();
    List<Link> links = path.links();
    ConnectPoint source = null;
    ConnectPoint destination = null;
    IpAddress ipDstAddress = null;
    IpAddress ipSrcAddress = null;
    PcepValueType subObj = null;
    long portNo;

    for (Link link : links) {
        source = link.src();
        if (!(source.equals(destination))) {
            //set IPv4SubObject for ERO object
            portNo = source.port().toLong();
            portNo = ((portNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? portNo & SET : portNo;
            ipSrcAddress = Ip4Address.valueOf((int) portNo);
            subObj = new IPv4SubObject(ipSrcAddress.getIp4Address().toInt());
            subObjects.add(subObj);
        }

        destination = link.dst();
        portNo = destination.port().toLong();
        portNo = ((portNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? portNo & SET : portNo;
        ipDstAddress = Ip4Address.valueOf((int) portNo);
        subObj = new IPv4SubObject(ipDstAddress.getIp4Address().toInt());
        subObjects.add(subObj);
    }
    return subObjects;
}
 
Example 6
Source File: PcepTunnelProvider.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Creates list of hops for ERO object from Path.
 *
 * @param path network path
 * @return list of ERO subobjects
 */
private LinkedList<PcepValueType> createPcepPath(Path path) {
    LinkedList<PcepValueType> llSubObjects = new LinkedList<>();
    List<Link> listLink = path.links();
    ConnectPoint source = null;
    ConnectPoint destination = null;
    IpAddress ipDstAddress = null;
    IpAddress ipSrcAddress = null;
    PcepValueType subObj = null;
    long portNo;

    for (Link link : listLink) {
        source = link.src();
        if (!(source.equals(destination))) {
            //set IPv4SubObject for ERO object
            portNo = source.port().toLong();
            portNo = ((portNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? portNo & SET : portNo;
            ipSrcAddress = Ip4Address.valueOf((int) portNo);
            subObj = new IPv4SubObject(ipSrcAddress.getIp4Address().toInt());
            llSubObjects.add(subObj);
        }

        destination = link.dst();
        portNo = destination.port().toLong();
        portNo = ((portNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? portNo & SET : portNo;
        ipDstAddress = Ip4Address.valueOf((int) portNo);
        subObj = new IPv4SubObject(ipDstAddress.getIp4Address().toInt());
        llSubObjects.add(subObj);
    }

    return llSubObjects;
}
 
Example 7
Source File: HostLocationProviderTest.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public Set<Host> getConnectedHosts(ConnectPoint connectPoint) {
    ConnectPoint cp1 = new ConnectPoint(deviceId(DEV1), portNumber(INPORT));
    ConnectPoint cp2 = new ConnectPoint(deviceId(DEV4), portNumber(INPORT));
    ConnectPoint cp3 = new ConnectPoint(deviceId(DEV1), portNumber(INPORT2));
    if (connectPoint.equals(cp1)) {
        return ImmutableSet.of(HOST);
    } else if (connectPoint.equals(cp2)) {
        return ImmutableSet.of(HOST2);
    } else if (connectPoint.equals(cp3)) {
        return ImmutableSet.of(HOST3);
    } else {
        return ImmutableSet.of();
    }
}
 
Example 8
Source File: Dhcp4HandlerImpl.java    From onos with Apache License 2.0 5 votes vote down vote up
private DhcpServerInfo findServerInfoFromServer(boolean directConnFlag, ConnectPoint inPort) {
    List<DhcpServerInfo> validServerInfoList = findValidServerInfo(directConnFlag);
    DhcpServerInfo  foundServerInfo = null;
    for (DhcpServerInfo serverInfo : validServerInfoList) {
        if (inPort.equals(serverInfo.getDhcpServerConnectPoint().get())) {
            foundServerInfo = serverInfo;
            log.debug("ServerInfo found for Rcv port {} Server Connect Point {} for {}",
                    inPort, serverInfo.getDhcpServerConnectPoint(), directConnFlag ? "direct" : "indirect");
            break;
        }
    }
    return foundServerInfo;
}
 
Example 9
Source File: Dhcp6HandlerImpl.java    From onos with Apache License 2.0 5 votes vote down vote up
private DhcpServerInfo findServerInfoFromServer(boolean directConnFlag, ConnectPoint inPort) {
    List<DhcpServerInfo> validServerInfoList = findValidServerInfo(directConnFlag);
    DhcpServerInfo  foundServerInfo = null;
    for (DhcpServerInfo serverInfo : validServerInfoList) {
        if (inPort.equals(serverInfo.getDhcpServerConnectPoint().get())) {
            foundServerInfo = serverInfo;
            log.debug("ServerInfo found for Rcv port {} Server Connect Point {} for {}",
                    inPort, serverInfo.getDhcpServerConnectPoint(), directConnFlag ? "direct" : "indirect");
            break;
        }
    }
    return foundServerInfo;
}
 
Example 10
Source File: CastorArpManager.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the matching Peer or route server on a Connect Point.
 *
 * @param connectPoint The peering connect point.
 * @return Peer or Route Server
 */
private Peer getMatchingPeer(ConnectPoint connectPoint) {

    for (Peer peer : castorStore.getAllPeers()) {
        if (connectPoint.equals(ConnectPoint.deviceConnectPoint(peer.getPort()))) {
            return peer;
        }
    }
    return null;
}
 
Example 11
Source File: CastorArpManager.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Returns matching BGP Peer on a connect point.
 *
 * @param connectPoint The peering connect point.
 * @return The Peer
 */
private Peer getMatchingCustomer(ConnectPoint connectPoint) {

    for (Peer peer : castorStore.getCustomers()) {
        if (connectPoint.equals(ConnectPoint.deviceConnectPoint(peer.getPort()))) {
            return peer;
        }
    }
    return null;
}
 
Example 12
Source File: OpticalCircuitIntentCompiler.java    From onos with Apache License 2.0 4 votes vote down vote up
private boolean isAllowed(ConnectPoint circuitCp, ConnectPoint connectivityCp) {
    ConnectPoint staticPort = staticPort(circuitCp);
    return staticPort == null || staticPort.equals(connectivityCp);
}
 
Example 13
Source File: TroubleshootManagerTest.java    From onos with Apache License 2.0 4 votes vote down vote up
@Override
public Set<Link> getEgressLinks(ConnectPoint connectPoint) {
    if (connectPoint.equals(TOPO_FLOW_1_OUT_CP)
            || connectPoint.equals(TOPO_FLOW_OUT_CP_1)) {
        return ImmutableSet.of(DefaultLink.builder()
                .providerId(ProviderId.NONE)
                .type(Link.Type.DIRECT)
                .src(connectPoint)
                .dst(TOPO_FLOW_2_IN_CP)
                .build());
    } else if (connectPoint.equals(TOPO_FLOW_2_OUT_CP)) {
        return ImmutableSet.of(DefaultLink.builder()
                .providerId(ProviderId.NONE)
                .type(Link.Type.DIRECT)
                .src(TOPO_FLOW_2_OUT_CP)
                .dst(TOPO_FLOW_3_IN_CP)
                .build());
    } else if (connectPoint.equals(TOPO_FLOW_OUT_CP_2)) {
        return ImmutableSet.of(DefaultLink.builder()
                .providerId(ProviderId.NONE)
                .type(Link.Type.DIRECT)
                .src(TOPO_FLOW_OUT_CP_2)
                .dst(TOPO_FLOW_4_IN_CP)
                .build());
    } else if (connectPoint.equals(TOPO_FLOW_4_OUT_CP)) {
        return ImmutableSet.of(DefaultLink.builder()
                .providerId(ProviderId.NONE)
                .type(Link.Type.DIRECT)
                .src(TOPO_FLOW_4_OUT_CP)
                .dst(TOPO_FLOW_3_IN_2_CP)
                .build());
    } else if (connectPoint.equals(DUAL_LINK_1_CP_2_OUT)) {
        return ImmutableSet.of(DefaultLink.builder()
                .providerId(ProviderId.NONE)
                .type(Link.Type.DIRECT)
                .src(DUAL_LINK_1_CP_2_OUT)
                .dst(DUAL_LINK_2_CP_1_IN)
                .build());
    } else if (connectPoint.equals(DUAL_LINK_1_CP_3_OUT)) {
        return ImmutableSet.of(DefaultLink.builder()
                .providerId(ProviderId.NONE)
                .type(Link.Type.DIRECT)
                .src(DUAL_LINK_1_CP_3_OUT)
                .dst(DUAL_LINK_2_CP_4_IN)
                .build());
    } else if (connectPoint.equals(DUAL_LINK_2_CP_2_OUT)) {
        return ImmutableSet.of(DefaultLink.builder()
                .providerId(ProviderId.NONE)
                .type(Link.Type.DIRECT)
                .src(DUAL_LINK_2_CP_2_OUT)
                .dst(DUAL_LINK_3_CP_1_IN)
                .build());
    } else if (connectPoint.equals(DUAL_LINK_2_CP_3_OUT)) {
        return ImmutableSet.of(DefaultLink.builder()
                .providerId(ProviderId.NONE)
                .type(Link.Type.DIRECT)
                .src(DUAL_LINK_2_CP_3_OUT)
                .dst(DUAL_LINK_3_CP_2_IN)
                .build());
    } else if (connectPoint.equals(DUAL_HOME_CP_1_2)) {
        return ImmutableSet.of(DefaultLink.builder()
                .providerId(ProviderId.NONE)
                .type(Link.Type.DIRECT)
                .src(DUAL_HOME_CP_1_2)
                .dst(DUAL_HOME_CP_2_1)
                .build());
    } else if (connectPoint.equals(DUAL_HOME_CP_1_3)) {
        return ImmutableSet.of(DefaultLink.builder()
                .providerId(ProviderId.NONE)
                .type(Link.Type.DIRECT)
                .src(DUAL_HOME_CP_1_3)
                .dst(DUAL_HOME_CP_3_1)
                .build());
    }
    return ImmutableSet.of();
}
 
Example 14
Source File: TroubleshootManagerTest.java    From onos with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isEdgePoint(ConnectPoint point) {
    return point.equals(MULTICAST_OUT_CP) ||
            point.equals(MULTICAST_OUT_CP_2);
}