Alessio Giorgetti | 648b538 | 2018-02-15 18:35:45 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2016-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 | package org.onosproject.drivers.lumentum; |
| 17 | |
| 18 | import org.onlab.util.Frequency; |
| 19 | import org.onlab.util.Spectrum; |
| 20 | import org.onosproject.net.ChannelSpacing; |
| 21 | import org.onosproject.net.GridType; |
| 22 | import org.onosproject.net.OchSignal; |
| 23 | import org.onosproject.net.PortNumber; |
| 24 | import org.onosproject.net.behaviour.LambdaQuery; |
| 25 | import org.onosproject.net.driver.AbstractHandlerBehaviour; |
| 26 | |
| 27 | import java.util.Set; |
| 28 | import java.util.stream.IntStream; |
| 29 | import java.util.stream.Collectors; |
| 30 | import com.google.common.collect.Sets; |
| 31 | |
| 32 | /** |
| 33 | * Implementation of lambda query interface for Lumentum ROADMs. |
| 34 | * |
| 35 | * Tested on both Lumentum SDN ROADM and Lumentum ROADM-A Whitebox. |
| 36 | * |
| 37 | * 96 OchSignals of 50 GHz, center frequencies range 191.350 - 196.100 THz. |
| 38 | * 48 OchSignals of 100 GHz, center frequencies 191.375 - 196.075 THz |
| 39 | */ |
| 40 | public class LumentumRoadmLambdaQuery extends AbstractHandlerBehaviour implements LambdaQuery { |
| 41 | |
| 42 | |
| 43 | public static final GridType GRID_TYPE = GridType.DWDM; |
| 44 | |
| 45 | public static final ChannelSpacing CHANNEL_SPACING_50 = ChannelSpacing.CHL_50GHZ; |
| 46 | public static final Frequency START_CENTER_FREQ_50 = Frequency.ofGHz(191_350); |
| 47 | public static final Frequency END_CENTER_FREQ_50 = Frequency.ofGHz(196_100); |
| 48 | private static final int LAMBDA_COUNT_50 = 96; |
| 49 | |
| 50 | public static final ChannelSpacing CHANNEL_SPACING_100 = ChannelSpacing.CHL_100GHZ; |
| 51 | public static final Frequency START_CENTER_FREQ_100 = Frequency.ofGHz(191_375); |
| 52 | public static final Frequency END_CENTER_FREQ_100 = Frequency.ofGHz(196_075); |
| 53 | private static final int LAMBDA_COUNT_100 = 48; |
| 54 | |
| 55 | @Override |
| 56 | public Set<OchSignal> queryLambdas(PortNumber port) { |
| 57 | |
| 58 | //Complete set of 50GHz OchSignal |
| 59 | int startMultiplier50 = (int) (START_CENTER_FREQ_50.subtract(Spectrum.CENTER_FREQUENCY).asHz() |
| 60 | / Frequency.ofGHz(50).asHz()); |
| 61 | |
| 62 | Set<OchSignal> channels50 = IntStream.range(0, LAMBDA_COUNT_50) |
| 63 | .mapToObj(x -> new OchSignal(GRID_TYPE, CHANNEL_SPACING_50, |
| 64 | startMultiplier50 + x, |
| 65 | 4)) |
| 66 | .collect(Collectors.toSet()); |
| 67 | |
| 68 | //Complete set of 100GHz OchSignal |
| 69 | int startMultiplier100 = (int) (START_CENTER_FREQ_100.subtract(Spectrum.CENTER_FREQUENCY).asHz() |
| 70 | / Frequency.ofGHz(100).asHz()); |
| 71 | |
| 72 | Set<OchSignal> channels100 = IntStream.range(0, LAMBDA_COUNT_100) |
| 73 | .mapToObj(x -> new OchSignal(GRID_TYPE, |
| 74 | CHANNEL_SPACING_100, startMultiplier100 + x, 8)) |
| 75 | .collect(Collectors.toSet()); |
| 76 | |
| 77 | Set<OchSignal> channels = Sets.union(channels50, channels100); |
| 78 | |
| 79 | return channels; |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | |