Search in sources :

Example 1 with LambdaConfig

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;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) ChannelSpacing(org.onosproject.net.ChannelSpacing) NetworkConfigService(org.onosproject.net.config.NetworkConfigService) OchSignal(org.onosproject.net.OchSignal) LambdaConfig(org.onosproject.driver.optical.config.LambdaConfig) ConnectPoint(org.onosproject.net.ConnectPoint) ConnectPoint(org.onosproject.net.ConnectPoint) GridType(org.onosproject.net.GridType)

Aggregations

LinkedHashSet (java.util.LinkedHashSet)1 LambdaConfig (org.onosproject.driver.optical.config.LambdaConfig)1 ChannelSpacing (org.onosproject.net.ChannelSpacing)1 ConnectPoint (org.onosproject.net.ConnectPoint)1 GridType (org.onosproject.net.GridType)1 OchSignal (org.onosproject.net.OchSignal)1 NetworkConfigService (org.onosproject.net.config.NetworkConfigService)1