Refactored cross connect helpers to optical drivers package.

Change-Id: Iae23025cf0b33c51123911f3ff1249cabc812be2
This commit is contained in:
Marc De Leenheer 2017-04-25 14:16:02 -07:00 committed by Yuta HIGUCHI
parent 688395a4b4
commit 40a544ba3e
12 changed files with 79 additions and 29 deletions

View File

@ -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 = [

View File

@ -49,7 +49,6 @@
<artifactId>onos-optical-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.snmp4j</artifactId>
@ -70,5 +69,10 @@
<artifactId>onos-tl1-ctl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-drivers-optical</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -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;

View File

@ -59,6 +59,7 @@
<groupId>org.onosproject</groupId>
<artifactId>openflowj</artifactId>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-of-api</artifactId>

View File

@ -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;

View File

@ -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.
*

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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<OchSignal> OMS_LAMDAS = IntStream.range(0, LAMBDA_COUNT)
private static final Set<OchSignal> 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;
}
}

View File

@ -33,10 +33,8 @@
impl="org.onosproject.driver.optical.handshaker.CalientFiberSwitchHandshaker"/>
<behaviour api="org.onosproject.net.behaviour.LambdaQuery"
impl="org.onosproject.driver.optical.query.CalientLambdaQuery"/>
<behaviour api="org.onosproject.net.optical.OpticalDevice"
impl="org.onosproject.net.optical.DefaultOpticalDevice"/>
</driver>
<driver name="eci" extends="default"
@ -70,12 +68,10 @@
<driver name="oplk_ops" extends="default"
manufacturer="Oplink a Molex company" hwVersion="protection-switch" swVersion="of-agent-1.0">
<behaviour api="org.onosproject.net.optical.OpticalDevice"
impl="org.onosproject.net.optical.DefaultOpticalDevice"/>
<behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver"
impl="org.onosproject.driver.optical.handshaker.OplinkSwitchHandshaker"/>
impl="org.onosproject.driver.optical.handshaker.OplinkSwitchHandshaker"/>
<behaviour api="org.onosproject.net.behaviour.protection.ProtectionConfigBehaviour"
impl="org.onosproject.driver.optical.protection.OplinkSwitchProtection"/>
<behaviour api="org.onosproject.net.behaviour.LambdaQuery"
@ -86,10 +82,8 @@
<driver name="oplk-edfa" extends="default"
manufacturer="Oplink a Molex company" hwVersion="edfa" swVersion="of-agent-1.0">
<behaviour api="org.onosproject.net.optical.OpticalDevice"
impl="org.onosproject.net.optical.DefaultOpticalDevice"/>
<behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver"
impl="org.onosproject.driver.optical.handshaker.OplinkEdfaHandshaker"/>
<behaviour api="org.onosproject.net.behaviour.LambdaQuery"
@ -102,31 +96,23 @@
<driver name="polatis-config" manufacturer="Polatis" hwVersion="N-VST-48x48-HU1-DMHNV-805" swVersion="6.6.1.7">
<behaviour api="org.onosproject.net.optical.OpticalDevice"
impl="org.onosproject.net.optical.DefaultOpticalDevice"/>
<behaviour api="org.onosproject.net.device.DeviceDescriptionDiscovery"
impl="org.onosproject.driver.optical.config.PolatisDeviceDiscovery"/>
<behaviour api="org.onosproject.net.flow.FlowRuleProgrammable"
impl="org.onosproject.driver.optical.config.ConfigFlowRuleProgrammable"/>
impl="org.onosproject.driver.optical.config.ConfigFlowRuleProgrammable"/>
<behaviour api="org.onosproject.net.behaviour.LambdaQuery"
impl="org.onosproject.driver.optical.query.ConfigLambdaQuery"/>
</driver>
<driver name="optical-config" manufacturer="config" hwVersion="config" swVersion="config">
<behaviour api="org.onosproject.net.optical.OpticalDevice"
impl="org.onosproject.net.optical.DefaultOpticalDevice"/>
<behaviour api="org.onosproject.net.device.DeviceDescriptionDiscovery"
impl="org.onosproject.driver.optical.config.ConfigOpticalDeviceDiscovery"/>
<behaviour api="org.onosproject.net.flow.FlowRuleProgrammable"
impl="org.onosproject.driver.optical.config.ConfigFlowRuleProgrammable"/>
impl="org.onosproject.driver.optical.config.ConfigFlowRuleProgrammable"/>
<behaviour api="org.onosproject.net.behaviour.LambdaQuery"
impl="org.onosproject.driver.optical.query.ConfigLambdaQuery"/>
</driver>
</drivers>

View File

@ -56,6 +56,42 @@ public final class Frequency implements RichComparable<Frequency> {
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.
*