diff --git a/drivers/lumentum/BUCK b/drivers/lumentum/BUCK index 02ea7ea31a..03ae2a9135 100644 --- a/drivers/lumentum/BUCK +++ b/drivers/lumentum/BUCK @@ -7,6 +7,7 @@ COMPILE_DEPS = [ '//protocols/tl1/ctl:onos-protocols-tl1-ctl', '//incubator/api:onos-incubator-api', '//apps/optical-model:onos-apps-optical-model', + '//drivers/optical:onos-drivers-optical', ] TEST_DEPS = [ diff --git a/drivers/lumentum/pom.xml b/drivers/lumentum/pom.xml index 79bf59e57c..e7a17c75a0 100644 --- a/drivers/lumentum/pom.xml +++ b/drivers/lumentum/pom.xml @@ -49,7 +49,6 @@ onos-optical-model ${project.version} - org.apache.servicemix.bundles org.apache.servicemix.bundles.snmp4j @@ -70,5 +69,10 @@ onos-tl1-ctl ${project.version} + + org.onosproject + onos-drivers-optical + ${project.version} + diff --git a/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumSdnRoadmFlowRuleProgrammable.java b/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumSdnRoadmFlowRuleProgrammable.java index 7dde491c23..840fc99370 100644 --- a/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumSdnRoadmFlowRuleProgrammable.java +++ b/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumSdnRoadmFlowRuleProgrammable.java @@ -17,6 +17,8 @@ package org.onosproject.drivers.lumentum; import com.google.common.collect.Lists; import org.apache.commons.lang3.tuple.Pair; +import org.onosproject.driver.optical.flowrule.CrossConnectCache; +import org.onosproject.driver.optical.flowrule.CrossConnectFlowRule; import org.onosproject.net.ChannelSpacing; import org.onosproject.net.GridType; import org.onosproject.net.OchSignal; diff --git a/drivers/optical/pom.xml b/drivers/optical/pom.xml index b136ea9aa6..c5bcf00075 100644 --- a/drivers/optical/pom.xml +++ b/drivers/optical/pom.xml @@ -59,6 +59,7 @@ org.onosproject openflowj + org.onosproject onos-of-api diff --git a/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/CrossConnect.java b/drivers/optical/src/main/java/org/onosproject/driver/optical/flowrule/CrossConnect.java similarity index 92% rename from drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/CrossConnect.java rename to drivers/optical/src/main/java/org/onosproject/driver/optical/flowrule/CrossConnect.java index cd397ba7fa..b1131aced0 100644 --- a/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/CrossConnect.java +++ b/drivers/optical/src/main/java/org/onosproject/driver/optical/flowrule/CrossConnect.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-present Open Networking Laboratory + * Copyright 2017-present Open Networking Laboratory * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onosproject.drivers.lumentum; +package org.onosproject.driver.optical.flowrule; import org.onosproject.net.OchSignal; import org.onosproject.net.PortNumber; diff --git a/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/CrossConnectCache.java b/drivers/optical/src/main/java/org/onosproject/driver/optical/flowrule/CrossConnectCache.java similarity index 90% rename from drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/CrossConnectCache.java rename to drivers/optical/src/main/java/org/onosproject/driver/optical/flowrule/CrossConnectCache.java index ca2aa87d47..ff16376937 100644 --- a/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/CrossConnectCache.java +++ b/drivers/optical/src/main/java/org/onosproject/driver/optical/flowrule/CrossConnectCache.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-present Open Networking Laboratory + * Copyright 2017-present Open Networking Laboratory * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onosproject.drivers.lumentum; +package org.onosproject.driver.optical.flowrule; import org.apache.commons.lang3.tuple.Pair; import org.onosproject.net.flow.FlowId; @@ -21,7 +21,7 @@ import org.onosproject.net.flow.FlowId; /** * Simple interface to cache flow ID and priority of cross connect flows. */ -interface CrossConnectCache { +public interface CrossConnectCache { /** * Returns the flow ID and priority corresponding to the flow hash. * diff --git a/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/CrossConnectFlowRule.java b/drivers/optical/src/main/java/org/onosproject/driver/optical/flowrule/CrossConnectFlowRule.java similarity index 97% rename from drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/CrossConnectFlowRule.java rename to drivers/optical/src/main/java/org/onosproject/driver/optical/flowrule/CrossConnectFlowRule.java index 56cceef12a..7b0579fecd 100644 --- a/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/CrossConnectFlowRule.java +++ b/drivers/optical/src/main/java/org/onosproject/driver/optical/flowrule/CrossConnectFlowRule.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-present Open Networking Laboratory + * Copyright 2017-present Open Networking Laboratory * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onosproject.drivers.lumentum; +package org.onosproject.driver.optical.flowrule; import org.onosproject.net.OchSignal; import org.onosproject.net.PortNumber; diff --git a/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/DefaultCrossConnectCache.java b/drivers/optical/src/main/java/org/onosproject/driver/optical/flowrule/DefaultCrossConnectCache.java similarity index 94% rename from drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/DefaultCrossConnectCache.java rename to drivers/optical/src/main/java/org/onosproject/driver/optical/flowrule/DefaultCrossConnectCache.java index 032ddbc8f8..1a73698822 100644 --- a/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/DefaultCrossConnectCache.java +++ b/drivers/optical/src/main/java/org/onosproject/driver/optical/flowrule/DefaultCrossConnectCache.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-present Open Networking Laboratory + * Copyright 2017-present Open Networking Laboratory * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onosproject.drivers.lumentum; +package org.onosproject.driver.optical.flowrule; import org.apache.commons.lang3.tuple.Pair; import org.apache.felix.scr.annotations.Component; diff --git a/drivers/optical/src/main/java/org/onosproject/driver/optical/flowrule/package-info.java b/drivers/optical/src/main/java/org/onosproject/driver/optical/flowrule/package-info.java new file mode 100644 index 0000000000..6e3e8e0e05 --- /dev/null +++ b/drivers/optical/src/main/java/org/onosproject/driver/optical/flowrule/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2017-present Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Implementations of the {@link org.onosproject.net.flow.FlowRuleProgrammable} behaviour for optical devices. + */ +package org.onosproject.driver.optical.flowrule; \ No newline at end of file diff --git a/drivers/optical/src/main/java/org/onosproject/driver/optical/query/LincOELambdaQuery.java b/drivers/optical/src/main/java/org/onosproject/driver/optical/query/LincOELambdaQuery.java index 9f7bada5ff..d7fc40a61c 100644 --- a/drivers/optical/src/main/java/org/onosproject/driver/optical/query/LincOELambdaQuery.java +++ b/drivers/optical/src/main/java/org/onosproject/driver/optical/query/LincOELambdaQuery.java @@ -47,7 +47,7 @@ public class LincOELambdaQuery extends AbstractHandlerBehaviour implements Lambd * OMS ports expose 80 fixed grid lambdas of 50GHz width, * centered around the ITU-T center frequency 193.1 THz. */ - private static final Set OMS_LAMDAS = IntStream.range(0, LAMBDA_COUNT) + private static final Set OMS_LAMBDAS = IntStream.range(0, LAMBDA_COUNT) .mapToObj(x -> new OchSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, x - (LAMBDA_COUNT / 2), 4)) .collect(GuavaCollectors.toImmutableSet()); @@ -63,6 +63,6 @@ public class LincOELambdaQuery extends AbstractHandlerBehaviour implements Lambd return ImmutableSet.of(); } - return OMS_LAMDAS; + return OMS_LAMBDAS; } } diff --git a/drivers/optical/src/main/resources/optical-drivers.xml b/drivers/optical/src/main/resources/optical-drivers.xml index e4839459ce..35563e0322 100644 --- a/drivers/optical/src/main/resources/optical-drivers.xml +++ b/drivers/optical/src/main/resources/optical-drivers.xml @@ -33,10 +33,8 @@ impl="org.onosproject.driver.optical.handshaker.CalientFiberSwitchHandshaker"/> - - - - + impl="org.onosproject.driver.optical.handshaker.OplinkSwitchHandshaker"/> - - - - - + impl="org.onosproject.driver.optical.config.ConfigFlowRuleProgrammable"/> - - - - + impl="org.onosproject.driver.optical.config.ConfigFlowRuleProgrammable"/> - diff --git a/utils/misc/src/main/java/org/onlab/util/Frequency.java b/utils/misc/src/main/java/org/onlab/util/Frequency.java index 3a6001528f..9fd296e658 100644 --- a/utils/misc/src/main/java/org/onlab/util/Frequency.java +++ b/utils/misc/src/main/java/org/onlab/util/Frequency.java @@ -56,6 +56,42 @@ public final class Frequency implements RichComparable { return frequency; } + /** + * Return the value this instance represents as KHz. + * + * @return frequency in kHz + */ + public double asKHz() { + return (double) frequency / KHZ; + } + + /** + * Return the value this instance represents as MHz. + * + * @return frequency in MHz + */ + public double asMHz() { + return (double) frequency / MHZ; + } + + /** + * Return the value this instance represents as GHz. + * + * @return frequency in GHz + */ + public double asGHz() { + return (double) frequency / GHZ; + } + + /** + * Return the value this instance represents as THz. + * + * @return frequency in THz + */ + public double asTHz() { + return (double) frequency / THZ; + } + /** * Returns an instance representing the specified value in Hz. *