use of org.onosproject.driver.optical.config.LambdaConfig in project onos by opennetworkinglab.
the class ConfigLambdaQuery method queryLambdas.
@Override
public Set<OchSignal> queryLambdas(PortNumber port) {
NetworkConfigService netcfg = handler().get(NetworkConfigService.class);
ConnectPoint cp = new ConnectPoint(data().deviceId(), port);
LambdaConfig cfg = netcfg.getConfig(cp, LambdaConfig.class);
if (cfg == null) {
return ImmutableSet.of();
}
GridType type = cfg.gridType();
Optional<ChannelSpacing> dwdmSpacing = cfg.dwdmSpacing();
int start = cfg.slotStart();
int step = cfg.slotStep();
int end = cfg.slotEnd();
Set<OchSignal> lambdas = new LinkedHashSet<>();
for (int i = start; i <= end; i += step) {
switch(type) {
case DWDM:
lambdas.add(OchSignal.newDwdmSlot(dwdmSpacing.get(), i));
break;
case FLEX:
lambdas.add(OchSignal.newFlexGridSlot(i));
break;
case CWDM:
default:
log.warn("Unsupported grid type: {}", type);
break;
}
}
return lambdas;
}
Aggregations