Created onos-core-trivial as a place to put trivial implementation of core against which initial set of providers can be developed.
diff --git a/features/features.xml b/features/features.xml
index 2bd3010..765587a 100644
--- a/features/features.xml
+++ b/features/features.xml
@@ -32,7 +32,7 @@
<feature name="onos-core" version="1.0.0"
description="ONOS core components">
<feature>onos-api</feature>
- <bundle>mvn:org.onlab.onos/onos-core/1.0.0-SNAPSHOT</bundle>
+ <bundle>mvn:org.onlab.onos/onos-core-trivial/1.0.0-SNAPSHOT</bundle>
</feature>
<feature name="onos-rest" version="1.0.0"
diff --git a/net/api/src/main/java/org/onlab/onos/net/provider/AbstractProviderBroker.java b/net/api/src/main/java/org/onlab/onos/net/provider/AbstractProviderBroker.java
index a783fec..ad1e0ab 100644
--- a/net/api/src/main/java/org/onlab/onos/net/provider/AbstractProviderBroker.java
+++ b/net/api/src/main/java/org/onlab/onos/net/provider/AbstractProviderBroker.java
@@ -38,10 +38,9 @@
public synchronized void unregister(P provider) {
checkNotNull(provider, "Provider cannot be null");
S service = services.get(provider);
- checkArgument(service != null, "Provider %s not registered", provider.id());
- if (service instanceof AbstractProviderService) {
+ if (service != null && service instanceof AbstractProviderService) {
((AbstractProviderService) service).invalidate();
+ services.remove(provider);
}
- services.remove(provider);
}
}
diff --git a/net/api/src/main/java/org/onlab/onos/net/provider/ProviderBroker.java b/net/api/src/main/java/org/onlab/onos/net/provider/ProviderBroker.java
index a8e294e..438fdb7 100644
--- a/net/api/src/main/java/org/onlab/onos/net/provider/ProviderBroker.java
+++ b/net/api/src/main/java/org/onlab/onos/net/provider/ProviderBroker.java
@@ -13,6 +13,7 @@
*
* @param provider provider to be registered
* @return provider service for injecting information into core
+ * @throws java.lang.IllegalArgumentException if the provider is registered already
*/
S register(P provider);
@@ -20,6 +21,9 @@
* Unregisters the supplied provider. As a result the previously issued
* provider service will be invalidated and any subsequent invocations
* of its methods may throw {@link java.lang.IllegalStateException}.
+ * <p/>
+ * Unregistering a provider that has not been previously registered results
+ * in a no-op.
*
* @param provider provider to be unregistered
*/
diff --git a/net/core/pom.xml b/net/core/pom.xml
index 30f6e12..0ceaa17 100644
--- a/net/core/pom.xml
+++ b/net/core/pom.xml
@@ -12,10 +12,14 @@
</parent>
<artifactId>onos-core</artifactId>
- <packaging>bundle</packaging>
+ <packaging>pom</packaging>
<description>ONOS network control core subsystems</description>
+ <modules>
+ <module>trivial</module>
+ </modules>
+
<dependencies>
<dependency>
<groupId>org.onlab.onos</groupId>
diff --git a/net/core/trivial/pom.xml b/net/core/trivial/pom.xml
new file mode 100644
index 0000000..d4998ba
--- /dev/null
+++ b/net/core/trivial/pom.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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.onlab.onos</groupId>
+ <artifactId>onos-core</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>onos-core-trivial</artifactId>
+ <packaging>bundle</packaging>
+
+ <description>ONOS network control trivial implementations of core subsystems</description>
+
+</project>
diff --git a/net/core/src/main/java/org/onlab/onos/net/impl/GreetManager.java b/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/GreetManager.java
similarity index 96%
rename from net/core/src/main/java/org/onlab/onos/net/impl/GreetManager.java
rename to net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/GreetManager.java
index 65a42bc..2b01396 100644
--- a/net/core/src/main/java/org/onlab/onos/net/impl/GreetManager.java
+++ b/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/GreetManager.java
@@ -1,4 +1,4 @@
-package org.onlab.onos.net.impl;
+package org.onlab.onos.net.trivial.impl;
import com.google.common.collect.ImmutableSet;
import org.apache.felix.scr.annotations.Activate;
diff --git a/net/core/src/main/java/org/onlab/onos/net/impl/SimpleDeviceManager.java b/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceManager.java
similarity index 98%
rename from net/core/src/main/java/org/onlab/onos/net/impl/SimpleDeviceManager.java
rename to net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceManager.java
index dc18065..53d4ed9 100644
--- a/net/core/src/main/java/org/onlab/onos/net/impl/SimpleDeviceManager.java
+++ b/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceManager.java
@@ -1,4 +1,4 @@
-package org.onlab.onos.net.impl;
+package org.onlab.onos.net.trivial.impl;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
diff --git a/net/core/src/main/java/org/onlab/onos/net/impl/SomeOtherComponent.java b/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SomeOtherComponent.java
similarity index 95%
rename from net/core/src/main/java/org/onlab/onos/net/impl/SomeOtherComponent.java
rename to net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SomeOtherComponent.java
index c53ab04..e040643 100644
--- a/net/core/src/main/java/org/onlab/onos/net/impl/SomeOtherComponent.java
+++ b/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SomeOtherComponent.java
@@ -1,4 +1,4 @@
-package org.onlab.onos.net.impl;
+package org.onlab.onos.net.trivial.impl;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
diff --git a/net/core/src/main/javadoc/org/onlab/onos/net/impl/package.html b/net/core/trivial/src/main/javadoc/org/onlab/onos/net/trivial/impl/package.html
similarity index 100%
rename from net/core/src/main/javadoc/org/onlab/onos/net/impl/package.html
rename to net/core/trivial/src/main/javadoc/org/onlab/onos/net/trivial/impl/package.html
diff --git a/net/core/src/test/java/org/onlab/onos/net/impl/GreetManagerTest.java b/net/core/trivial/src/test/java/org/onlab/onos/net/trivial/impl/GreetManagerTest.java
similarity index 94%
rename from net/core/src/test/java/org/onlab/onos/net/impl/GreetManagerTest.java
rename to net/core/trivial/src/test/java/org/onlab/onos/net/trivial/impl/GreetManagerTest.java
index 9c05f20..3bbffde 100644
--- a/net/core/src/test/java/org/onlab/onos/net/impl/GreetManagerTest.java
+++ b/net/core/trivial/src/test/java/org/onlab/onos/net/trivial/impl/GreetManagerTest.java
@@ -1,4 +1,4 @@
-package org.onlab.onos.net.impl;
+package org.onlab.onos.net.trivial.impl;
import org.junit.Test;
import org.onlab.onos.net.GreetService;
diff --git a/pom.xml b/pom.xml
index 731d6fc..5abbfef 100644
--- a/pom.xml
+++ b/pom.xml
@@ -254,7 +254,7 @@
<group>
<title>Core Subsystems</title>
<packages>
- org.onlab.onos.net.impl:org.onlab.onos.net.*.impl
+ org.onlab.onos.net.trivial.impl:org.onlab.onos.net.*.impl
</packages>
</group>
<group>
diff --git a/providers/of/device/src/main/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProvider.java b/providers/of/device/src/main/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProvider.java
index 1fafca5..e601ac7 100644
--- a/providers/of/device/src/main/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProvider.java
+++ b/providers/of/device/src/main/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProvider.java
@@ -16,10 +16,10 @@
import org.slf4j.LoggerFactory;
/**
- * Device provider which uses an OpenFlow controller to detect network
+ * Provider which uses an OpenFlow controller to detect network
* infrastructure devices.
*/
-@Component
+@Component(immediate = true)
public class OpenFlowDeviceProvider extends AbstractProvider implements DeviceProvider {
private final Logger log = LoggerFactory.getLogger(OpenFlowDeviceProvider.class);
@@ -60,7 +60,7 @@
@Override
public void roleChanged(Device device, MastershipRole newRole) {
- log.info("Accepting mastership role change fordevice {}", device.id());
+ log.info("Accepting mastership role change for device {}", device.id());
}
}
diff --git a/providers/of/host/src/main/java/org/onlab/onos/provider/of/host/impl/OpenFlowHostProvider.java b/providers/of/host/src/main/java/org/onlab/onos/provider/of/host/impl/OpenFlowHostProvider.java
index 8c30c8b..ff7837a 100644
--- a/providers/of/host/src/main/java/org/onlab/onos/provider/of/host/impl/OpenFlowHostProvider.java
+++ b/providers/of/host/src/main/java/org/onlab/onos/provider/of/host/impl/OpenFlowHostProvider.java
@@ -15,10 +15,10 @@
import org.slf4j.LoggerFactory;
/**
- * Device provider which uses an OpenFlow controller to detect network
+ * Provider which uses an OpenFlow controller to detect network
* end-station hosts.
*/
-@Component
+@Component(immediate = true)
public class OpenFlowHostProvider extends AbstractProvider implements HostProvider {
private final Logger log = LoggerFactory.getLogger(OpenFlowHostProvider.class);
@@ -55,4 +55,5 @@
public void triggerProbe(Host host) {
log.info("Triggering probe on device {}", host);
}
+
}
diff --git a/providers/of/link/src/main/java/org/onlab/onos/provider/of/link/impl/OpenFlowLinkProvider.java b/providers/of/link/src/main/java/org/onlab/onos/provider/of/link/impl/OpenFlowLinkProvider.java
index 8abcaac..88b5874 100644
--- a/providers/of/link/src/main/java/org/onlab/onos/provider/of/link/impl/OpenFlowLinkProvider.java
+++ b/providers/of/link/src/main/java/org/onlab/onos/provider/of/link/impl/OpenFlowLinkProvider.java
@@ -14,10 +14,10 @@
import org.slf4j.LoggerFactory;
/**
- * Device provider which uses an OpenFlow controller to detect network
+ * Provider which uses an OpenFlow controller to detect network
* infrastructure links.
*/
-@Component
+@Component(immediate = true)
public class OpenFlowLinkProvider extends AbstractProvider implements LinkProvider {
private final Logger log = LoggerFactory.getLogger(OpenFlowLinkProvider.class);
diff --git a/web/api/pom.xml b/web/api/pom.xml
index ffb5354..11d90cc 100644
--- a/web/api/pom.xml
+++ b/web/api/pom.xml
@@ -19,7 +19,7 @@
<dependencies>
<dependency>
<groupId>org.onlab.onos</groupId>
- <artifactId>onos-core</artifactId>
+ <artifactId>onos-core-trivial</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
diff --git a/web/api/src/test/java/org/onlab/onos/rest/GreetResourceTest.java b/web/api/src/test/java/org/onlab/onos/rest/GreetResourceTest.java
index 19b566c..24b9925 100644
--- a/web/api/src/test/java/org/onlab/onos/rest/GreetResourceTest.java
+++ b/web/api/src/test/java/org/onlab/onos/rest/GreetResourceTest.java
@@ -5,7 +5,7 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.onlab.onos.net.GreetService;
-import org.onlab.onos.net.impl.GreetManager;
+import org.onlab.onos.net.trivial.impl.GreetManager;
import org.onlab.osgi.ServiceDirectory;
import org.onlab.osgi.TestServiceDirectory;