blob: 36ad52170c9169f931dd7de364e57ee05953decc [file] [log] [blame]
Marc De Leenheerc662d322016-02-18 16:05:10 -08001/*
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.drivers.lumentum;
17
18import org.onlab.util.Frequency;
19import org.onlab.util.Spectrum;
20import org.onosproject.net.OchSignal;
21import org.onosproject.net.PortNumber;
22import org.onosproject.net.behaviour.LambdaQuery;
23import org.onosproject.net.driver.AbstractHandlerBehaviour;
24
25import java.util.Set;
26import java.util.stream.Collectors;
27import java.util.stream.IntStream;
28
29/**
30 * Implementation of lambda query interface for Lumentum SDN ROADMs.
31 *
32 * Device supports 96 wavelengths of 50 GHz, between center frequencies 191.350 THz and 196.075 THz.
33 */
34public class LambdaQueryLumentumRoadm extends AbstractHandlerBehaviour implements LambdaQuery {
35 private static final int LAMBDA_COUNT = 96;
36
37 @Override
38 public Set<OchSignal> queryLambdas(PortNumber port) {
39 int startMultiplier = (int) (LumentumSnmpDevice.START_CENTER_FREQ.subtract(Spectrum.CENTER_FREQUENCY).asHz()
40 / Frequency.ofGHz(50).asHz());
41
42 return IntStream.range(0, LAMBDA_COUNT)
43 .mapToObj(x -> new OchSignal(LumentumSnmpDevice.GRID_TYPE,
44 LumentumSnmpDevice.CHANNEL_SPACING,
45 startMultiplier + x,
46 4))
47 .collect(Collectors.toSet());
48 }
49}