blob: 71213bc576f23ff5708558fcb0a5b75bc82610ae [file] [log] [blame]
Andrea Campanellaa9cdaf62019-09-08 10:30:16 -07001/*
2 * Copyright 2018-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
16 * This work was partially supported by EC H2020 project METRO-HAUL (761727).
17 */
18
19package org.onosproject.drivers.odtn;
20
21import com.google.common.collect.ImmutableSet;
22import org.onlab.util.Frequency;
23import org.onlab.util.Spectrum;
24import org.onosproject.net.ChannelSpacing;
25import org.onosproject.net.GridType;
26import org.onosproject.net.OchSignal;
27import org.onosproject.net.PortNumber;
28import org.onosproject.net.behaviour.LambdaQuery;
29import org.onosproject.net.driver.AbstractHandlerBehaviour;
30
31import java.util.Set;
32import java.util.stream.IntStream;
33
34
35public class GrooveOpenConfigLambdaQuery extends AbstractHandlerBehaviour implements LambdaQuery {
36 private static final int LAMBDA_COUNT = 96;
37 private static final Frequency START_CENTER_FREQ = Frequency.ofGHz(191_350);
38
39 @Override
40 public Set<OchSignal> queryLambdas(PortNumber port) {
41
42 int startMultiplier = (int) (START_CENTER_FREQ.subtract(Spectrum.CENTER_FREQUENCY).asHz()
43 / Frequency.ofGHz(50).asHz());
44
45 return IntStream.range(0, LAMBDA_COUNT)
46 .mapToObj(x -> new OchSignal(GridType.DWDM,
47 ChannelSpacing.CHL_50GHZ,
48 startMultiplier + x,
49 4))
50 .collect(ImmutableSet.toImmutableSet());
51 }
52
53}