Added more trivial core implementations.
diff --git a/net/api/src/main/java/org/onlab/onos/net/host/HostProvider.java b/net/api/src/main/java/org/onlab/onos/net/host/HostProvider.java
index 04c1060..8b92883 100644
--- a/net/api/src/main/java/org/onlab/onos/net/host/HostProvider.java
+++ b/net/api/src/main/java/org/onlab/onos/net/host/HostProvider.java
@@ -14,7 +14,7 @@
* Triggers an asynchronous probe of the specified host, intended to
* determine whether the host is present or not. An indirect result of this
* should be invocation of {@link org.onlab.onos.net.host.HostProviderService#hostDetected(HostDescription)} or
- * {@link org.onlab.onos.net.host.HostProviderService#hostNotDetected(HostDescription)}
+ * {@link org.onlab.onos.net.host.HostProviderService#hostVanished(HostDescription)}
* at some later point in time.
*
* @param host host to probe
diff --git a/net/api/src/main/java/org/onlab/onos/net/host/HostProviderService.java b/net/api/src/main/java/org/onlab/onos/net/host/HostProviderService.java
index 4c4859f..76c2aad 100644
--- a/net/api/src/main/java/org/onlab/onos/net/host/HostProviderService.java
+++ b/net/api/src/main/java/org/onlab/onos/net/host/HostProviderService.java
@@ -20,6 +20,6 @@
*
* @param hostDescription description of host
*/
- void hostNotDetected(HostDescription hostDescription);
+ void hostVanished(HostDescription hostDescription);
}
diff --git a/net/api/src/main/java/org/onlab/onos/net/link/LinkProviderService.java b/net/api/src/main/java/org/onlab/onos/net/link/LinkProviderService.java
index 190ee00..7969022 100644
--- a/net/api/src/main/java/org/onlab/onos/net/link/LinkProviderService.java
+++ b/net/api/src/main/java/org/onlab/onos/net/link/LinkProviderService.java
@@ -8,17 +8,17 @@
public interface LinkProviderService extends ProviderService<LinkProvider> {
/**
- * Signals that an infrastructure link has been connected.
+ * Signals that an infrastructure link has been detected.
*
* @param linkDescription link information
*/
- void linkConnected(LinkDescription linkDescription);
+ void linkDetected(LinkDescription linkDescription);
/**
- * Signals that an infrastructure link has been disconnected.
+ * Signals that an infrastructure link has disappeared.
*
* @param linkDescription link information
*/
- void linkDisconnected(LinkDescription linkDescription);
+ void linkVanished(LinkDescription linkDescription);
}
diff --git a/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleHostManager.java b/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleHostManager.java
new file mode 100644
index 0000000..8e16877
--- /dev/null
+++ b/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleHostManager.java
@@ -0,0 +1,77 @@
+package org.onlab.onos.net.trivial.impl;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Service;
+import org.onlab.onos.net.host.HostDescription;
+import org.onlab.onos.net.host.HostProvider;
+import org.onlab.onos.net.host.HostProviderBroker;
+import org.onlab.onos.net.host.HostProviderService;
+import org.onlab.onos.net.provider.AbstractProviderBroker;
+import org.onlab.onos.net.provider.AbstractProviderService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Provides basic implementation of the host SB & NB APIs.
+ */
+@Component(immediate = true)
+@Service
+public class SimpleHostManager implements HostProviderBroker {
+
+ private Logger log = LoggerFactory.getLogger(SimpleHostManager.class);
+
+ private final HostProviderBroker broker = new InternalBroker();
+
+ @Activate
+ public void activate() {
+ log.info("Started");
+ }
+
+ @Deactivate
+ public void deactivate() {
+ log.info("Stopped");
+ }
+
+ @Override
+ public HostProviderService register(HostProvider provider) {
+ log.info("Registering provider {}", provider.id());
+ return broker.register(provider);
+ }
+
+ @Override
+ public void unregister(HostProvider provider) {
+ log.info("Unregistering provider {}", provider.id());
+ broker.unregister(provider);
+ }
+
+ // Internal delegate for tracking various providers and issuing them a
+ // personalized provider service.
+ private class InternalBroker extends AbstractProviderBroker<HostProvider, HostProviderService>
+ implements HostProviderBroker {
+ @Override
+ protected HostProviderService createProviderService(HostProvider provider) {
+ return new InternalHostProviderService(provider);
+ }
+ }
+
+ // Personalized host provider service issued to the supplied provider.
+ private class InternalHostProviderService extends AbstractProviderService<HostProvider>
+ implements HostProviderService {
+
+ public InternalHostProviderService(HostProvider provider) {
+ super(provider);
+ }
+
+ @Override
+ public void hostDetected(HostDescription hostDescription) {
+ log.info("Host {} detected", hostDescription);
+ }
+
+ @Override
+ public void hostVanished(HostDescription hostDescription) {
+ log.info("Host {} vanished", hostDescription);
+ }
+ }
+}
diff --git a/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleLinkManager.java b/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleLinkManager.java
new file mode 100644
index 0000000..1f97ef8
--- /dev/null
+++ b/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleLinkManager.java
@@ -0,0 +1,77 @@
+package org.onlab.onos.net.trivial.impl;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Service;
+import org.onlab.onos.net.link.LinkDescription;
+import org.onlab.onos.net.link.LinkProvider;
+import org.onlab.onos.net.link.LinkProviderBroker;
+import org.onlab.onos.net.link.LinkProviderService;
+import org.onlab.onos.net.provider.AbstractProviderBroker;
+import org.onlab.onos.net.provider.AbstractProviderService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Provides basic implementation of the link SB & NB APIs.
+ */
+@Component(immediate = true)
+@Service
+public class SimpleLinkManager implements LinkProviderBroker {
+
+ private Logger log = LoggerFactory.getLogger(SimpleLinkManager.class);
+
+ private final LinkProviderBroker broker = new InternalBroker();
+
+ @Activate
+ public void activate() {
+ log.info("Started");
+ }
+
+ @Deactivate
+ public void deactivate() {
+ log.info("Stopped");
+ }
+
+ @Override
+ public LinkProviderService register(LinkProvider provider) {
+ log.info("Registering provider {}", provider.id());
+ return broker.register(provider);
+ }
+
+ @Override
+ public void unregister(LinkProvider provider) {
+ log.info("Unregistering provider {}", provider.id());
+ broker.unregister(provider);
+ }
+
+ // Internal delegate for tracking various providers and issuing them a
+ // personalized provider service.
+ private class InternalBroker extends AbstractProviderBroker<LinkProvider, LinkProviderService>
+ implements LinkProviderBroker {
+ @Override
+ protected LinkProviderService createProviderService(LinkProvider provider) {
+ return new InternalLinkProviderService(provider);
+ }
+ }
+
+ // Personalized link provider service issued to the supplied provider.
+ private class InternalLinkProviderService extends AbstractProviderService<LinkProvider>
+ implements LinkProviderService {
+
+ public InternalLinkProviderService(LinkProvider provider) {
+ super(provider);
+ }
+
+ @Override
+ public void linkDetected(LinkDescription linkDescription) {
+ log.info("Link {} detected", linkDescription);
+ }
+
+ @Override
+ public void linkVanished(LinkDescription linkDescription) {
+ log.info("Link {} vanished", linkDescription);
+ }
+ }
+}