Remove deprecated optical apps

Change-Id: Ia79855b97f1daef7f325bb9697a040b729e8a794
This commit is contained in:
Ray Milkey 2017-05-30 11:58:45 -07:00
parent da61146a90
commit ed0c66359a
11 changed files with 0 additions and 1367 deletions

View File

@ -1,16 +0,0 @@
COMPILE_DEPS = [
'//lib:CORE_DEPS',
'//apps/optical-model:onos-apps-optical-model',
]
osgi_jar_with_tests (
deps = COMPILE_DEPS,
)
onos_app (
title = 'Packet/Optical Use-Case App',
category = 'Traffic Steering',
url = 'http://onosproject.org',
description = 'Packet/Optical use-case application.',
required_apps = [ 'org.onosproject.optical-model' ],
)

View File

@ -1,75 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2014-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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-apps</artifactId>
<version>1.11.0-SNAPSHOT</version>
</parent>
<artifactId>onos-app-optical</artifactId>
<packaging>bundle</packaging>
<description>Packet/Optical use-case application</description>
<properties>
<onos.app.name>org.onosproject.optical</onos.app.name>
<onos.app.title>Packet/Optical Use-Case App</onos.app.title>
<onos.app.category>Traffic Steering</onos.app.category>
<onos.app.url>http://onosproject.org</onos.app.url>
<onos.app.readme>Packet/Optical use-case application.</onos.app.readme>
<onos.app.requires>
org.onosproject.optical-model
</onos.app.requires>
</properties>
<dependencies>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-optical-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-cli</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-core-serializers</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -1,160 +0,0 @@
/*
* Copyright 2014-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.
*/
package org.onosproject.optical;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Link;
import org.onosproject.net.Port;
import org.onosproject.net.device.DeviceEvent;
import org.onosproject.net.device.DeviceListener;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.link.DefaultLinkDescription;
import org.onosproject.net.link.LinkDescription;
import org.onosproject.net.link.LinkEvent;
import org.onosproject.net.link.LinkListener;
import org.onosproject.net.link.LinkProvider;
import org.onosproject.net.link.LinkProviderRegistry;
import org.onosproject.net.link.LinkProviderService;
import org.onosproject.net.link.LinkService;
import org.onosproject.net.provider.AbstractProvider;
import org.onosproject.net.provider.ProviderId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.onosproject.net.Link.Type.OPTICAL;
/**
* Ancillary provider to activate/deactivate optical links as their respective
* devices go online or offline.
*
* @deprecated in Goldeneye (1.6.0)
*/
@Deprecated
@Component(immediate = true)
public class OpticalLinkProvider extends AbstractProvider implements LinkProvider {
private static final Logger log = LoggerFactory.getLogger(OpticalLinkProvider.class);
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected LinkProviderRegistry registry;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected DeviceService deviceService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected LinkService linkService;
private LinkProviderService providerService;
private DeviceListener deviceListener = new InternalDeviceListener();
private LinkListener linkListener = new InternalLinkListener();
public OpticalLinkProvider() {
super(new ProviderId("optical", "org.onosproject.optical"));
}
@Activate
protected void activate() {
deviceService.addListener(deviceListener);
linkService.addListener(linkListener);
providerService = registry.register(this);
log.info("Started");
}
@Deactivate
protected void deactivate() {
deviceService.removeListener(deviceListener);
linkService.removeListener(linkListener);
registry.unregister(this);
log.info("Stopped");
}
//Listens to device events and processes their links.
private class InternalDeviceListener implements DeviceListener {
@Override
public void event(DeviceEvent event) {
DeviceEvent.Type type = event.type();
Device device = event.subject();
if (type == DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED ||
type == DeviceEvent.Type.DEVICE_ADDED ||
type == DeviceEvent.Type.DEVICE_UPDATED) {
processDeviceLinks(device);
} else if (type == DeviceEvent.Type.PORT_UPDATED) {
processPortLinks(device, event.port());
}
}
}
//Listens to link events and processes the link additions.
private class InternalLinkListener implements LinkListener {
@Override
public void event(LinkEvent event) {
if (event.type() == LinkEvent.Type.LINK_ADDED) {
Link link = event.subject();
if ("cfg".equals(link.providerId().scheme())) {
processLink(event.subject());
}
}
}
}
private void processDeviceLinks(Device device) {
for (Link link : linkService.getDeviceLinks(device.id())) {
if (link.isExpected() && link.type() == OPTICAL) {
processLink(link);
}
}
}
private void processPortLinks(Device device, Port port) {
ConnectPoint connectPoint = new ConnectPoint(device.id(), port.number());
for (Link link : linkService.getLinks(connectPoint)) {
if (link.isExpected() && link.type() == OPTICAL) {
processLink(link);
}
}
}
private void processLink(Link link) {
DeviceId srcId = link.src().deviceId();
DeviceId dstId = link.dst().deviceId();
Port srcPort = deviceService.getPort(srcId, link.src().port());
Port dstPort = deviceService.getPort(dstId, link.dst().port());
if (srcPort == null || dstPort == null) {
return; //FIXME remove this in favor of below TODO
}
boolean active = deviceService.isAvailable(srcId) &&
deviceService.isAvailable(dstId) &&
// TODO: should update be queued if src or dstPort is null?
//srcPort != null && dstPort != null &&
srcPort.isEnabled() && dstPort.isEnabled();
LinkDescription desc = new DefaultLinkDescription(link.src(), link.dst(), OPTICAL);
if (active) {
providerService.linkDetected(desc);
} else {
providerService.linkVanished(desc);
}
}
}

View File

@ -1,404 +0,0 @@
/*
* Copyright 2014-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.
*/
package org.onosproject.optical;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onosproject.cluster.ClusterService;
import org.onosproject.cluster.NodeId;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.mastership.MastershipService;
import org.onosproject.net.CltSignalType;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.Device;
import org.onosproject.net.Host;
import org.onosproject.net.Link;
import org.onosproject.net.OduSignalType;
import org.onosproject.net.Path;
import org.onosproject.net.Port;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.host.HostService;
import org.onosproject.net.intent.HostToHostIntent;
import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.IntentEvent;
import org.onosproject.net.intent.IntentListener;
import org.onosproject.net.intent.IntentService;
import org.onosproject.net.intent.IntentState;
import org.onosproject.net.intent.OpticalCircuitIntent;
import org.onosproject.net.intent.OpticalConnectivityIntent;
import org.onosproject.net.intent.PointToPointIntent;
import org.onosproject.net.optical.OchPort;
import org.onosproject.net.optical.OduCltPort;
import org.onosproject.net.topology.LinkWeight;
import org.onosproject.net.topology.PathService;
import org.onosproject.net.topology.TopologyEdge;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onosproject.net.optical.device.OpticalDeviceServiceView.opticalView;
/**
* OpticalPathProvisioner listens for event notifications from the Intent F/W.
* It generates one or more opticalConnectivityIntent(s) and submits (or withdraws) to Intent F/W
* for adding/releasing capacity at the packet layer.
*
* @deprecated in Goldeneye (1.6.0)
*/
@Deprecated
@Component(immediate = true)
public class OpticalPathProvisioner {
protected static final Logger log = LoggerFactory
.getLogger(OpticalPathProvisioner.class);
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
private IntentService intentService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected PathService pathService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected CoreService coreService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected HostService hostService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected MastershipService mastershipService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected ClusterService clusterService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected DeviceService deviceService;
private ApplicationId appId;
private final InternalOpticalPathProvisioner pathProvisioner = new InternalOpticalPathProvisioner();
@Activate
protected void activate() {
deviceService = opticalView(deviceService);
intentService.addListener(pathProvisioner);
appId = coreService.registerApplication("org.onosproject.optical");
initOpticalPorts();
log.info("Started");
}
@Deactivate
protected void deactivate() {
intentService.removeListener(pathProvisioner);
log.info("Stopped");
}
/**
* Initialize availability of optical ports.
*/
private void initOpticalPorts() {
// TODO: check for existing optical intents
return;
}
public class InternalOpticalPathProvisioner implements IntentListener {
@Override
public void event(IntentEvent event) {
switch (event.type()) {
case INSTALL_REQ:
break;
case INSTALLED:
break;
case FAILED:
log.info("Intent {} failed, calling optical path provisioning app.", event.subject());
setupLightpath(event.subject());
break;
default:
break;
}
}
private void setupLightpath(Intent intent) {
checkNotNull(intent);
// TODO change the coordination approach between packet intents and optical intents
// Low speed LLDP may cause multiple calls which are not expected
if (intentService.getIntentState(intent.key()) != IntentState.FAILED) {
return;
}
// Get source and destination based on intent type
ConnectPoint src;
ConnectPoint dst;
if (intent instanceof HostToHostIntent) {
HostToHostIntent hostToHostIntent = (HostToHostIntent) intent;
Host one = hostService.getHost(hostToHostIntent.one());
Host two = hostService.getHost(hostToHostIntent.two());
checkNotNull(one);
checkNotNull(two);
src = one.location();
dst = two.location();
} else if (intent instanceof PointToPointIntent) {
PointToPointIntent p2pIntent = (PointToPointIntent) intent;
src = p2pIntent.ingressPoint();
dst = p2pIntent.egressPoint();
} else {
return;
}
if (src == null || dst == null) {
return;
}
// Ignore if we're not the master for the intent's origin device
NodeId localNode = clusterService.getLocalNode().id();
NodeId sourceMaster = mastershipService.getMasterFor(src.deviceId());
if (!localNode.equals(sourceMaster)) {
return;
}
// Generate optical connectivity intents
List<Intent> intents = getOpticalIntents(src, dst);
// Submit the intents
for (Intent i : intents) {
intentService.submit(i);
log.debug("Submitted an intent: {}", i);
}
}
/**
* Returns list of cross connection points of missing optical path sections.
*
* Scans the given multi-layer path and looks for sections that use cross connect links.
* The ingress and egress points in the optical layer are returned in a list.
*
* @param path the multi-layer path
* @return list of cross connection points on the optical layer
*/
private List<ConnectPoint> getCrossConnectPoints(Path path) {
boolean scanning = false;
List<ConnectPoint> connectPoints = new LinkedList<>();
for (Link link : path.links()) {
if (!isCrossConnectLink(link)) {
continue;
}
if (scanning) {
connectPoints.add(checkNotNull(link.src()));
scanning = false;
} else {
connectPoints.add(checkNotNull(link.dst()));
scanning = true;
}
}
return connectPoints;
}
/**
* Checks if cross connect points are of same type.
*
* @param crossConnectPoints list of cross connection points
* @return true if cross connect point pairs are of same type, false otherwise
*/
private boolean checkCrossConnectPoints(List<ConnectPoint> crossConnectPoints) {
checkArgument(crossConnectPoints.size() % 2 == 0);
Iterator<ConnectPoint> itr = crossConnectPoints.iterator();
while (itr.hasNext()) {
// checkArgument at start ensures we'll always have pairs of connect points
ConnectPoint src = itr.next();
ConnectPoint dst = itr.next();
Device.Type srcType = deviceService.getDevice(src.deviceId()).type();
Device.Type dstType = deviceService.getDevice(dst.deviceId()).type();
// Only support connections between identical port types
if (srcType != dstType) {
log.warn("Unsupported mix of cross connect points");
return false;
}
}
return true;
}
/**
* Scans the list of cross connection points and returns a list of optical connectivity intents.
*
* @param crossConnectPoints list of cross connection points
* @return list of optical connectivity intents
*/
private List<Intent> getIntents(List<ConnectPoint> crossConnectPoints) {
checkArgument(crossConnectPoints.size() % 2 == 0);
List<Intent> intents = new LinkedList<>();
Iterator<ConnectPoint> itr = crossConnectPoints.iterator();
while (itr.hasNext()) {
// checkArgument at start ensures we'll always have pairs of connect points
ConnectPoint src = itr.next();
ConnectPoint dst = itr.next();
Port srcPort = deviceService.getPort(src.deviceId(), src.port());
Port dstPort = deviceService.getPort(dst.deviceId(), dst.port());
if (srcPort instanceof OduCltPort && dstPort instanceof OduCltPort) {
// Create OTN circuit
Intent circuitIntent = OpticalCircuitIntent.builder()
.appId(appId)
.src(src)
.dst(dst)
.signalType(CltSignalType.CLT_10GBE)
.bidirectional(true)
.build();
intents.add(circuitIntent);
} else if (srcPort instanceof OchPort && dstPort instanceof OchPort) {
// Create lightpath
// FIXME: hardcoded ODU signal type
Intent opticalIntent = OpticalConnectivityIntent.builder()
.appId(appId)
.src(src)
.dst(dst)
.signalType(OduSignalType.ODU4)
.bidirectional(true)
.build();
intents.add(opticalIntent);
} else {
log.warn("Unsupported cross connect point types {} {}", srcPort.type(), dstPort.type());
return Collections.emptyList();
}
}
return intents;
}
/**
* Returns list of optical connectivity intents needed to create connectivity
* between ingress and egress.
*
* @param ingress the ingress connect point
* @param egress the egress connect point
* @return list of optical connectivity intents, empty list if no path was found
*/
private List<Intent> getOpticalIntents(ConnectPoint ingress, ConnectPoint egress) {
Set<Path> paths = pathService.getPaths(ingress.deviceId(),
egress.deviceId(),
new OpticalLinkWeight());
if (paths.isEmpty()) {
return Collections.emptyList();
}
// Search path with available cross connect points
for (Path path : paths) {
List<ConnectPoint> crossConnectPoints = getCrossConnectPoints(path);
// Skip to next path if cross connect points are mismatched
if (!checkCrossConnectPoints(crossConnectPoints)) {
continue;
}
return getIntents(crossConnectPoints);
}
log.warn("Unable to find multi-layer path.");
return Collections.emptyList();
}
/**
* Link weight function that emphasizes re-use of packet links.
*/
private class OpticalLinkWeight implements LinkWeight {
@Override
public double weight(TopologyEdge edge) {
// Ignore inactive links
if (edge.link().state() == Link.State.INACTIVE) {
return -1;
}
// TODO: Ignore cross connect links with used ports
// Transport links have highest weight
if (edge.link().type() == Link.Type.OPTICAL) {
return 1000;
}
// Packet links
return 1;
}
}
}
/**
* Verifies if given device type is in packet layer, i.e., ROADM, OTN or ROADM_OTN device.
*
* @param type device type
* @return true if in packet layer, false otherwise
*/
private boolean isPacketLayer(Device.Type type) {
return type == Device.Type.SWITCH || type == Device.Type.ROUTER || type == Device.Type.VIRTUAL;
}
/**
* Verifies if given device type is in packet layer, i.e., switch or router device.
*
* @param type device type
* @return true if in packet layer, false otherwise
*/
private boolean isTransportLayer(Device.Type type) {
return type == Device.Type.ROADM || type == Device.Type.OTN || type == Device.Type.ROADM_OTN;
}
/**
* Verifies if given link forms a cross-connection between packet and optical layer.
*
* @param link the link
* @return true if the link is a cross-connect link, false otherwise
*/
private boolean isCrossConnectLink(Link link) {
if (link.type() != Link.Type.OPTICAL) {
return false;
}
Device.Type src = deviceService.getDevice(link.src().deviceId()).type();
Device.Type dst = deviceService.getDevice(link.dst().deviceId()).type();
return src != dst &&
((isPacketLayer(src) && isTransportLayer(dst)) || (isPacketLayer(dst) && isTransportLayer(src)));
}
}

View File

@ -1,20 +0,0 @@
/*
* Copyright 2014-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.
*/
/**
* Packet/Optical application.
*/
package org.onosproject.optical;

View File

@ -1,179 +0,0 @@
/*
* Copyright 2015-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.
*/
package org.onosproject.optical.testapp;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onlab.packet.Ethernet;
import org.onlab.packet.MplsLabel;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
import org.onosproject.net.device.DeviceEvent;
import org.onosproject.net.device.DeviceListener;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.flow.DefaultFlowRule;
import org.onosproject.net.flow.DefaultTrafficSelector;
import org.onosproject.net.flow.DefaultTrafficTreatment;
import org.onosproject.net.flow.FlowRule;
import org.onosproject.net.flow.FlowRuleService;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
import org.slf4j.Logger;
import java.util.HashMap;
import java.util.Map;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Sample reactive forwarding application.
*/
//@Component(immediate = true)
public class MplsForwarding {
private final Logger log = getLogger(getClass());
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected FlowRuleService flowRuleService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected CoreService coreService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected DeviceService deviceService;
private ApplicationId appId;
private final InternalDeviceListener listener = new InternalDeviceListener();
private final Map<DeviceId, Integer> uglyMap = new HashMap<>();
@Activate
public void activate() {
appId = coreService.registerApplication("org.onosproject.mplsfwd");
uglyMap.put(DeviceId.deviceId("of:0000000000000001"), 1);
uglyMap.put(DeviceId.deviceId("of:0000000000000002"), 2);
uglyMap.put(DeviceId.deviceId("of:0000000000000003"), 3);
deviceService.addListener(listener);
for (Device d : deviceService.getDevices()) {
pushRules(d);
}
log.info("Started with Application ID {}", appId.id());
}
@Deactivate
public void deactivate() {
flowRuleService.removeFlowRulesById(appId);
log.info("Stopped");
}
private void pushRules(Device device) {
TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder();
TrafficTreatment.Builder tbuilder = DefaultTrafficTreatment.builder();
int inport = 1;
int outport = 2;
MplsLabel mplsLabel = MplsLabel.mplsLabel(101);
Integer switchNumber = uglyMap.get(device.id());
if (switchNumber == null) {
return;
}
switch (switchNumber) {
case 1:
sbuilder.matchInPort(PortNumber.portNumber(inport));
tbuilder.setOutput(PortNumber.portNumber(outport))
.pushMpls()
.setMpls(mplsLabel);
break;
case 2:
sbuilder.matchMplsLabel(mplsLabel)
.matchEthType(Ethernet.MPLS_UNICAST)
.matchInPort(PortNumber.portNumber(inport));
tbuilder.setOutput(PortNumber.portNumber(outport));
break;
case 3:
sbuilder.matchMplsLabel(mplsLabel)
.matchEthType(Ethernet.MPLS_UNICAST)
.matchInPort(PortNumber.portNumber(inport));
tbuilder.popMpls().setOutput(PortNumber.portNumber(outport));
break;
default:
}
TrafficTreatment treatement = tbuilder.build();
TrafficSelector selector = sbuilder.build();
FlowRule f = DefaultFlowRule.builder()
.forDevice(device.id())
.withSelector(selector)
.withTreatment(treatement)
.withPriority(100)
.fromApp(appId)
.makeTemporary(600)
.build();
flowRuleService.applyFlowRules(f);
}
public class InternalDeviceListener implements DeviceListener {
@Override
public void event(DeviceEvent event) {
switch (event.type()) {
case DEVICE_ADDED:
pushRules(event.subject());
break;
case DEVICE_AVAILABILITY_CHANGED:
break;
case DEVICE_REMOVED:
break;
case DEVICE_SUSPENDED:
break;
case DEVICE_UPDATED:
break;
case PORT_ADDED:
break;
case PORT_REMOVED:
break;
case PORT_UPDATED:
break;
default:
break;
}
}
}
}

View File

@ -1,20 +0,0 @@
/*
* Copyright 2014-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.
*/
/**
* Packet/Optical sample forwarding applications.
*/
package org.onosproject.optical.testapp;

View File

@ -1,391 +0,0 @@
{
"opticalSwitches": [
{
"allowed": true,
"latitude": 37.6,
"longitude": 122.3,
"name": "SFO-W10",
"nodeDpid": "00:00:ff:ff:ff:ff:ff:01",
"params": {
"numRegen": 0
},
"type": "Roadm"
},
{
"allowed": true,
"latitude": 37.3,
"longitude": 121.9,
"name": "SJC-W10",
"nodeDpid": "00:00:ff:ff:ff:ff:ff:02",
"params": {
"numRegen": 0
},
"type": "Roadm"
},
{
"allowed": true,
"latitude": 33.9,
"longitude": 118.4
"name": "LAX-W10",
"nodeDpid": "00:00:ff:ff:ff:ff:ff:03",
"params": {
"numRegen": 0
},
"type": "Roadm"
},
{
"allowed": true,
"latitude": 32.8,
"longitude": 117.1,
"name": "SDG-W10",
"nodeDpid": "00:00:ff:ff:ff:ff:ff:04",
"params": {
"numRegen": 3
},
"type": "Roadm"
},
{
"allowed": true,
"latitude": 44.8,
"longitude": 93.1,
"name": "MSP-M10",
"nodeDpid": "00:00:ff:ff:ff:ff:ff:05",
"params": {
"numRegen": 3
},
"type": "Roadm"
},
{
"allowed": true,
"latitude": 32.8,
"longitude": 97.1,
"name": "DFW-M10",
"nodeDpid": "00:00:ff:ff:ff:ff:ff:06",
"params": {
"numRegen": 3
},
"type": "Roadm"
},
{
"allowed": true,
"latitude": 41.8,
"longitude": 120.1,
"name": "CHG-N10",
"nodeDpid": "00:00:ff:ff:ff:ff:ff:07",
"params": {
"numRegen": 3
},
"type": "Roadm"
},
{
"allowed": true,
"latitude": 38.8,
"longitude": 77.1,
"name": "IAD-M10",
"nodeDpid": "00:00:ff:ff:ff:ff:ff:08",
"params": {
"numRegen": 3
},
"type": "Roadm"
},
{
"allowed": true,
"latitude": 40.8,
"longitude": 73.1,
"name": "JFK-E10",
"nodeDpid": "00:00:ff:ff:ff:ff:ff:09",
"params": {
"numRegen": 0
},
"type": "Roadm"
},
{
"allowed": true,
"latitude": 33.8,
"longitude": 84.1,
"name": "ATL-S10",
"nodeDpid": "00:00:ff:ff:ff:ff:ff:0A",
"params": {
"numRegen": 0
},
"type": "Roadm"
}
],
"opticalLinks": [
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:ff:01",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:02",
"params": {
"distKms": 1000,
"nodeName1": "SFO-W10",
"nodeName2": "SJC-W10",
"numWaves": 80,
"port1": 10,
"port2": 10
},
"type": "wdmLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:ff:02",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:03",
"params": {
"distKms": 1000,
"nodeName1": "SJC-W10",
"nodeName2": "LAX-W10",
"numWaves": 80,
"port1": 20,
"port2": 10
},
"type": "wdmLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:ff:03",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:04",
"params": {
"distKms": 1000,
"nodeName1": "LAX-W10",
"nodeName2": "SDG-W10",
"numWaves": 80,
"port1": 30,
"port2": 10
},
"type": "wdmLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:ff:02",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:05",
"params": {
"distKms": 4000,
"nodeName1": "SJC-W10",
"nodeName2": "MSP-M10",
"numWaves": 80,
"port1": 20,
"port2": 10
},
"type": "wdmLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:ff:03",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:06",
"params": {
"distKms": 5000,
"nodeName1": "LAX-W10",
"nodeName2": "DFW-M10",
"numWaves": 80,
"port1": 20,
"port2": 10
},
"type": "wdmLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:ff:05",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:06",
"params": {
"distKms": 3000,
"nodeName1": "MSP-M10",
"nodeName2": "DFW-M10",
"numWaves": 80,
"port1": 30,
"port2": 20
},
"type": "wdmLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:ff:05",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:07",
"params": {
"distKms": 3000,
"nodeName1": "MSP-M10",
"nodeName2": "CHG-N10",
"numWaves": 80,
"port1": 20,
"port2": 21
},
"type": "wdmLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:ff:06",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:08",
"params": {
"distKms": 4000,
"nodeName1": "DFW-M10",
"nodeName2": "IAD-M10",
"numWaves": 80,
"port1": 30,
"port2": 10
},
"type": "wdmLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:ff:07",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:08",
"params": {
"distKms": 4000,
"nodeName1": "CHG-M10",
"nodeName2": "IAD-M10",
"numWaves": 80,
"port1": 30,
"port2": 20
},
"type": "wdmLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:ff:07",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:09",
"params": {
"distKms": 5000,
"nodeName1": "CHG-M10",
"nodeName2": "JFK-E10",
"numWaves": 80,
"port1": 20,
"port2": 10
},
"type": "wdmLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:ff:08",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:0A",
"params": {
"distKms": 3000,
"nodeName1": "IAD-M10",
"nodeName2": "ATL-S10",
"numWaves": 80,
"port1": 30,
"port2": 10
},
"type": "wdmLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:ff:09",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:0A",
"params": {
"distKms": 4000,
"nodeName1": "JFK-E10",
"nodeName2": "ATL-S10",
"numWaves": 80,
"port1": 20,
"port2": 20
},
"type": "wdmLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:00:01",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:01",
"params": {
"nodeName1": "SFO-R10",
"nodeName2": "SFO-W10",
"port1": 10,
"port2": 1
},
"type": "pktOptLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:00:03",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:03",
"params": {
"nodeName1": "LAX-R10",
"nodeName2": "LAX-W10",
"port1": 10,
"port2": 1
},
"type": "pktOptLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:00:04",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:04",
"params": {
"nodeName1": "SDG-R10",
"nodeName2": "SDG-W10",
"port1": 10,
"port2": 1
},
"type": "pktOptLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:00:07",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:07",
"params": {
"nodeName1": "CHG-R10",
"nodeName2": "CHG-W10",
"port1": 10,
"port2": 1
},
"type": "pktOptLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:00:09",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:09",
"params": {
"nodeName1": "JFK-R10",
"nodeName2": "JFK-W10",
"port1": 10,
"port2": 1
},
"type": "pktOptLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:00:0A",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:0A",
"params": {
"nodeName1": "ATL-R10",
"nodeName2": "ATL-W10",
"port1": 10,
"port2": 1
},
"type": "pktOptLink"
},
]
}

View File

@ -1,100 +0,0 @@
{
"opticalSwitches": [
{
"allowed": true,
"latitude": 37.6,
"longitude": 122.3,
"name": "ROADM1",
"nodeDpid": "00:00:ff:ff:ff:ff:ff:01",
"params": {
"numRegen": 0
},
"type": "Roadm"
},
{
"allowed": true,
"latitude": 37.3,
"longitude": 121.9,
"name": "ROADM2",
"nodeDpid": "00:00:ff:ff:ff:ff:ff:02",
"params": {
"numRegen": 0
},
"type": "Roadm"
},
{
"allowed": true,
"latitude": 33.9,
"longitude": 118.4,
"name": "ROADM3",
"nodeDpid": "00:00:ff:ff:ff:ff:ff:03",
"params": {
"numRegen": 2
},
"type": "Roadm"
}
],
"opticalLinks": [
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:ff:01",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:03",
"params": {
"distKms": 1000,
"nodeName1": "ROADM1",
"nodeName2": "ROADM3",
"numWaves": 80,
"port1": 20,
"port2": 30
},
"type": "wdmLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:ff:03",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:02",
"params": {
"distKms": 2000,
"nodeName1": "ROADM3",
"nodeName2": "ROADM2",
"numWaves": 80,
"port1": 31,
"port2": 21
},
"type": "wdmLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:00:01",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:01",
"params": {
"nodeName1": "ROUTER1",
"nodeName2": "ROADM1",
"bandWidth": 100000,
"port1": 2,
"port2": 10
},
"type": "pktOptLink"
},
{
"allowed": true,
"nodeDpid1": "00:00:ff:ff:ff:ff:00:02",
"nodeDpid2": "00:00:ff:ff:ff:ff:ff:02",
"params": {
"nodeName1": "ROUTER2",
"nodeName2": "ROADM2",
"bandWidth": 100000,
"port1": 2,
"port2": 11
},
"type": "pktOptLink"
}
]
}

View File

@ -38,7 +38,6 @@
<module>proxyarp</module>
<module>sdnip</module>
<module>optical-model</module>
<module>optical</module>
<module>newoptical</module>
<module>metrics</module>
<module>routing</module>

View File

@ -151,7 +151,6 @@ ONOS_APPS = [
'//apps/mlb:onos-apps-mlb-oar',
'//apps/openstacknetworking:onos-apps-openstacknetworking-oar',
'//apps/mobility:onos-apps-mobility-oar',
'//apps/optical:onos-apps-optical-oar',
'//apps/newoptical:onos-apps-newoptical-oar',
'//apps/optical-model:onos-apps-optical-model-oar',
'//apps/pathpainter:onos-apps-pathpainter-oar',