use of org.onosproject.net.OchSignal in project onos by opennetworkinglab.
the class CzechLightLambdaQuery method queryLambdas.
@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();
}
}
use of org.onosproject.net.OchSignal in project onos by opennetworkinglab.
the class CassiniTerminalDeviceDiscovery method toPortDescriptionInternal.
/**
* Converts Component subtree to PortDescription.
*
* @param component subtree to parse
* @return PortDescription or null if component is not an ONOS Port
*/
private PortDescription toPortDescriptionInternal(HierarchicalConfiguration component) {
Map<String, String> annotations = new HashMap<>();
/*
<components xmlns="http://openconfig.net/yang/platform">
<component>
<name>oc1/0</name>
<config>
<name>oc1/0</name>
</config>
<state>
<name>oc1/0</name>
<type>OPTICAL_CHANNEL</type>
<id/>
<description/>
<mfg-name/>
<hardware-version/>
<firmware-version/>
<software-version/>
<serial-no/>
<part-no/>
<removable>true</removable>
<empty>false</empty>
<parent/>
<temperature>
<instant>0.0</instant>
<avg>0.0</avg>
<min>0.0</min>
<max>0.0</max>
<interval>0</interval>
<min-time>0</min-time>
<max-time>0</max-time>
<alarm-status>true</alarm-status>
<alarm-threshold>0</alarm-threshold>
</temperature>
<memory>
<available>0</available>
<utilized>0</utilized>
</memory>
<allocated-power>0</allocated-power>
<used-power>0</used-power>
</state>
<optical-channel xmlns="http://openconfig.net/yang/terminal-device">
<config>
<line-port>port-10101</line-port>
</config>
<state>
<output-power/>
<input-power/>
</state>
</optical-channel>
</component>
*/
String name = component.getString("name");
String type = component.getString("state/type");
checkNotNull(name, "name not found");
checkNotNull(type, "state/type not found");
annotations.put(OdtnDeviceDescriptionDiscovery.OC_NAME, name);
annotations.put(OdtnDeviceDescriptionDiscovery.OC_TYPE, type);
// TODO this currently support only line-side ports through parsing of optical channels.
if (type.equals(OC_TRANSPORT_TYPES_OPTICAL_CHANNEL)) {
String portName = component.getString("optical-channel/config/line-port");
String portIndex = portName.split("-")[1];
annotations.putIfAbsent(AnnotationKeys.PORT_NAME, portName);
annotations.putIfAbsent(PORT_TYPE, OdtnPortType.LINE.value());
annotations.putIfAbsent(ONOS_PORT_INDEX, portIndex);
annotations.putIfAbsent(CONNECTION_ID, "connection-" + portIndex);
OchSignal signalId = OchSignal.newDwdmSlot(ChannelSpacing.CHL_50GHZ, 1);
return OchPortHelper.ochPortDescription(PortNumber.portNumber(Long.parseLong(portIndex)), true, // TODO Client signal to be discovered
OduSignalType.ODU4, true, signalId, DefaultAnnotations.builder().putAll(annotations).build());
} else {
log.debug("Unknown port component type {}", type);
return null;
}
}
use of org.onosproject.net.OchSignal in project onos by opennetworkinglab.
the class PolatisPowerConfig method acquireTargetPower.
private Long acquireTargetPower(PortNumber port, T component) {
if (component instanceof OchSignal) {
log.warn("Channel power is not applicable.");
return null;
}
log.debug("Get port{} target power...", port);
DeviceId deviceId = handler().data().deviceId();
Long targetPower = 0L;
try {
targetPower = Long.valueOf(get(handler(), VOA_LEVEL_OID + "." + port.toLong()).toInt());
} catch (IOException e) {
log.error("Error reading target power for device {} exception {}", deviceId, e);
}
return targetPower;
}
Aggregations