blob: 1aa0896324d39419480af174b8da0c39b52e6aff [file] [log] [blame]
Jimmy Yan4deb03b2016-06-24 10:53:54 -07001/*
2 * Copyright 2016 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 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
39 private static final int LAMBDA_COUNT = 88;
40 private static final int CENTER_OFFSET = 29;
41
42 @Override
43 public Set<OchSignal> queryLambdas(PortNumber port) {
44 return IntStream.rangeClosed(1, LAMBDA_COUNT)
45 .mapToObj(x -> OchSignal.newDwdmSlot(ChannelSpacing.CHL_50GHZ, x - CENTER_OFFSET))
46 .collect(Collectors.toSet());
47 }
48}