Charles Chan
Committed by Gerrit Code Review

[ONOS-3370] Extract hostprovider and lldpprovider from openflow

There are three independent apps:
    - openflow-base
    - hostprovider
    - lldpprovider
And there is also one meta-application called openflow that
contains all three of them.

Also fix the dependency issue when the apps are loaded from disk

Change-Id: I6da584e03593db9094b3a57976b28291f207c3c6
......@@ -183,21 +183,34 @@ public class GossipApplicationStore extends ApplicationArchive
* they are marked to be active.
*/
private void loadFromDisk() {
for (String name : getApplicationNames()) {
for (int i = 0; i < MAX_LOAD_RETRIES; i++) {
try {
Application app = create(getApplicationDescription(name), false);
if (app != null && isActive(app.id().name())) {
requiredBy.put(app.id(), coreAppId);
activate(app.id(), false);
// load app permissions
}
} catch (Exception e) {
log.warn("Unable to load application {} from disk; retrying", name);
randomDelay(RETRY_DELAY_MS); // FIXME: This is a deliberate hack; fix in Drake
getApplicationNames().forEach(appName -> {
Application app = loadFromDisk(appName);
if (app != null && isActive(app.id().name())) {
activate(app.id(), false);
// TODO Load app permissions
}
});
}
private Application loadFromDisk(String appName) {
for (int i = 0; i < MAX_LOAD_RETRIES; i++) {
try {
// Directly return if app already exists
ApplicationId appId = getId(appName);
if (appId != null) {
return getApplication(appId);
}
ApplicationDescription appDesc = getApplicationDescription(appName);
boolean success = appDesc.requiredApps().stream()
.noneMatch(requiredApp -> loadFromDisk(requiredApp) == null);
return success ? create(appDesc, false) : null;
} catch (Exception e) {
log.warn("Unable to load application {} from disk; retrying", appName);
randomDelay(RETRY_DELAY_MS); //FIXME: This is a deliberate hack; fix in Falcon
}
}
return null;
}
@Deactivate
......
......@@ -29,7 +29,11 @@
<artifactId>onos-host-provider</artifactId>
<packaging>bundle</packaging>
<description>ONOS host tracking provider</description>
<properties>
<onos.app.name>org.onosproject.hostprovider</onos.app.name>
</properties>
<description>ONOS host location provider</description>
<dependencies>
<dependency>
<groupId>org.onosproject</groupId>
......
......@@ -30,7 +30,11 @@
<artifactId>onos-lldp-provider</artifactId>
<packaging>bundle</packaging>
<description>ONOS LLDP Link Discovery</description>
<properties>
<onos.app.name>org.onosproject.lldpprovider</onos.app.name>
</properties>
<description>ONOS LLDP link provider</description>
<dependencies>
<dependency>
......
......@@ -27,55 +27,23 @@
</parent>
<artifactId>onos-openflow</artifactId>
<packaging>pom</packaging>
<packaging>bundle</packaging>
<description>OpenFlow protocol southbound providers</description>
<properties>
<onos.app.name>org.onosproject.openflow</onos.app.name>
<onos.app.requires>
org.onosproject.openflow-base,
org.onosproject.hostprovider,
org.onosproject.lldpprovider
</onos.app.requires>
</properties>
<description>OpenFlow southbound meta application</description>
<dependencies>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-of-api</artifactId>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-of-ctl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-drivers</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-of-provider-device</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-of-provider-packet</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-of-provider-flow</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-of-provider-group</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-lldp-provider</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-host-provider</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-of-api</artifactId>
</dependency>
</dependencies>
</project>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015 Open Networking Laboratory
~ Copyright 2014-2015 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 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<app name="org.onosproject.openflow" origin="ON.Lab" version="${project.version}"
<app name="org.onosproject.openflow-base" origin="ON.Lab" version="${project.version}"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}">
<description>${project.description}</description>
......@@ -23,8 +23,6 @@
<artifact>mvn:${project.groupId}/onos-of-ctl/${project.version}</artifact>
<artifact>mvn:${project.groupId}/onos-drivers/${project.version}</artifact>
<artifact>mvn:${project.groupId}/onos-lldp-provider/${project.version}</artifact>
<artifact>mvn:${project.groupId}/onos-host-provider/${project.version}</artifact>
<artifact>mvn:${project.groupId}/onos-of-provider-device/${project.version}</artifact>
<artifact>mvn:${project.groupId}/onos-of-provider-packet/${project.version}</artifact>
<artifact>mvn:${project.groupId}/onos-of-provider-flow/${project.version}</artifact>
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ Copyright 2015 Open Networking Laboratory
~ Copyright 2014-2015 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.
......@@ -23,8 +23,6 @@
<bundle>mvn:${project.groupId}/onos-of-api/${project.version}</bundle>
<bundle>mvn:${project.groupId}/onos-of-ctl/${project.version}</bundle>
<bundle>mvn:${project.groupId}/onos-lldp-provider/${project.version}</bundle>
<bundle>mvn:${project.groupId}/onos-host-provider/${project.version}</bundle>
<bundle>mvn:${project.groupId}/onos-of-provider-device/${project.version}</bundle>
<bundle>mvn:${project.groupId}/onos-of-provider-packet/${project.version}</bundle>
<bundle>mvn:${project.groupId}/onos-of-provider-flow/${project.version}</bundle>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2014-2015 Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-of-providers</artifactId>
<version>1.4.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>onos-openflow-base</artifactId>
<packaging>pom</packaging>
<description>OpenFlow protocol southbound providers</description>
<dependencies>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-of-api</artifactId>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-of-ctl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-drivers</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-of-provider-device</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-of-provider-packet</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-of-provider-flow</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-of-provider-group</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
......@@ -37,6 +37,7 @@
<module>flow</module>
<module>group</module>
<module>meter</module>
<module>base</module>
<module>app</module>
</modules>
......