/** * Creates ODU client port description based on the supplied information. * * @param base PortDescription to get basic information from * @param signalType ODU client signal type * @param annotations key/value annotations map * @return port description */ public static PortDescription oduCltPortDescription(PortDescription base, CltSignalType signalType, SparseAnnotations annotations) { return oduCltPortDescription(base.portNumber(), base.isEnabled(), signalType, annotations); }
/** * Merges the appropriate PortConfig with the description. * * @param did ID of the Device where the port is attached * @param desc {@link PortDescription} * @return merged {@link PortDescription} */ private PortDescription applyAllPortOps(DeviceId did, PortDescription desc) { return applyAllPortOps(new ConnectPoint(did, desc.portNumber()), desc); }
/** * Creates OTU port description based on the supplied information. * * @param base PortDescription to get basic information from * @param signalType OTU client signal type * @param annotations key/value annotations map * @return port description */ public static PortDescription otuPortDescription(PortDescription base, OtuSignalType signalType, SparseAnnotations annotations) { return otuPortDescription(base.portNumber(), base.isEnabled(), signalType, annotations); }
/** * Puts PortDescription, merging annotations as necessary. * * @param newDesc new PortDescription * @return previous PortDescription */ public synchronized PortDescription putPortDesc(PortDescription newDesc) { PortDescription oldOne = portDescs.get(newDesc.portNumber()); PortDescription newOne = newDesc; if (oldOne != null) { SparseAnnotations merged = union(oldOne.annotations(), newDesc.annotations()); newOne = new DefaultPortDescription(newOne, merged); } return portDescs.put(newOne.portNumber(), newOne); } }
/** * Creates OMS port description based on the supplied information. * * @param base PortDescription to get basic information from * @param minFrequency minimum frequency * @param maxFrequency maximum frequency * @param grid grid spacing frequency * @param annotations key/value annotations map * @return port description */ public static PortDescription omsPortDescription(PortDescription base, Frequency minFrequency, Frequency maxFrequency, Frequency grid, SparseAnnotations annotations) { return omsPortDescription(base.portNumber(), base.isEnabled(), minFrequency, maxFrequency, grid, annotations); }
/** * Creates OCh port DefaultPortDescription based on the supplied information. * * @param base PortDescription to get basic information from * @param signalType ODU signal type * @param isTunable tunable wavelength capability * @param lambda OCh signal * @param annotations key/value annotations map * @return OCh port DefaultPortDescription with OCh annotations */ public static PortDescription ochPortDescription(PortDescription base, OduSignalType signalType, boolean isTunable, OchSignal lambda, SparseAnnotations annotations) { return ochPortDescription(base.portNumber(), base.isEnabled(), signalType, isTunable, lambda, annotations); }
final PortNumber number = portDescription.portNumber(); processed.add(portDescription.portNumber());
@Override public DeviceEvent updatePortStatus(ProviderId providerId, DeviceId deviceId, PortDescription portDescription) { Device device = devices.get(deviceId); checkArgument(device != null, DEVICE_NOT_FOUND, deviceId); Map<ProviderId, DeviceDescriptions> descsMap = deviceDescs.get(deviceId); checkArgument(descsMap != null, DEVICE_NOT_FOUND, deviceId); synchronized (descsMap) { DeviceDescriptions descs = descsMap.get(providerId); // assuming all providers must give DeviceDescription first checkArgument(descs != null, "Device description for Device ID %s from Provider %s was not found", deviceId, providerId); ConcurrentMap<PortNumber, Port> ports = getPortMap(deviceId); final PortNumber number = portDescription.portNumber(); final Port oldPort = ports.get(number); final Port newPort; // update description descs.putPortDesc(portDescription); newPort = composePort(device, number, descsMap); if (oldPort == null) { return createPort(device, newPort, ports); } else { return updatePort(device, oldPort, newPort, ports); } } }
PortNumber number = descr.portNumber(); number = PortNumber.portNumber(descr.portNumber().toLong(), opc.name());
/** * Updates {@link PortDescription} using specified number and annotations. * * @param port {@link PortNumber} to use in updated description * @param sa annotations to use in updated description * @param descr base {@link PortDescription} * @return updated {@link PortDescription} */ private static PortDescription updateDescription(PortNumber port, SparseAnnotations sa, PortDescription descr) { if (port.exactlyEquals(descr.portNumber()) && sa.equals(descr.annotations())) { // result is no-op return descr; } return DefaultPortDescription.builder(descr) .withPortNumber(port) .annotations(sa) .build(); }
portDescription.portNumber()); portDescription = ensurePortEnabledState(storedPortDesc, portDescription.isEnabled());