blob: 1532a809a1cee56cd18344f8c6922b8789ef07df [file] [log] [blame]
Jimmy Yan4deb03b2016-06-24 10:53:54 -07001/*
Brian O'Connor0a4e6742016-09-15 23:03:10 -07002 * Copyright 2016-present Open Networking Laboratory
Jimmy Yan4deb03b2016-06-24 10:53:54 -07003 *
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 ROADM.
30 *
31 * An Oplink ROADM 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 OplinkRoadmLambdaQuery extends AbstractHandlerBehaviour implements LambdaQuery {
38
Mao Lu1f524702017-02-22 17:05:12 +080039 private static final int MIN_CHANNEL = -28;
40 private static final int MAX_CHANNEL = 59;
Jimmy Yan4deb03b2016-06-24 10:53:54 -070041
42 @Override
43 public Set<OchSignal> queryLambdas(PortNumber port) {
Mao Lu1f524702017-02-22 17:05:12 +080044 return IntStream.rangeClosed(MIN_CHANNEL, MAX_CHANNEL)
45 .mapToObj(x -> OchSignal.newDwdmSlot(ChannelSpacing.CHL_50GHZ, x))
Jimmy Yan4deb03b2016-06-24 10:53:54 -070046 .collect(Collectors.toSet());
47 }
48}