Java Code Examples for org.onosproject.net.Port#type()
The following examples show how to use
org.onosproject.net.Port#type() .
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: DefaultTributarySlotQuery.java From onos with Apache License 2.0 | 6 votes |
@Override public Set<TributarySlot> queryTributarySlots(PortNumber port) { // currently return all slots by default. DeviceService deviceService = opticalView(this.handler().get(DeviceService.class)); Port p = deviceService.getPort(this.data().deviceId(), port); if (p == null) { return Collections.emptySet(); } switch (p.type()) { case OCH: return queryOchTributarySlots(p); case OTU: return queryOtuTributarySlots(p); default: return Collections.emptySet(); } }
Example 2
Source File: CzechLightLambdaQuery.java From onos with Apache License 2.0 | 6 votes |
@Override public Set<OchSignal> queryLambdas(PortNumber portNumber) { DeviceService deviceService = this.handler().get(DeviceService.class); Port port = deviceService.getPort(data().deviceId(), portNumber); if ((port.type() == Port.Type.FIBER) || (port.type() == Port.Type.OMS)) { final int startMultiplier50 = (int) (START_CENTER_FREQ_50.subtract(Spectrum.CENTER_FREQUENCY).asHz() / Frequency.ofGHz(50).asHz()); final int endMultiplier50 = (int) (END_CENTER_FREQ_50.subtract(Spectrum.CENTER_FREQUENCY).asHz() / Frequency.ofGHz(50).asHz()); return IntStream.range(startMultiplier50, endMultiplier50 + 1) .mapToObj(x -> OchSignal.newDwdmSlot(ChannelSpacing.CHL_50GHZ, x)) .collect(Collectors.toSet()); } else { return Collections.emptySet(); } }
Example 3
Source File: LumentumRoadmLambdaQuery.java From onos with Apache License 2.0 | 5 votes |
@Override public Set<OchSignal> queryLambdas(PortNumber portNumber) { DeviceService deviceService = this.handler().get(DeviceService.class); Port port = deviceService.getPort(data().deviceId(), portNumber); if ((port.type() == Port.Type.FIBER) || (port.type() == Port.Type.OMS)) { //Complete set of 50GHz OchSignal int startMultiplier50 = (int) (START_CENTER_FREQ_50.subtract(Spectrum.CENTER_FREQUENCY).asHz() / Frequency.ofGHz(50).asHz()); Set<OchSignal> channels50 = IntStream.range(0, LAMBDA_COUNT_50) .mapToObj(x -> new OchSignal(GRID_TYPE, CHANNEL_SPACING_50, startMultiplier50 + x, 4)) .collect(Collectors.toSet()); /*//Complete set of 100GHz OchSignal int startMultiplier100 = (int) (START_CENTER_FREQ_100.subtract(Spectrum.CENTER_FREQUENCY).asHz() / Frequency.ofGHz(100).asHz()); Set<OchSignal> channels100 = IntStream.range(0, LAMBDA_COUNT_100) .mapToObj(x -> new OchSignal(GRID_TYPE, CHANNEL_SPACING_100, startMultiplier100 + x, 8)) .collect(Collectors.toSet()); Set<OchSignal> channels = Sets.union(channels50, channels100);*/ return channels50; } else { return Collections.emptySet(); } }
Example 4
Source File: SimpleDeviceStore.java From onos with Apache License 2.0 | 5 votes |
private DeviceEvent updatePort(Device device, Port oldPort, Port newPort, Map<PortNumber, Port> ports) { if (oldPort.isEnabled() != newPort.isEnabled() || oldPort.type() != newPort.type() || oldPort.portSpeed() != newPort.portSpeed() || !AnnotationsUtil.isEqual(oldPort.annotations(), newPort.annotations())) { ports.put(oldPort.number(), newPort); return new DeviceEvent(PORT_UPDATED, device, newPort); } return null; }
Example 5
Source File: GossipDeviceStore.java From onos with Apache License 2.0 | 5 votes |
private DeviceEvent updatePort(Device device, Port oldPort, Port newPort, Map<PortNumber, Port> ports) { if (oldPort.isEnabled() != newPort.isEnabled() || oldPort.type() != newPort.type() || oldPort.portSpeed() != newPort.portSpeed() || !AnnotationsUtil.isEqual(oldPort.annotations(), newPort.annotations())) { ports.put(oldPort.number(), newPort); return new DeviceEvent(PORT_UPDATED, device, newPort); } return null; }
Example 6
Source File: OduCltPortMapper.java From onos with Apache License 2.0 | 4 votes |
@Override public boolean is(Port port) { return port != null && port.type() == Port.Type.ODUCLT && super.is(port); }
Example 7
Source File: OchPortMapper.java From onos with Apache License 2.0 | 4 votes |
@Override public boolean is(Port port) { return port != null && port.type() == Port.Type.OCH && super.is(port); }
Example 8
Source File: OtuPortMapper.java From onos with Apache License 2.0 | 4 votes |
@Override public boolean is(Port port) { return port != null && port.type() == Port.Type.OTU && super.is(port); }
Example 9
Source File: OmsPortMapper.java From onos with Apache License 2.0 | 4 votes |
@Override public boolean is(Port port) { return port != null && port.type() == Port.Type.OMS && super.is(port); }
Example 10
Source File: OpticalPortsListCommand.java From onos with Apache License 2.0 | 4 votes |
@Override protected void printPorts(DeviceService service, Device device) { List<Port> ports = new ArrayList<>(service.getPorts(device.id())); ports.sort((p1, p2) -> Long.signum(p1.number().toLong() - p2.number().toLong()) ); for (Port port : ports) { if (!isIncluded(port)) { continue; } String portName = port.number().toString(); String portIsEnabled = port.isEnabled() ? "enabled" : "disabled"; String portType = port.type().toString().toLowerCase(); switch (port.type()) { case OCH: if (port instanceof OchPort) { OchPort och = (OchPort) port; print(FMT_OCH, portName, portIsEnabled, portType, och.signalType().toString(), och.isTunable() ? "yes" : "no", annotations(och.unhandledAnnotations())); break; } print("WARN: OchPort but not on OpticalDevice or ill-formed"); print(FMT, portName, portIsEnabled, portType, port.portSpeed(), annotations(port.annotations())); break; case ODUCLT: if (port instanceof OduCltPort) { OduCltPort oduCltPort = (OduCltPort) port; print(FMT_ODUCLT_OTU, portName, portIsEnabled, portType, oduCltPort.signalType().toString(), annotations(oduCltPort.unhandledAnnotations())); break; } print("WARN: OduCltPort but not on OpticalDevice or ill-formed"); print(FMT, portName, portIsEnabled, portType, port.portSpeed(), annotations(port.annotations())); break; case OMS: if (port instanceof OmsPort) { OmsPort oms = (OmsPort) port; print(FMT_OMS, portName, portIsEnabled, portType, oms.minFrequency().asHz() / Frequency.ofGHz(1).asHz(), oms.maxFrequency().asHz() / Frequency.ofGHz(1).asHz(), oms.grid().asHz() / Frequency.ofGHz(1).asHz(), oms.totalChannels(), annotations(oms.unhandledAnnotations())); break; } print("WARN: OmsPort but not on OpticalDevice or ill-formed"); print(FMT, portName, portIsEnabled, portType, port.portSpeed(), annotations(port.annotations())); break; case OTU: if (port instanceof OtuPort) { OtuPort otuPort = (OtuPort) port; print(FMT_ODUCLT_OTU, portName, portIsEnabled, portType, otuPort.signalType().toString(), annotations(otuPort.unhandledAnnotations())); break; } print("WARN: OtuPort but not on OpticalDevice or ill-formed"); print(FMT, portName, portIsEnabled, portType, port.portSpeed(), annotations(port.annotations())); break; default: // do not print non-optical ports break; } } }