blob: 069828779a579d815363a169c55552bd2e0cf3b7 [file] [log] [blame]
fahadnaeemkhanffc917f2017-10-03 14:04:46 -07001/*
2 * Copyright 2017-present Open Networking Foundation
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.ciena;
17
18import org.onosproject.net.ChannelSpacing;
19import org.onosproject.net.OchSignal;
20import org.onosproject.net.PortNumber;
21import org.onosproject.net.behaviour.LambdaQuery;
22import org.onosproject.net.driver.AbstractHandlerBehaviour;
23
24
25import com.google.common.collect.ImmutableSet;
26
27import java.util.Set;
28import java.util.stream.IntStream;
29
30/**
31 * Ciena WaveServer Lambda query.
32 * 88 50GHz flex grid channels with 12.5 slot width, starting from 0 to 87.
33 */
34public class CienaWaveServerLambdaQuery extends AbstractHandlerBehaviour implements LambdaQuery {
35
36 @Override
37 public Set<OchSignal> queryLambdas(PortNumber port) {
38 //88 channels of 50 GHz with 12.5 GHz slothWidth
39 int slots = (int) (ChannelSpacing.CHL_50GHZ.frequency().asHz() /
40 ChannelSpacing.CHL_12P5GHZ.frequency().asHz());
41 int channels = 88;
42 //total lambdas are equal to: channels * slots
43 return IntStream.rangeClosed(0, channels * slots)
44 .mapToObj(x -> OchSignal.newFlexGridSlot(2 * x))
45 .collect(ImmutableSet.toImmutableSet());
46 }
47
48}
49
50