blob: b37dfbf0d2d4d4ea19dd089eb1a85845a409eda1 [file] [log] [blame]
MaoLuc201ae42017-02-06 17:57:01 -08001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.driver.optical.query;
17
18import java.util.Set;
19import java.util.stream.Collectors;
20import java.util.stream.IntStream;
21
22import org.onosproject.net.ChannelSpacing;
23import org.onosproject.net.OchSignal;
24import org.onosproject.net.PortNumber;
25import org.onosproject.net.behaviour.LambdaQuery;
26import org.onosproject.net.driver.AbstractHandlerBehaviour;
27
28/**
29 * Lambda query implementation for Oplink EDFA.
30 *
31 * An Oplink EDFA port exposes OMSn resources: 88 lambdas with 50GHz width (fixed grid).
32 *
33 * Channel id: Nominal central frequency = 193.1 THz + spacingMultiplier * channelSpacing).
34 * Channel (-28 to 59): starting from 191.7 THz to 196.05 THz, Increment by 50GHz.
35 */
36
37public class OplinkEdfaLambdaQuery extends AbstractHandlerBehaviour implements LambdaQuery {
38
39 private static final int MIN_CHANNEL = -28;
40 private static final int MAX_CHANNEL = 59;
41
42 @Override
43 public Set<OchSignal> queryLambdas(PortNumber port) {
44 return IntStream.rangeClosed(MIN_CHANNEL, MAX_CHANNEL)
45 .mapToObj(x -> OchSignal.newDwdmSlot(ChannelSpacing.CHL_50GHZ, x))
46 .collect(Collectors.toSet());
47 }
48}