Make vRouter components into separate apps.
This allows us to leverage the ONOS app subsystem for selecting which
components to load.
CORD-710
Change-Id: Ibd7c4c1afd2caa137b44c085e7b6b5b4a1082521
diff --git a/apps/routing/common/BUCK b/apps/routing/common/BUCK
new file mode 100644
index 0000000..8483685
--- /dev/null
+++ b/apps/routing/common/BUCK
@@ -0,0 +1,20 @@
+COMPILE_DEPS = [
+ '//lib:CORE_DEPS',
+ '//lib:org.apache.karaf.shell.console',
+ '//lib:concurrent-trees',
+ '//cli:onos-cli',
+ '//incubator/api:onos-incubator-api',
+ '//apps/routing-api:onos-apps-routing-api',
+ '//core/common:onos-core-common',
+]
+
+TEST_DEPS = [
+ '//lib:TEST_ADAPTERS',
+ '//incubator/api:onos-incubator-api-tests',
+ '//apps/routing-api:onos-apps-routing-api-tests',
+]
+
+osgi_jar_with_tests (
+ deps = COMPILE_DEPS,
+ test_deps = TEST_DEPS,
+)
diff --git a/apps/routing/common/pom.xml b/apps/routing/common/pom.xml
new file mode 100644
index 0000000..ed2d115
--- /dev/null
+++ b/apps/routing/common/pom.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<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/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>onos-app-routing-parent</artifactId>
+ <groupId>org.onosproject</groupId>
+ <version>1.9.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>onos-app-routing</artifactId>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-app-routing-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-app-routing-api</artifactId>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-incubator-api</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-cli</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-misc</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.console</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.googlecode.concurrent-trees</groupId>
+ <artifactId>concurrent-trees</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpConstants.java b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpConstants.java
similarity index 99%
rename from apps/routing/src/main/java/org/onosproject/routing/bgp/BgpConstants.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpConstants.java
index 504482f..0344b54 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpConstants.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpConstants.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
/**
diff --git a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpFrameDecoder.java b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpFrameDecoder.java
similarity index 98%
rename from apps/routing/src/main/java/org/onosproject/routing/bgp/BgpFrameDecoder.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpFrameDecoder.java
index 4cd2813..d6c9d30 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpFrameDecoder.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpFrameDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import org.jboss.netty.buffer.ChannelBuffer;
diff --git a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpInfoService.java b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpInfoService.java
similarity index 95%
rename from apps/routing/src/main/java/org/onosproject/routing/bgp/BgpInfoService.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpInfoService.java
index 938aa15..1fa303e 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpInfoService.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpInfoService.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import java.util.Collection;
diff --git a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpKeepalive.java b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpKeepalive.java
similarity index 98%
rename from apps/routing/src/main/java/org/onosproject/routing/bgp/BgpKeepalive.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpKeepalive.java
index acb8a25..050a30f 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpKeepalive.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpKeepalive.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import org.jboss.netty.buffer.ChannelBuffer;
diff --git a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpMessage.java b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpMessage.java
similarity index 97%
rename from apps/routing/src/main/java/org/onosproject/routing/bgp/BgpMessage.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpMessage.java
index cb67d8b..cafbeb1 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpMessage.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpMessage.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import org.jboss.netty.buffer.ChannelBuffer;
diff --git a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpNotification.java b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpNotification.java
similarity index 98%
rename from apps/routing/src/main/java/org/onosproject/routing/bgp/BgpNotification.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpNotification.java
index 8507474..0cf03a5 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpNotification.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpNotification.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import org.jboss.netty.buffer.ChannelBuffer;
diff --git a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpOpen.java b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpOpen.java
similarity index 99%
rename from apps/routing/src/main/java/org/onosproject/routing/bgp/BgpOpen.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpOpen.java
index 6f496ee..e5d4821 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpOpen.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpOpen.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import org.jboss.netty.buffer.ChannelBuffer;
diff --git a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpRouteEntry.java b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpRouteEntry.java
similarity index 99%
rename from apps/routing/src/main/java/org/onosproject/routing/bgp/BgpRouteEntry.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpRouteEntry.java
index adf00904..15ac60c 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpRouteEntry.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpRouteEntry.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import com.google.common.base.MoreObjects;
diff --git a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpRouteSelector.java b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpRouteSelector.java
similarity index 99%
rename from apps/routing/src/main/java/org/onosproject/routing/bgp/BgpRouteSelector.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpRouteSelector.java
index 36b4b6e..96f3a92 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpRouteSelector.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpRouteSelector.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import org.onlab.packet.IpPrefix;
diff --git a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpSession.java b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpSession.java
similarity index 99%
rename from apps/routing/src/main/java/org/onosproject/routing/bgp/BgpSession.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpSession.java
index f9d2a20..25623ac 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpSession.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpSession.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import org.jboss.netty.buffer.ChannelBuffer;
diff --git a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpSessionInfo.java b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpSessionInfo.java
similarity index 99%
rename from apps/routing/src/main/java/org/onosproject/routing/bgp/BgpSessionInfo.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpSessionInfo.java
index 0e1bc8a..af3a41f 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpSessionInfo.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpSessionInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import org.onlab.packet.Ip4Address;
diff --git a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpSessionManager.java b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpSessionManager.java
similarity index 99%
rename from apps/routing/src/main/java/org/onosproject/routing/bgp/BgpSessionManager.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpSessionManager.java
index fbecd68..a8cf5d8 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpSessionManager.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpSessionManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import org.apache.felix.scr.annotations.Activate;
diff --git a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpUpdate.java b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpUpdate.java
similarity index 99%
rename from apps/routing/src/main/java/org/onosproject/routing/bgp/BgpUpdate.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpUpdate.java
index b30fb8d..afde4d8 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpUpdate.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/BgpUpdate.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import org.apache.commons.lang3.tuple.Pair;
diff --git a/apps/routing/src/main/java/org/onosproject/routing/bgp/RouteEntry.java b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/RouteEntry.java
similarity index 99%
rename from apps/routing/src/main/java/org/onosproject/routing/bgp/RouteEntry.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/bgp/RouteEntry.java
index 8053ecd..20d1298 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/bgp/RouteEntry.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/RouteEntry.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import com.google.common.base.MoreObjects;
diff --git a/apps/routing/src/main/java/org/onosproject/routing/bgp/RouteUpdate.java b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/RouteUpdate.java
similarity index 99%
rename from apps/routing/src/main/java/org/onosproject/routing/bgp/RouteUpdate.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/bgp/RouteUpdate.java
index 332933d..07cb589 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/bgp/RouteUpdate.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/RouteUpdate.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import com.google.common.base.MoreObjects;
diff --git a/apps/routing/src/main/java/org/onosproject/routing/bgp/package-info.java b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/package-info.java
similarity index 92%
rename from apps/routing/src/main/java/org/onosproject/routing/bgp/package-info.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/bgp/package-info.java
index 4da087d..d4b18ae 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/bgp/package-info.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/bgp/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/cli/AddPeerCommand.java b/apps/routing/common/src/main/java/org/onosproject/routing/cli/AddPeerCommand.java
similarity index 98%
rename from apps/routing/src/main/java/org/onosproject/routing/cli/AddPeerCommand.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/cli/AddPeerCommand.java
index 5a83f96..8d89c45 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/cli/AddPeerCommand.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/cli/AddPeerCommand.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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/cli/AddSpeakerCommand.java b/apps/routing/common/src/main/java/org/onosproject/routing/cli/AddSpeakerCommand.java
similarity index 98%
rename from apps/routing/src/main/java/org/onosproject/routing/cli/AddSpeakerCommand.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/cli/AddSpeakerCommand.java
index 55dc168..49fb4f4 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/cli/AddSpeakerCommand.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/cli/AddSpeakerCommand.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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/cli/BgpNeighborsListCommand.java b/apps/routing/common/src/main/java/org/onosproject/routing/cli/BgpNeighborsListCommand.java
similarity index 99%
rename from apps/routing/src/main/java/org/onosproject/routing/cli/BgpNeighborsListCommand.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/cli/BgpNeighborsListCommand.java
index 05f0404..c7d6e1b 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/cli/BgpNeighborsListCommand.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/cli/BgpNeighborsListCommand.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.cli;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/apps/routing/src/main/java/org/onosproject/routing/cli/BgpRoutesListCommand.java b/apps/routing/common/src/main/java/org/onosproject/routing/cli/BgpRoutesListCommand.java
similarity index 99%
rename from apps/routing/src/main/java/org/onosproject/routing/cli/BgpRoutesListCommand.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/cli/BgpRoutesListCommand.java
index 0b35241..e140c9b 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/cli/BgpRoutesListCommand.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/cli/BgpRoutesListCommand.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.cli;
import com.fasterxml.jackson.databind.JsonNode;
@@ -22,10 +23,10 @@
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.routing.bgp.BgpConstants;
import org.onosproject.routing.bgp.BgpInfoService;
import org.onosproject.routing.bgp.BgpRouteEntry;
import org.onosproject.routing.bgp.BgpSession;
-import org.onosproject.routing.bgp.BgpConstants;
import java.util.ArrayList;
import java.util.Collection;
diff --git a/apps/routing/src/main/java/org/onosproject/routing/cli/BgpSpeakersListCommand.java b/apps/routing/common/src/main/java/org/onosproject/routing/cli/BgpSpeakersListCommand.java
similarity index 97%
rename from apps/routing/src/main/java/org/onosproject/routing/cli/BgpSpeakersListCommand.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/cli/BgpSpeakersListCommand.java
index ce5a7af..2e4de6f 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/cli/BgpSpeakersListCommand.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/cli/BgpSpeakersListCommand.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/cli/RemovePeerCommand.java b/apps/routing/common/src/main/java/org/onosproject/routing/cli/RemovePeerCommand.java
similarity index 97%
rename from apps/routing/src/main/java/org/onosproject/routing/cli/RemovePeerCommand.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/cli/RemovePeerCommand.java
index 06293ef..204dfb7 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/cli/RemovePeerCommand.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/cli/RemovePeerCommand.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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/cli/RemoveSpeakerCommand.java b/apps/routing/common/src/main/java/org/onosproject/routing/cli/RemoveSpeakerCommand.java
similarity index 98%
rename from apps/routing/src/main/java/org/onosproject/routing/cli/RemoveSpeakerCommand.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/cli/RemoveSpeakerCommand.java
index 33120b9..cba02b6 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/cli/RemoveSpeakerCommand.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/cli/RemoveSpeakerCommand.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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/cli/package-info.java b/apps/routing/common/src/main/java/org/onosproject/routing/cli/package-info.java
similarity index 92%
rename from apps/routing/src/main/java/org/onosproject/routing/cli/package-info.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/cli/package-info.java
index db33684..fc50db3 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/cli/package-info.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/cli/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java b/apps/routing/common/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java
similarity index 99%
rename from apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java
index 5fbfe7f..d9b792d 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.config.impl;
import com.google.common.collect.ImmutableSet;
diff --git a/apps/routing/src/main/java/org/onosproject/routing/config/impl/package-info.java b/apps/routing/common/src/main/java/org/onosproject/routing/config/impl/package-info.java
similarity index 92%
rename from apps/routing/src/main/java/org/onosproject/routing/config/impl/package-info.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/config/impl/package-info.java
index d7d363a..b7a9594 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/config/impl/package-info.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/config/impl/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/impl/BgpSpeakerNeighbourHandler.java b/apps/routing/common/src/main/java/org/onosproject/routing/impl/BgpSpeakerNeighbourHandler.java
similarity index 99%
rename from apps/routing/src/main/java/org/onosproject/routing/impl/BgpSpeakerNeighbourHandler.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/impl/BgpSpeakerNeighbourHandler.java
index a3e2e00..4ebaac2 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/impl/BgpSpeakerNeighbourHandler.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/impl/BgpSpeakerNeighbourHandler.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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/impl/DirectHostManager.java b/apps/routing/common/src/main/java/org/onosproject/routing/impl/DirectHostManager.java
similarity index 99%
rename from apps/routing/src/main/java/org/onosproject/routing/impl/DirectHostManager.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/impl/DirectHostManager.java
index a1a7d25..7356d95 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/impl/DirectHostManager.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/impl/DirectHostManager.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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/impl/package-info.java b/apps/routing/common/src/main/java/org/onosproject/routing/impl/package-info.java
similarity index 92%
rename from apps/routing/src/main/java/org/onosproject/routing/impl/package-info.java
rename to apps/routing/common/src/main/java/org/onosproject/routing/impl/package-info.java
index c2d1e6b..c1ecfc2 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/impl/package-info.java
+++ b/apps/routing/common/src/main/java/org/onosproject/routing/impl/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/apps/routing/common/src/main/resources/OSGI-INF/blueprint/shell-config.xml
similarity index 93%
rename from apps/routing/src/main/resources/OSGI-INF/blueprint/shell-config.xml
rename to apps/routing/common/src/main/resources/OSGI-INF/blueprint/shell-config.xml
index 44c99f1..58e82f6 100644
--- a/apps/routing/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/apps/routing/common/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -37,8 +37,5 @@
<command>
<action class="org.onosproject.routing.cli.RemovePeerCommand"/>
</command>
- <command>
- <action class="org.onosproject.routing.fpm.cli.FpmConnectionsList"/>
- </command>
</command-bundle>
</blueprint>
diff --git a/apps/routing/src/test/java/org/onosproject/routing/bgp/AsPathTest.java b/apps/routing/common/src/test/java/org/onosproject/routing/bgp/AsPathTest.java
similarity index 97%
rename from apps/routing/src/test/java/org/onosproject/routing/bgp/AsPathTest.java
rename to apps/routing/common/src/test/java/org/onosproject/routing/bgp/AsPathTest.java
index a30405a..8c567e0 100644
--- a/apps/routing/src/test/java/org/onosproject/routing/bgp/AsPathTest.java
+++ b/apps/routing/common/src/test/java/org/onosproject/routing/bgp/AsPathTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import org.hamcrest.Matchers;
@@ -21,7 +22,6 @@
import java.util.ArrayList;
import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
/**
@@ -212,7 +212,7 @@
//
BgpRouteEntry.AsPath asPath2 = new BgpRouteEntry.AsPath(pathSegments);
- assertThat(asPath1, Matchers.is(not(asPath2)));
+ assertThat(asPath1, Matchers.is(Matchers.not(asPath2)));
}
/**
diff --git a/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpRouteEntryTest.java b/apps/routing/common/src/test/java/org/onosproject/routing/bgp/BgpRouteEntryTest.java
similarity index 98%
rename from apps/routing/src/test/java/org/onosproject/routing/bgp/BgpRouteEntryTest.java
rename to apps/routing/common/src/test/java/org/onosproject/routing/bgp/BgpRouteEntryTest.java
index 9482704..5a05792 100644
--- a/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpRouteEntryTest.java
+++ b/apps/routing/common/src/test/java/org/onosproject/routing/bgp/BgpRouteEntryTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import org.easymock.EasyMock;
@@ -25,7 +26,6 @@
import java.util.ArrayList;
import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
/**
@@ -499,7 +499,7 @@
localPref);
bgpRouteEntry2.setMultiExitDisc(multiExitDisc);
- assertThat(bgpRouteEntry1, Matchers.is(not(bgpRouteEntry2)));
+ assertThat(bgpRouteEntry1, Matchers.is(Matchers.not(bgpRouteEntry2)));
}
/**
diff --git a/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java b/apps/routing/common/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java
similarity index 99%
rename from apps/routing/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java
rename to apps/routing/common/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java
index 7769f6f..9f9ad3c 100644
--- a/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java
+++ b/apps/routing/common/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import com.google.common.net.InetAddresses;
diff --git a/apps/routing/src/test/java/org/onosproject/routing/bgp/PathSegmentTest.java b/apps/routing/common/src/test/java/org/onosproject/routing/bgp/PathSegmentTest.java
similarity index 96%
rename from apps/routing/src/test/java/org/onosproject/routing/bgp/PathSegmentTest.java
rename to apps/routing/common/src/test/java/org/onosproject/routing/bgp/PathSegmentTest.java
index 6df4f84..8605161 100644
--- a/apps/routing/src/test/java/org/onosproject/routing/bgp/PathSegmentTest.java
+++ b/apps/routing/common/src/test/java/org/onosproject/routing/bgp/PathSegmentTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import org.hamcrest.Matchers;
@@ -21,7 +22,6 @@
import java.util.ArrayList;
import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
/**
@@ -114,7 +114,7 @@
BgpRouteEntry.PathSegment pathSegment2 =
new BgpRouteEntry.PathSegment(pathSegmentType, segmentAsNumbers);
- assertThat(pathSegment1, Matchers.is(not(pathSegment2)));
+ assertThat(pathSegment1, Matchers.is(Matchers.not(pathSegment2)));
}
/**
diff --git a/apps/routing/src/test/java/org/onosproject/routing/bgp/RouteEntryTest.java b/apps/routing/common/src/test/java/org/onosproject/routing/bgp/RouteEntryTest.java
similarity index 99%
rename from apps/routing/src/test/java/org/onosproject/routing/bgp/RouteEntryTest.java
rename to apps/routing/common/src/test/java/org/onosproject/routing/bgp/RouteEntryTest.java
index 95982a8..901d608 100644
--- a/apps/routing/src/test/java/org/onosproject/routing/bgp/RouteEntryTest.java
+++ b/apps/routing/common/src/test/java/org/onosproject/routing/bgp/RouteEntryTest.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import org.hamcrest.Matchers;
diff --git a/apps/routing/src/test/java/org/onosproject/routing/bgp/TestBgpPeerChannelHandler.java b/apps/routing/common/src/test/java/org/onosproject/routing/bgp/TestBgpPeerChannelHandler.java
similarity index 99%
rename from apps/routing/src/test/java/org/onosproject/routing/bgp/TestBgpPeerChannelHandler.java
rename to apps/routing/common/src/test/java/org/onosproject/routing/bgp/TestBgpPeerChannelHandler.java
index a4ec1b4..5ce6462 100644
--- a/apps/routing/src/test/java/org/onosproject/routing/bgp/TestBgpPeerChannelHandler.java
+++ b/apps/routing/common/src/test/java/org/onosproject/routing/bgp/TestBgpPeerChannelHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import org.jboss.netty.buffer.ChannelBuffer;
diff --git a/apps/routing/src/test/java/org/onosproject/routing/bgp/TestBgpPeerFrameDecoder.java b/apps/routing/common/src/test/java/org/onosproject/routing/bgp/TestBgpPeerFrameDecoder.java
similarity index 98%
rename from apps/routing/src/test/java/org/onosproject/routing/bgp/TestBgpPeerFrameDecoder.java
rename to apps/routing/common/src/test/java/org/onosproject/routing/bgp/TestBgpPeerFrameDecoder.java
index d8fcc52..ef9f1d3 100644
--- a/apps/routing/src/test/java/org/onosproject/routing/bgp/TestBgpPeerFrameDecoder.java
+++ b/apps/routing/common/src/test/java/org/onosproject/routing/bgp/TestBgpPeerFrameDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.bgp;
import org.jboss.netty.buffer.ChannelBuffer;
diff --git a/apps/routing/cpr/BUCK b/apps/routing/cpr/BUCK
new file mode 100644
index 0000000..89a499d
--- /dev/null
+++ b/apps/routing/cpr/BUCK
@@ -0,0 +1,30 @@
+COMPILE_DEPS = [
+ '//lib:CORE_DEPS',
+ '//incubator/api:onos-incubator-api',
+ '//apps/routing-api:onos-apps-routing-api',
+]
+
+TEST_DEPS = [
+ '//lib:TEST_ADAPTERS',
+ '//incubator/api:onos-incubator-api-tests',
+ '//apps/routing-api:onos-apps-routing-api-tests',
+]
+
+osgi_jar_with_tests (
+ deps = COMPILE_DEPS,
+ test_deps = TEST_DEPS,
+)
+
+BUNDLES = [
+ '//apps/routing/cpr:onos-apps-routing-cpr',
+ '//apps/routing-api:onos-apps-routing-api',
+]
+
+onos_app (
+ app_name = 'org.onosproject.cpr',
+ title = 'Control plane redirect',
+ category = 'Traffic Steering',
+ url = 'http://onosproject.org',
+ description = 'Redirects routing control traffic to a control plane',
+ included_bundles = BUNDLES,
+)
diff --git a/apps/routing/cpr/pom.xml b/apps/routing/cpr/pom.xml
new file mode 100644
index 0000000..cbc03df
--- /dev/null
+++ b/apps/routing/cpr/pom.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<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/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>onos-app-routing-parent</artifactId>
+ <groupId>org.onosproject</groupId>
+ <version>1.9.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>onos-apps-routing-cpr</artifactId>
+ <packaging>bundle</packaging>
+
+
+</project>
diff --git a/apps/routing/src/main/java/org/onosproject/routing/impl/ControlPlaneRedirectManager.java b/apps/routing/cpr/src/main/java/org/onosproject/routing/cpr/ControlPlaneRedirectManager.java
similarity index 97%
rename from apps/routing/src/main/java/org/onosproject/routing/impl/ControlPlaneRedirectManager.java
rename to apps/routing/cpr/src/main/java/org/onosproject/routing/cpr/ControlPlaneRedirectManager.java
index f72963c..e1d2d39 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/impl/ControlPlaneRedirectManager.java
+++ b/apps/routing/cpr/src/main/java/org/onosproject/routing/cpr/ControlPlaneRedirectManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.routing.impl;
+package org.onosproject.routing.cpr;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Lists;
@@ -57,6 +57,8 @@
import org.onosproject.net.host.HostListener;
import org.onosproject.net.host.HostService;
import org.onosproject.net.host.InterfaceIpAddress;
+import org.onosproject.routing.AsyncDeviceFetcher;
+import org.onosproject.routing.RouterInterfaceManager;
import org.onosproject.routing.RoutingService;
import org.onosproject.routing.config.RouterConfig;
import org.slf4j.Logger;
@@ -80,11 +82,13 @@
* Manages connectivity between peers redirecting control traffic to a routing
* control plane available on the dataplane.
*/
-@Component(immediate = true, enabled = false)
+@Component(immediate = true)
public class ControlPlaneRedirectManager {
private final Logger log = getLogger(getClass());
+ public static final short ASSIGNED_VLAN = 4094;
+
private static final int MIN_IP_PRIORITY = 10;
private static final int IPV4_PRIORITY = 2000;
private static final int IPV6_PRIORITY = 500;
@@ -140,6 +144,7 @@
processRouterConfig();
+
// FIXME There can be an issue when this component is deactivated before vRouter
applicationService.registerDeactivateHook(this.appId, () -> {
if (interfaceManager != null) {
@@ -239,10 +244,10 @@
int cpNextId, intfNextId;
if (intf.vlan() == VlanId.NONE) {
cpNextId = modifyNextObjective(deviceId, controlPlanePort,
- VlanId.vlanId(SingleSwitchFibInstaller.ASSIGNED_VLAN),
+ VlanId.vlanId(ASSIGNED_VLAN),
true, install);
intfNextId = modifyNextObjective(deviceId, intf.connectPoint().port(),
- VlanId.vlanId(SingleSwitchFibInstaller.ASSIGNED_VLAN),
+ VlanId.vlanId(ASSIGNED_VLAN),
true, install);
} else {
cpNextId = modifyNextObjective(deviceId, controlPlanePort,
@@ -365,7 +370,7 @@
int cpNextId;
if (intf.vlan() == VlanId.NONE) {
cpNextId = modifyNextObjective(deviceId, controlPlanePort,
- VlanId.vlanId(SingleSwitchFibInstaller.ASSIGNED_VLAN),
+ VlanId.vlanId(ASSIGNED_VLAN),
true, install);
} else {
cpNextId = modifyNextObjective(deviceId, controlPlanePort,
@@ -680,7 +685,7 @@
TrafficSelector.Builder metabuilder = DefaultTrafficSelector.builder();
VlanId matchVlanId = (vlanId.equals(VlanId.NONE)) ?
- VlanId.vlanId(SingleSwitchFibInstaller.ASSIGNED_VLAN) :
+ VlanId.vlanId(ASSIGNED_VLAN) :
vlanId;
metabuilder.matchVlanId(matchVlanId);
nextObjBuilder.withMeta(metabuilder.build());
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/cli/package-info.java b/apps/routing/cpr/src/main/java/org/onosproject/routing/cpr/package-info.java
similarity index 82%
copy from apps/routing/src/main/java/org/onosproject/routing/fpm/cli/package-info.java
copy to apps/routing/cpr/src/main/java/org/onosproject/routing/cpr/package-info.java
index c1729ab..b098961 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/cli/package-info.java
+++ b/apps/routing/cpr/src/main/java/org/onosproject/routing/cpr/package-info.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.
@@ -15,6 +15,6 @@
*/
/**
- * FPM-related CLI commands.
+ * Control plane redirect.
*/
-package org.onosproject.routing.fpm.cli;
+package org.onosproject.routing.cpr;
diff --git a/apps/routing/src/test/java/org/onosproject/routing/impl/ControlPlaneRedirectManagerTest.java b/apps/routing/cpr/src/test/java/org/onosproject/routing/cpr/ControlPlaneRedirectManagerTest.java
similarity index 96%
rename from apps/routing/src/test/java/org/onosproject/routing/impl/ControlPlaneRedirectManagerTest.java
rename to apps/routing/cpr/src/test/java/org/onosproject/routing/cpr/ControlPlaneRedirectManagerTest.java
index 08864c8..1291f8f 100644
--- a/apps/routing/src/test/java/org/onosproject/routing/impl/ControlPlaneRedirectManagerTest.java
+++ b/apps/routing/cpr/src/test/java/org/onosproject/routing/cpr/ControlPlaneRedirectManagerTest.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,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.routing.impl;
+
+package org.onosproject.routing.cpr;
import com.google.common.collect.Sets;
import org.easymock.EasyMock;
@@ -79,11 +80,11 @@
import static org.easymock.EasyMock.verify;
import static org.onlab.packet.ICMP6.NEIGHBOR_ADVERTISEMENT;
import static org.onlab.packet.ICMP6.NEIGHBOR_SOLICITATION;
-import static org.onosproject.routing.impl.ControlPlaneRedirectManager.ACL_PRIORITY;
-import static org.onosproject.routing.impl.ControlPlaneRedirectManager.buildArpSelector;
-import static org.onosproject.routing.impl.ControlPlaneRedirectManager.buildIPDstSelector;
-import static org.onosproject.routing.impl.ControlPlaneRedirectManager.buildIPSrcSelector;
-import static org.onosproject.routing.impl.ControlPlaneRedirectManager.buildNdpSelector;
+import static org.onosproject.routing.cpr.ControlPlaneRedirectManager.ACL_PRIORITY;
+import static org.onosproject.routing.cpr.ControlPlaneRedirectManager.buildArpSelector;
+import static org.onosproject.routing.cpr.ControlPlaneRedirectManager.buildIPDstSelector;
+import static org.onosproject.routing.cpr.ControlPlaneRedirectManager.buildIPSrcSelector;
+import static org.onosproject.routing.cpr.ControlPlaneRedirectManager.buildNdpSelector;
/**
* UnitTests for ControlPlaneRedirectManager.
@@ -272,9 +273,9 @@
int cpNextId, intfNextId;
cpNextId = modifyNextObjective(deviceId, controlPlanePort,
- VlanId.vlanId(SingleSwitchFibInstaller.ASSIGNED_VLAN), true, install);
+ VlanId.vlanId(ControlPlaneRedirectManager.ASSIGNED_VLAN), true, install);
intfNextId = modifyNextObjective(deviceId, intf.connectPoint().port(),
- VlanId.vlanId(SingleSwitchFibInstaller.ASSIGNED_VLAN), true, install);
+ VlanId.vlanId(ControlPlaneRedirectManager.ASSIGNED_VLAN), true, install);
// IP to router
TrafficSelector toSelector = buildIPDstSelector(
diff --git a/apps/routing/fibinstaller/BUCK b/apps/routing/fibinstaller/BUCK
new file mode 100644
index 0000000..b77e51b
--- /dev/null
+++ b/apps/routing/fibinstaller/BUCK
@@ -0,0 +1,30 @@
+COMPILE_DEPS = [
+ '//lib:CORE_DEPS',
+ '//incubator/api:onos-incubator-api',
+ '//apps/routing-api:onos-apps-routing-api',
+]
+
+TEST_DEPS = [
+ '//lib:TEST_ADAPTERS',
+ '//incubator/api:onos-incubator-api-tests',
+ '//apps/routing-api:onos-apps-routing-api-tests',
+]
+
+osgi_jar_with_tests (
+ deps = COMPILE_DEPS,
+ test_deps = TEST_DEPS,
+)
+
+BUNDLES = [
+ '//apps/routing/fibinstaller:onos-apps-routing-fibinstaller',
+ '//apps/routing-api:onos-apps-routing-api',
+]
+
+onos_app (
+ app_name = 'org.onosproject.fibinstaller',
+ title = 'FIB installer app',
+ category = 'Traffic Steering',
+ url = 'http://onosproject.org',
+ description = 'Installs routing rules into switches',
+ included_bundles = BUNDLES,
+)
diff --git a/apps/routing/fibinstaller/pom.xml b/apps/routing/fibinstaller/pom.xml
new file mode 100644
index 0000000..5cb98e6
--- /dev/null
+++ b/apps/routing/fibinstaller/pom.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<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/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>onos-app-routing-parent</artifactId>
+ <groupId>org.onosproject</groupId>
+ <version>1.9.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>onos-apps-routing-fibinstaller</artifactId>
+ <packaging>bundle</packaging>
+
+
+</project>
diff --git a/apps/routing/src/main/java/org/onosproject/routing/impl/SingleSwitchFibInstaller.java b/apps/routing/fibinstaller/src/main/java/org/onosproject/routing/fibinstaller/SingleSwitchFibInstaller.java
similarity index 98%
rename from apps/routing/src/main/java/org/onosproject/routing/impl/SingleSwitchFibInstaller.java
rename to apps/routing/fibinstaller/src/main/java/org/onosproject/routing/fibinstaller/SingleSwitchFibInstaller.java
index b55dba6..c6b3af4 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/impl/SingleSwitchFibInstaller.java
+++ b/apps/routing/fibinstaller/src/main/java/org/onosproject/routing/fibinstaller/SingleSwitchFibInstaller.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.routing.impl;
+package org.onosproject.routing.fibinstaller;
import com.google.common.collect.ConcurrentHashMultiset;
import com.google.common.collect.Maps;
@@ -67,6 +67,10 @@
import org.onosproject.net.flowobjective.ForwardingObjective;
import org.onosproject.net.flowobjective.NextObjective;
import org.onosproject.net.flowobjective.ObjectiveContext;
+import org.onosproject.routing.AsyncDeviceFetcher;
+import org.onosproject.routing.NextHop;
+import org.onosproject.routing.NextHopGroupKey;
+import org.onosproject.routing.RouterInterfaceManager;
import org.onosproject.routing.RoutingService;
import org.onosproject.routing.config.RouterConfig;
import org.osgi.service.component.ComponentContext;
@@ -80,7 +84,7 @@
/**
* Programs routes to a single OpenFlow switch.
*/
-@Component(immediate = true, enabled = false)
+@Component(immediate = true)
public class SingleSwitchFibInstaller {
private final Logger log = LoggerFactory.getLogger(getClass());
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/package-info.java b/apps/routing/fibinstaller/src/main/java/org/onosproject/routing/fibinstaller/package-info.java
similarity index 81%
copy from apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/package-info.java
copy to apps/routing/fibinstaller/src/main/java/org/onosproject/routing/fibinstaller/package-info.java
index 5d18761..669754d 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/package-info.java
+++ b/apps/routing/fibinstaller/src/main/java/org/onosproject/routing/fibinstaller/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
@@ -15,6 +15,6 @@
*/
/**
- * FPM protocol implementation.
+ * Single switch FIB installer.
*/
-package org.onosproject.routing.fpm.protocol;
+package org.onosproject.routing.fibinstaller;
diff --git a/apps/routing/src/test/java/org/onosproject/routing/impl/SingleSwitchFibInstallerTest.java b/apps/routing/fibinstaller/src/test/java/org/onosproject/routing/fibinstaller/SingleSwitchFibInstallerTest.java
similarity index 98%
rename from apps/routing/src/test/java/org/onosproject/routing/impl/SingleSwitchFibInstallerTest.java
rename to apps/routing/fibinstaller/src/test/java/org/onosproject/routing/fibinstaller/SingleSwitchFibInstallerTest.java
index 1e6efb5..f7736f7 100644
--- a/apps/routing/src/test/java/org/onosproject/routing/impl/SingleSwitchFibInstallerTest.java
+++ b/apps/routing/fibinstaller/src/test/java/org/onosproject/routing/fibinstaller/SingleSwitchFibInstallerTest.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,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.routing.impl;
+
+package org.onosproject.routing.fibinstaller;
import com.google.common.collect.Sets;
import org.easymock.EasyMock;
diff --git a/apps/routing/fpm/BUCK b/apps/routing/fpm/BUCK
new file mode 100644
index 0000000..b221d0e
--- /dev/null
+++ b/apps/routing/fpm/BUCK
@@ -0,0 +1,30 @@
+COMPILE_DEPS = [
+ '//lib:CORE_DEPS',
+ '//lib:org.apache.karaf.shell.console',
+ '//cli:onos-cli',
+ '//incubator/api:onos-incubator-api',
+ '//apps/routing-api:onos-apps-routing-api',
+]
+
+TEST_DEPS = [
+ '//lib:TEST_ADAPTERS',
+]
+
+osgi_jar_with_tests (
+ deps = COMPILE_DEPS,
+ test_deps = TEST_DEPS,
+)
+
+BUNDLES = [
+ '//apps/routing/fpm:onos-apps-routing-fpm',
+ '//apps/routing-api:onos-apps-routing-api',
+]
+
+onos_app (
+ app_name = 'org.onosproject.fpm',
+ title = 'FIB Push Manager (FPM) route reciever',
+ category = 'Utility',
+ url = 'http://onosproject.org',
+ description = 'Receives routes from external routing daemon over FPM protocol',
+ included_bundles = BUNDLES,
+)
diff --git a/apps/routing/fpm/pom.xml b/apps/routing/fpm/pom.xml
new file mode 100644
index 0000000..03427d7
--- /dev/null
+++ b/apps/routing/fpm/pom.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<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/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>onos-app-routing-parent</artifactId>
+ <groupId>org.onosproject</groupId>
+ <version>1.9.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>onos-apps-fpm</artifactId>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty</artifactId>
+ </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>
+ </dependencies>
+
+</project>
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/FpmFrameDecoder.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/FpmFrameDecoder.java
similarity index 96%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/FpmFrameDecoder.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/FpmFrameDecoder.java
index 87907cd..479b4da 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/FpmFrameDecoder.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/FpmFrameDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/FpmInfoService.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/FpmInfoService.java
similarity index 93%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/FpmInfoService.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/FpmInfoService.java
index 3f5068b..018b1bb 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/FpmInfoService.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/FpmInfoService.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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/FpmListener.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/FpmListener.java
similarity index 96%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/FpmListener.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/FpmListener.java
index c7fffd1..37fe1f7 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/FpmListener.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/FpmListener.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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/FpmManager.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/FpmManager.java
similarity index 98%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/FpmManager.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/FpmManager.java
index 9065044..0ca21e6 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/FpmManager.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/FpmManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onosproject.routing.fpm;
import com.google.common.collect.ImmutableList;
@@ -67,7 +68,7 @@
* Forwarding Plane Manager (FPM) route source.
*/
@Service
-@Component(immediate = true, enabled = false)
+@Component(immediate = true)
public class FpmManager implements FpmInfoService {
private final Logger log = LoggerFactory.getLogger(getClass());
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/FpmSessionHandler.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/FpmSessionHandler.java
similarity index 98%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/FpmSessionHandler.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/FpmSessionHandler.java
index 35e482b..33f845e 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/FpmSessionHandler.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/FpmSessionHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/cli/FpmConnectionsList.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/cli/FpmConnectionsList.java
similarity index 91%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/cli/FpmConnectionsList.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/cli/FpmConnectionsList.java
index 9d180eb..86dd44c 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/cli/FpmConnectionsList.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/cli/FpmConnectionsList.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.
@@ -34,7 +34,7 @@
@Override
protected void execute() {
- FpmInfoService fpmInfo = get(FpmInfoService.class);
+ FpmInfoService fpmInfo = AbstractShellCommand.get(FpmInfoService.class);
fpmInfo.peers().forEach((socketAddress, timestamp) -> {
if (socketAddress instanceof InetSocketAddress) {
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/cli/package-info.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/cli/package-info.java
similarity index 92%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/cli/package-info.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/cli/package-info.java
index c1729ab..8c4812d 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/cli/package-info.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/cli/package-info.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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/package-info.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/package-info.java
similarity index 92%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/package-info.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/package-info.java
index 851f7f8..1f4f1de 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/package-info.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/FpmHeader.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/FpmHeader.java
similarity index 98%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/FpmHeader.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/FpmHeader.java
index ce8cf58..5bba9fb 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/FpmHeader.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/FpmHeader.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/Netlink.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/Netlink.java
similarity index 98%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/Netlink.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/Netlink.java
index 08e1ee2..79c23ab 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/Netlink.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/Netlink.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/NetlinkMessageType.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/NetlinkMessageType.java
similarity index 96%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/NetlinkMessageType.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/NetlinkMessageType.java
index 9b27c0c..0abb0bd 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/NetlinkMessageType.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/NetlinkMessageType.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttribute.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttribute.java
similarity index 98%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttribute.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttribute.java
index d8b0474..cffb422 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttribute.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttribute.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeDecoder.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeDecoder.java
similarity index 95%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeDecoder.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeDecoder.java
index e76f64b..f702c40 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeDecoder.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeDst.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeDst.java
similarity index 97%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeDst.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeDst.java
index 6913456..d12f14c 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeDst.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeDst.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeGateway.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeGateway.java
similarity index 97%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeGateway.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeGateway.java
index a9f6c49..0f5d158 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeGateway.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeGateway.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeOif.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeOif.java
similarity index 97%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeOif.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeOif.java
index 36d28a7..28c4b32 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeOif.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeOif.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributePriority.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributePriority.java
similarity index 97%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributePriority.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributePriority.java
index 19d720b..8f324f9 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributePriority.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributePriority.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RtNetlink.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RtNetlink.java
similarity index 98%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RtNetlink.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RtNetlink.java
index c3cf65a..f914f0c 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RtNetlink.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RtNetlink.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RtProtocol.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RtProtocol.java
similarity index 97%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RtProtocol.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RtProtocol.java
index dd682d4..de86394 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RtProtocol.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/RtProtocol.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.
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/package-info.java b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/package-info.java
similarity index 92%
rename from apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/package-info.java
rename to apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/package-info.java
index 5d18761..fed7b1e 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/package-info.java
+++ b/apps/routing/fpm/src/main/java/org/onosproject/routing/fpm/protocol/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-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.
diff --git a/apps/routing/fpm/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/apps/routing/fpm/src/main/resources/OSGI-INF/blueprint/shell-config.xml
new file mode 100644
index 0000000..fe6f8f5
--- /dev/null
+++ b/apps/routing/fpm/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -0,0 +1,23 @@
+<!--
+ ~ 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.
+ -->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+ <command>
+ <action class="org.onosproject.routing.fpm.cli.FpmConnectionsList"/>
+ </command>
+ </command-bundle>
+</blueprint>
diff --git a/apps/routing/pom.xml b/apps/routing/pom.xml
index 11db777..bfe163d 100644
--- a/apps/routing/pom.xml
+++ b/apps/routing/pom.xml
@@ -24,10 +24,16 @@
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>onos-app-routing</artifactId>
+ <artifactId>onos-app-routing-parent</artifactId>
- <packaging>bundle</packaging>
+ <packaging>pom</packaging>
<description>Libraries for routing applications</description>
+ <modules>
+ <module>fibinstaller</module>
+ <module>common</module>
+ <module>cpr</module>
+ <module>fpm</module>
+ </modules>
<dependencies>
<dependency>
@@ -53,46 +59,8 @@
</dependency>
<dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-cli</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- FIXME: not OSGi-ready -->
- <dependency>
- <groupId>com.googlecode.concurrent-trees</groupId>
- <artifactId>concurrent-trees</artifactId>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-misc</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>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
-
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty</artifactId>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
</dependency>
<dependency>
@@ -101,16 +69,6 @@
</dependency>
<dependency>
- <groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.console</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
-
- <dependency>
<groupId>org.onosproject</groupId>
<artifactId>onlab-junit</artifactId>
<scope>test</scope>
diff --git a/apps/routing/src/main/java/org/onosproject/routing/impl/AsyncDeviceFetcher.java b/apps/routing/src/main/java/org/onosproject/routing/impl/AsyncDeviceFetcher.java
deleted file mode 100644
index f48fef0..0000000
--- a/apps/routing/src/main/java/org/onosproject/routing/impl/AsyncDeviceFetcher.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.
- */
-
-package org.onosproject.routing.impl;
-
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.device.DeviceEvent;
-import org.onosproject.net.device.DeviceListener;
-import org.onosproject.net.device.DeviceService;
-
-import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Provides a means of asynchronously waiting on devices.
- */
-public final class AsyncDeviceFetcher {
-
- private DeviceService deviceService;
-
- private DeviceListener listener = new InternalDeviceListener();
-
- private Map<DeviceId, CompletableFuture<DeviceId>> devices = new ConcurrentHashMap();
-
- private AsyncDeviceFetcher(DeviceService deviceService) {
- this.deviceService = deviceService;
- deviceService.addListener(listener);
- }
-
- /**
- * Shuts down.
- */
- public void shutdown() {
- deviceService.removeListener(listener);
- devices.clear();
- }
-
- /**
- * Returns a completable future that completes when the device is available
- * for the first time.
- *
- * @param deviceId ID of the device
- * @return completable future
- */
- public CompletableFuture<DeviceId> getDevice(DeviceId deviceId) {
- CompletableFuture<DeviceId> future = new CompletableFuture<>();
- return devices.computeIfAbsent(deviceId, deviceId1 -> {
- if (deviceService.isAvailable(deviceId)) {
- future.complete(deviceId);
- }
- return future;
- });
- }
-
- /**
- * Creates a device fetcher based on the device service.
- *
- * @param deviceService device service
- * @return device fetcher
- */
- public static AsyncDeviceFetcher create(DeviceService deviceService) {
- return new AsyncDeviceFetcher(deviceService);
- }
-
- private class InternalDeviceListener implements DeviceListener {
- @Override
- public void event(DeviceEvent event) {
- switch (event.type()) {
- case DEVICE_ADDED:
- case DEVICE_AVAILABILITY_CHANGED:
- if (deviceService.isAvailable(event.subject().id())) {
- DeviceId deviceId = event.subject().id();
- CompletableFuture<DeviceId> future = devices.get(deviceId);
- if (future != null) {
- future.complete(deviceId);
- }
- }
- break;
- case DEVICE_UPDATED:
- case DEVICE_REMOVED:
- case DEVICE_SUSPENDED:
- case PORT_ADDED:
- case PORT_UPDATED:
- case PORT_REMOVED:
- default:
- break;
- }
- }
- }
-}
diff --git a/apps/routing/src/main/java/org/onosproject/routing/impl/NextHop.java b/apps/routing/src/main/java/org/onosproject/routing/impl/NextHop.java
deleted file mode 100644
index 71e02d6..0000000
--- a/apps/routing/src/main/java/org/onosproject/routing/impl/NextHop.java
+++ /dev/null
@@ -1,101 +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.routing.impl;
-
-import java.util.Objects;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-
-import com.google.common.base.MoreObjects;
-
-/**
- * Represents a next hop for routing, whose MAC address has already been resolved.
- */
-public class NextHop {
-
- private final IpAddress ip;
- private final MacAddress mac;
- private final NextHopGroupKey group;
-
- /**
- * Creates a new next hop.
- *
- * @param ip next hop's IP address
- * @param mac next hop's MAC address
- * @param group next hop's group
- */
- public NextHop(IpAddress ip, MacAddress mac, NextHopGroupKey group) {
- this.ip = ip;
- this.mac = mac;
- this.group = group;
- }
-
- /**
- * Returns the next hop's IP address.
- *
- * @return next hop's IP address
- */
- public IpAddress ip() {
- return ip;
- }
-
- /**
- * Returns the next hop's MAC address.
- *
- * @return next hop's MAC address
- */
- public MacAddress mac() {
- return mac;
- }
-
- /**
- * Returns the next hop group.
- *
- * @return group
- */
- public NextHopGroupKey group() {
- return group;
- }
-
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof NextHop)) {
- return false;
- }
-
- NextHop that = (NextHop) o;
-
- return Objects.equals(this.ip, that.ip) &&
- Objects.equals(this.mac, that.mac) &&
- Objects.equals(this.group, that.group);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(ip, mac, group);
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("ip", ip)
- .add("mac", mac)
- .add("group", group)
- .toString();
- }
-}
diff --git a/apps/routing/src/main/java/org/onosproject/routing/impl/NextHopGroupKey.java b/apps/routing/src/main/java/org/onosproject/routing/impl/NextHopGroupKey.java
deleted file mode 100644
index d2a693b..0000000
--- a/apps/routing/src/main/java/org/onosproject/routing/impl/NextHopGroupKey.java
+++ /dev/null
@@ -1,73 +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.routing.impl;
-
-import com.google.common.base.MoreObjects;
-import org.onlab.packet.IpAddress;
-
-import java.util.Objects;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Identifier for a next hop group.
- */
-public class NextHopGroupKey {
-
- private final IpAddress address;
-
- /**
- * Creates a new next hop group key.
- *
- * @param address next hop's IP address
- */
- public NextHopGroupKey(IpAddress address) {
- this.address = checkNotNull(address);
- }
-
- /**
- * Returns the next hop's IP address.
- *
- * @return next hop's IP address
- */
- public IpAddress address() {
- return address;
- }
-
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof NextHopGroupKey)) {
- return false;
- }
-
- NextHopGroupKey that = (NextHopGroupKey) o;
-
- return Objects.equals(this.address, that.address);
- }
-
- @Override
- public int hashCode() {
- return address.hashCode();
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("address", address)
- .toString();
- }
-}
diff --git a/apps/routing/src/main/java/org/onosproject/routing/impl/RouterInterfaceManager.java b/apps/routing/src/main/java/org/onosproject/routing/impl/RouterInterfaceManager.java
deleted file mode 100644
index 87d3f56..0000000
--- a/apps/routing/src/main/java/org/onosproject/routing/impl/RouterInterfaceManager.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * 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.
- */
-
-package org.onosproject.routing.impl;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-import org.onosproject.incubator.net.intf.Interface;
-import org.onosproject.incubator.net.intf.InterfaceEvent;
-import org.onosproject.incubator.net.intf.InterfaceListener;
-import org.onosproject.incubator.net.intf.InterfaceService;
-import org.onosproject.net.DeviceId;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.function.Consumer;
-import java.util.stream.Stream;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Manages which interfaces are part of the router when the configuration is
- * updated, and handles the provisioning/unprovisioning of interfaces when they
- * are added/removed.
- */
-public class RouterInterfaceManager {
-
- private final Logger log = LoggerFactory.getLogger(getClass());
-
- private final Consumer<Interface> provisioner;
- private final Consumer<Interface> unprovisioner;
-
- private Set<String> configuredInterfaces = Collections.emptySet();
- private Set<Interface> provisioned = new HashSet<>();
-
- private InterfaceService interfaceService;
- private InterfaceListener listener = new InternalInterfaceListener();
-
- private final DeviceId routerDeviceId;
-
- /**
- * Creates a new router interface manager.
- *
- * @param deviceId router device ID
- * @param configuredInterfaces names of interfaces configured for this router
- * @param interfaceService interface service
- * @param provisioner consumer that will provision new interfaces
- * @param unprovisioner consumer that will unprovision old interfaces
- */
- public RouterInterfaceManager(DeviceId deviceId,
- Set<String> configuredInterfaces,
- InterfaceService interfaceService,
- Consumer<Interface> provisioner,
- Consumer<Interface> unprovisioner) {
- this.routerDeviceId = checkNotNull(deviceId);
- this.provisioner = checkNotNull(provisioner);
- this.unprovisioner = checkNotNull(unprovisioner);
- this.interfaceService = checkNotNull(interfaceService);
- this.configuredInterfaces = checkNotNull(configuredInterfaces);
-
- provision();
-
- interfaceService.addListener(listener);
- }
-
- /**
- * Cleans up the router and unprovisions all interfaces.
- */
- public void cleanup() {
- interfaceService.removeListener(listener);
-
- unprovision();
- }
-
- /**
- * Retrieves the set of configured interface names.
- *
- * @return interface names
- */
- public Set<String> configuredInterfaces() {
- return configuredInterfaces;
- }
-
- /**
- * Changes the set of interfaces configured on the router.
- *
- * @param newConfiguredInterfaces new set of router interfaces
- */
- public void changeConfiguredInterfaces(Set<String> newConfiguredInterfaces) {
- Set<String> oldConfiguredInterfaces = configuredInterfaces;
- configuredInterfaces = ImmutableSet.copyOf(newConfiguredInterfaces);
-
- if (newConfiguredInterfaces.isEmpty() && !oldConfiguredInterfaces.isEmpty()) {
- // Reverted to using all interfaces. Provision interfaces that
- // weren't previously in the configured list
- getInterfacesForDevice(routerDeviceId)
- .filter(intf -> !oldConfiguredInterfaces.contains(intf.name()))
- .forEach(this::provision);
- } else if (!newConfiguredInterfaces.isEmpty() && oldConfiguredInterfaces.isEmpty()) {
- // Began using an interface list. Unprovision interfaces that
- // are not in the new interface list.
- getInterfacesForDevice(routerDeviceId)
- .filter(intf -> !newConfiguredInterfaces.contains(intf.name()))
- .forEach(this::unprovision);
- } else {
- // The existing interface list was changed.
- Set<String> toUnprovision = Sets.difference(oldConfiguredInterfaces, newConfiguredInterfaces);
- Set<String> toProvision = Sets.difference(newConfiguredInterfaces, oldConfiguredInterfaces);
-
- toUnprovision.forEach(name ->
- getInterfacesForDevice(routerDeviceId)
- .filter(intf -> intf.name().equals(name))
- .findFirst()
- .ifPresent(this::unprovision)
- );
-
- toProvision.forEach(name ->
- getInterfacesForDevice(routerDeviceId)
- .filter(intf -> intf.name().equals(name))
- .findFirst()
- .ifPresent(this::provision)
- );
- }
-
- configuredInterfaces = newConfiguredInterfaces;
- }
-
- private void provision() {
- getInterfacesForDevice(routerDeviceId)
- .filter(this::shouldUse)
- .forEach(this::provision);
- }
-
- private void unprovision() {
- getInterfacesForDevice(routerDeviceId)
- .filter(this::shouldUse)
- .forEach(this::unprovision);
- }
-
- private void provision(Interface intf) {
- if (!provisioned.contains(intf) && shouldUse(intf)) {
- log.info("Provisioning interface {}", intf);
- provisioner.accept(intf);
- provisioned.add(intf);
- }
- }
-
- private void unprovision(Interface intf) {
- if (provisioned.contains(intf)) {
- log.info("Unprovisioning interface {}", intf);
- unprovisioner.accept(intf);
- provisioned.remove(intf);
- }
- }
-
- private boolean shouldUse(Interface intf) {
- return configuredInterfaces.isEmpty() || configuredInterfaces.contains(intf.name());
- }
-
- private Stream<Interface> getInterfacesForDevice(DeviceId deviceId) {
- return interfaceService.getInterfaces().stream()
- .filter(intf -> intf.connectPoint().deviceId().equals(deviceId));
- }
-
- private class InternalInterfaceListener implements InterfaceListener {
- @Override
- public void event(InterfaceEvent event) {
- Interface intf = event.subject();
- switch (event.type()) {
- case INTERFACE_ADDED:
- provision(intf);
- break;
- case INTERFACE_UPDATED:
- // TODO
- break;
- case INTERFACE_REMOVED:
- unprovision(intf);
- break;
- default:
- break;
- }
- }
- }
-}