Jimmy Yan | 4deb03b | 2016-06-24 10:53:54 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 0a4e674 | 2016-09-15 23:03:10 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Jimmy Yan | 4deb03b | 2016-06-24 10:53:54 -0700 | [diff] [blame] | 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.driver.optical.query; |
| 17 | |
| 18 | import java.util.Set; |
| 19 | import java.util.stream.Collectors; |
| 20 | import java.util.stream.IntStream; |
| 21 | |
| 22 | import org.onosproject.net.ChannelSpacing; |
| 23 | import org.onosproject.net.OchSignal; |
| 24 | import org.onosproject.net.PortNumber; |
| 25 | import org.onosproject.net.behaviour.LambdaQuery; |
| 26 | import org.onosproject.net.driver.AbstractHandlerBehaviour; |
| 27 | |
| 28 | /** |
| 29 | * Lambda query implementation for Oplink ROADM. |
| 30 | * |
| 31 | * An Oplink ROADM port exposes OMSn resources: 88 lambdas with 50GHz width (fixed grid). |
| 32 | * |
| 33 | * Channel id: Nominal central frequency = 193.1 THz + spacingMultiplier * channelSpacing). |
| 34 | * Channel (-28 to 59): starting from 191.7 THz to 196.05 THz, Increment by 50GHz. |
| 35 | */ |
| 36 | |
| 37 | public class OplinkRoadmLambdaQuery extends AbstractHandlerBehaviour implements LambdaQuery { |
| 38 | |
| 39 | private static final int LAMBDA_COUNT = 88; |
| 40 | private static final int CENTER_OFFSET = 29; |
| 41 | |
| 42 | @Override |
| 43 | public Set<OchSignal> queryLambdas(PortNumber port) { |
| 44 | return IntStream.rangeClosed(1, LAMBDA_COUNT) |
| 45 | .mapToObj(x -> OchSignal.newDwdmSlot(ChannelSpacing.CHL_50GHZ, x - CENTER_OFFSET)) |
| 46 | .collect(Collectors.toSet()); |
| 47 | } |
| 48 | } |