Java Code Examples for org.onosproject.net.PortNumber#toString()

The following examples show how to use org.onosproject.net.PortNumber#toString() . 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: DefaultMep.java    From onos with Apache License 2.0 6 votes vote down vote up
protected DefaultMepBuilder(MepId mepId, DeviceId deviceId, PortNumber port,
        MepDirection direction, MdId mdId, MaIdShort maId)
        throws CfmConfigException {
    if (port.isLogical()) {
        throw new CfmConfigException("Port must be physical. Rejecting; " + port.toString());
    } else if (mepId == null) {
        throw new CfmConfigException("MepId is null");
    } else if (mdId == null) {
        throw new CfmConfigException("MdId is null");
    } else if (maId == null) {
        throw new CfmConfigException("MaId is null");
    }
    this.mepId = mepId;
    this.deviceId = deviceId;
    this.port = port;
    this.direction = direction;
    this.mdId = mdId;
    this.maId = maId;
}
 
Example 2
Source File: OpticalCircuitIntentCompilerTest.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public Port getPort(DeviceId deviceId, PortNumber portNumber) {
    if (deviceId.equals(deviceId(DEV1))) {
        switch (portNumber.toString()) {
            case "1":
                return D1P1;
            case "2":
                return D1P2;
            case "3":
                return D1P3;
            default:
                return null;
        }
    }
    if (deviceId.equals(deviceId(DEV2))) {
        switch (portNumber.toString()) {
            case "1":
                return D2P1;
            case "2":
                return D2P2;
            case "3":
                return D2P3;
            default:
                return null;
        }
    }
    return null;
}
 
Example 3
Source File: OpticalOduIntentCompilerTest.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public Port getPort(DeviceId deviceId, PortNumber portNumber) {
    if (deviceId.equals(deviceId(DEV1))) {
        switch (portNumber.toString()) {
            case "1":
                return D1P1;
            case "2":
                return D1P2;
            case "3":
                return D1P3;
            default:
                return null;
        }
    }
    if (deviceId.equals(deviceId(DEV2))) {
        switch (portNumber.toString()) {
            case "1":
                return D2P1;
            case "2":
                return D2P2;
            default:
                return null;
        }
    }
    if (deviceId.equals(deviceId(DEV3))) {
        switch (portNumber.toString()) {
            case "1":
                return D3P1;
            case "2":
                return D3P2;
            case "3":
                return D3P3;
            default:
                return null;
        }
    }
    return null;
}
 
Example 4
Source File: PiReplicationGroupTranslatorImpl.java    From onos with Apache License 2.0 5 votes vote down vote up
private static PortNumber logicalToPipelineSpecific(
        PortNumber logicalPort, Device device)
        throws PiTranslationException {
    if (!device.is(PiPipelineInterpreter.class)) {
        throw new PiTranslationException(
                "missing interpreter, cannot map logical port " + logicalPort.toString());
    }
    final PiPipelineInterpreter interpreter = device.as(PiPipelineInterpreter.class);
    Optional<Integer> mappedPort = interpreter.mapLogicalPortNumber(logicalPort);
    if (!mappedPort.isPresent()) {
        throw new PiTranslationException(
                "interpreter cannot map logical port " + logicalPort.toString());
    }
    return PortNumber.portNumber(mappedPort.get());
}
 
Example 5
Source File: PortQueryVlansCommand.java    From onos with Apache License 2.0 4 votes vote down vote up
private String portName(PortNumber port) {
    return port.equals(PortNumber.LOCAL) ? "local" : port.toString();
}
 
Example 6
Source File: PortCodec.java    From onos with Apache License 2.0 4 votes vote down vote up
private String portName(PortNumber port) {
    return port.equals(PortNumber.LOCAL) ? PORT_NAME_LOCAL : port.toString();
}