Andrea Campanella | a9cdaf6 | 2019-09-08 10:30:16 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 19 | package org.onosproject.drivers.odtn; |
| 20 | |
| 21 | import com.google.common.collect.ImmutableSet; |
| 22 | import org.onlab.util.Frequency; |
| 23 | import org.onlab.util.Spectrum; |
| 24 | import org.onosproject.net.ChannelSpacing; |
| 25 | import org.onosproject.net.GridType; |
| 26 | import org.onosproject.net.OchSignal; |
| 27 | import org.onosproject.net.PortNumber; |
| 28 | import org.onosproject.net.behaviour.LambdaQuery; |
| 29 | import org.onosproject.net.driver.AbstractHandlerBehaviour; |
| 30 | |
| 31 | import java.util.Set; |
| 32 | import java.util.stream.IntStream; |
| 33 | |
| 34 | |
| 35 | public 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 | } |