Renamed *Instance to *Node for better readability and to avoid conflict with notion of Karaf instance.
Added cluster service and trivial store implementations.
diff --git a/cli/src/main/java/org/onlab/onos/cli/NodesListCommand.java b/cli/src/main/java/org/onlab/onos/cli/NodesListCommand.java
new file mode 100644
index 0000000..1057d6e
--- /dev/null
+++ b/cli/src/main/java/org/onlab/onos/cli/NodesListCommand.java
@@ -0,0 +1,45 @@
+package org.onlab.onos.cli;
+
+import org.apache.karaf.shell.commands.Command;
+import org.onlab.onos.cluster.ClusterService;
+import org.onlab.onos.cluster.ControllerNode;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import static com.google.common.collect.Lists.newArrayList;
+
+/**
+ * Lists all controller cluster nodes.
+ */
+@Command(scope = "onos", name = "nodes",
+ description = "Lists all controller cluster nodes")
+public class NodesListCommand extends AbstractShellCommand {
+
+ private static final String FMT =
+ "id=%s, ip=%s, state=%s %s";
+
+ protected static final Comparator<ControllerNode> ID_COMPARATOR =
+ new Comparator<ControllerNode>() {
+ @Override
+ public int compare(ControllerNode ci1, ControllerNode ci2) {
+ return ci1.id().toString().compareTo(ci2.id().toString());
+ }
+ };
+
+ @Override
+ protected Object doExecute() throws Exception {
+ ClusterService service = getService(ClusterService.class);
+ List<ControllerNode> nodes = newArrayList(service.getNodes());
+ Collections.sort(nodes, ID_COMPARATOR);
+ ControllerNode self = service.getLocalNode();
+ for (ControllerNode node : nodes) {
+ print(FMT, node.id(), node.ip(),
+ service.getState(node.id()),
+ node.equals(self) ? "*" : "");
+ }
+ return null;
+ }
+
+}
diff --git a/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
index 9d8259e..419ed16 100644
--- a/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -2,6 +2,9 @@
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command>
+ <action class="org.onlab.onos.cli.NodesListCommand"/>
+ </command>
+ <command>
<action class="org.onlab.onos.cli.net.FlowsListCommand"/>
</command>
<command>
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/ClusterEvent.java b/core/api/src/main/java/org/onlab/onos/cluster/ClusterEvent.java
index 300a143..a47c43f 100644
--- a/core/api/src/main/java/org/onlab/onos/cluster/ClusterEvent.java
+++ b/core/api/src/main/java/org/onlab/onos/cluster/ClusterEvent.java
@@ -5,7 +5,7 @@
/**
* Describes cluster-related event.
*/
-public class ClusterEvent extends AbstractEvent<ClusterEvent.Type, ControllerInstance> {
+public class ClusterEvent extends AbstractEvent<ClusterEvent.Type, ControllerNode> {
/**
* Type of cluster-related events.
@@ -39,7 +39,7 @@
* @param type cluster event type
* @param instance cluster device subject
*/
- public ClusterEvent(Type type, ControllerInstance instance) {
+ public ClusterEvent(Type type, ControllerNode instance) {
super(type, instance);
}
@@ -50,7 +50,7 @@
* @param instance event device subject
* @param time occurrence time
*/
- public ClusterEvent(Type type, ControllerInstance instance, long time) {
+ public ClusterEvent(Type type, ControllerNode instance, long time) {
super(type, instance, time);
}
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/ClusterService.java b/core/api/src/main/java/org/onlab/onos/cluster/ClusterService.java
index 017ccd2..9c0af8f 100644
--- a/core/api/src/main/java/org/onlab/onos/cluster/ClusterService.java
+++ b/core/api/src/main/java/org/onlab/onos/cluster/ClusterService.java
@@ -3,24 +3,40 @@
import java.util.Set;
/**
- * Service for obtaining information about the individual instances within
+ * Service for obtaining information about the individual nodes within
* the controller cluster.
*/
public interface ClusterService {
/**
+ * Returns the local controller node.
+ *
+ * @return local controller node
+ */
+ ControllerNode getLocalNode();
+
+ /**
* Returns the set of current cluster members.
*
* @return set of cluster members
*/
- Set<ControllerInstance> getInstances();
+ Set<ControllerNode> getNodes();
/**
- * Returns the availability state of the specified controller instance.
+ * Returns the specified controller node.
*
+ * @param nodeId controller node identifier
+ * @return controller node
+ */
+ ControllerNode getNode(NodeId nodeId);
+
+ /**
+ * Returns the availability state of the specified controller node.
+ *
+ * @param nodeId controller node identifier
* @return availability state
*/
- ControllerInstance.State getState(ControllerInstance instance);
+ ControllerNode.State getState(NodeId nodeId);
/**
* Adds the specified cluster event listener.
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/ClusterStore.java b/core/api/src/main/java/org/onlab/onos/cluster/ClusterStore.java
new file mode 100644
index 0000000..7d4b71f
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/cluster/ClusterStore.java
@@ -0,0 +1,40 @@
+package org.onlab.onos.cluster;
+
+import java.util.Set;
+
+/**
+ * Manages inventory of controller cluster nodes; not intended for direct use.
+ */
+public interface ClusterStore {
+
+ /**
+ * Returns the local controller instance.
+ *
+ * @return local controller instance
+ */
+ ControllerNode getLocalNode();
+
+ /**
+ * Returns the set of current cluster members.
+ *
+ * @return set of cluster members
+ */
+ Set<ControllerNode> getNodes();
+
+ /**
+ * Returns the specified controller instance.
+ *
+ * @param nodeId controller instance identifier
+ * @return controller instance
+ */
+ ControllerNode getNode(NodeId nodeId);
+
+ /**
+ * Returns the availability state of the specified controller instance.
+ *
+ * @param nodeId controller instance identifier
+ * @return availability state
+ */
+ ControllerNode.State getState(NodeId nodeId);
+
+}
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/ControllerInstance.java b/core/api/src/main/java/org/onlab/onos/cluster/ControllerNode.java
similarity index 92%
rename from core/api/src/main/java/org/onlab/onos/cluster/ControllerInstance.java
rename to core/api/src/main/java/org/onlab/onos/cluster/ControllerNode.java
index 9255175..c6f0cb3 100644
--- a/core/api/src/main/java/org/onlab/onos/cluster/ControllerInstance.java
+++ b/core/api/src/main/java/org/onlab/onos/cluster/ControllerNode.java
@@ -5,7 +5,7 @@
/**
* Represents a controller instance as a member in a cluster.
*/
-public interface ControllerInstance {
+public interface ControllerNode {
/** Represents the operational state of the instance. */
public enum State {
@@ -26,7 +26,7 @@
*
* @return instance identifier
*/
- InstanceId id();
+ NodeId id();
/**
* Returns the IP address of the controller instance.
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/DefaultControllerNode.java b/core/api/src/main/java/org/onlab/onos/cluster/DefaultControllerNode.java
new file mode 100644
index 0000000..9735fdb
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/cluster/DefaultControllerNode.java
@@ -0,0 +1,60 @@
+package org.onlab.onos.cluster;
+
+import org.onlab.packet.IpPrefix;
+
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Default implementation of a controller instance descriptor.
+ */
+public class DefaultControllerNode implements ControllerNode {
+
+ private final NodeId id;
+ private final IpPrefix ip;
+
+ /**
+ * Creates a new instance with the specified id and IP address.
+ *
+ * @param id instance identifier
+ * @param ip instance IP address
+ */
+ public DefaultControllerNode(NodeId id, IpPrefix ip) {
+ this.id = id;
+ this.ip = ip;
+ }
+
+ @Override
+ public NodeId id() {
+ return id;
+ }
+
+ @Override
+ public IpPrefix ip() {
+ return ip;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o instanceof DefaultControllerNode) {
+ DefaultControllerNode that = (DefaultControllerNode) o;
+ return Objects.equals(this.id, that.id);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("id", id).add("ip", ip).toString();
+ }
+
+}
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/MastershipAdminService.java b/core/api/src/main/java/org/onlab/onos/cluster/MastershipAdminService.java
index 6c58020..907b3f8 100644
--- a/core/api/src/main/java/org/onlab/onos/cluster/MastershipAdminService.java
+++ b/core/api/src/main/java/org/onlab/onos/cluster/MastershipAdminService.java
@@ -15,6 +15,6 @@
* @param deviceId device identifier
* @param role requested role
*/
- void setRole(InstanceId instance, DeviceId deviceId, MastershipRole role);
+ void setRole(NodeId instance, DeviceId deviceId, MastershipRole role);
}
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/MastershipEvent.java b/core/api/src/main/java/org/onlab/onos/cluster/MastershipEvent.java
index a835449..2a5e62e 100644
--- a/core/api/src/main/java/org/onlab/onos/cluster/MastershipEvent.java
+++ b/core/api/src/main/java/org/onlab/onos/cluster/MastershipEvent.java
@@ -8,7 +8,7 @@
*/
public class MastershipEvent extends AbstractEvent<MastershipEvent.Type, DeviceId> {
- InstanceId master;
+ NodeId master;
/**
* Type of mastership events.
@@ -28,7 +28,7 @@
* @param device event device subject
* @param master master ID subject
*/
- protected MastershipEvent(Type type, DeviceId device, InstanceId master) {
+ protected MastershipEvent(Type type, DeviceId device, NodeId master) {
super(type, device);
this.master = master;
}
@@ -42,7 +42,7 @@
* @param master master ID subject
* @param time occurrence time
*/
- protected MastershipEvent(Type type, DeviceId device, InstanceId master, long time) {
+ protected MastershipEvent(Type type, DeviceId device, NodeId master, long time) {
super(type, device, time);
this.master = master;
}
@@ -52,7 +52,7 @@
*
* @return master ID subject
*/
- public InstanceId master() {
+ public NodeId master() {
return master;
}
}
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/MastershipService.java b/core/api/src/main/java/org/onlab/onos/cluster/MastershipService.java
index bc5f19c..6a9b60e 100644
--- a/core/api/src/main/java/org/onlab/onos/cluster/MastershipService.java
+++ b/core/api/src/main/java/org/onlab/onos/cluster/MastershipService.java
@@ -19,15 +19,15 @@
* @param deviceId the identifier of the device
* @return the ID of the master controller for the device
*/
- InstanceId getMasterFor(DeviceId deviceId);
+ NodeId getMasterFor(DeviceId deviceId);
/**
* Returns the devices for which a controller is master.
*
- * @param instanceId the ID of the controller
+ * @param nodeId the ID of the controller
* @return a set of device IDs
*/
- Set<DeviceId> getDevicesOf(InstanceId instanceId);
+ Set<DeviceId> getDevicesOf(NodeId nodeId);
/**
* Returns the mastership status of this controller for a given device.
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/MastershipStore.java b/core/api/src/main/java/org/onlab/onos/cluster/MastershipStore.java
index 67eeff5..728e77d 100644
--- a/core/api/src/main/java/org/onlab/onos/cluster/MastershipStore.java
+++ b/core/api/src/main/java/org/onlab/onos/cluster/MastershipStore.java
@@ -6,11 +6,12 @@
import org.onlab.onos.net.MastershipRole;
/**
- * Manages inventory of mastership roles for devices, across controller instances.
+ * Manages inventory of mastership roles for devices, across controller
+ * instances; not intended for direct use.
*/
public interface MastershipStore {
- // three things to map: InstanceId, DeviceId, MastershipRole
+ // three things to map: NodeId, DeviceId, MastershipRole
/**
* Sets a device's role for a specified controller instance.
@@ -20,7 +21,7 @@
* @param role new role
* @return a mastership event
*/
- MastershipEvent setRole(InstanceId instance, DeviceId deviceId,
+ MastershipEvent setRole(NodeId instance, DeviceId deviceId,
MastershipRole role);
/**
@@ -31,7 +32,7 @@
* @param role new role
* @return a mastership event
*/
- MastershipEvent addOrUpdateDevice(InstanceId instance, DeviceId deviceId,
+ MastershipEvent addOrUpdateDevice(NodeId instance, DeviceId deviceId,
MastershipRole role);
/**
@@ -40,22 +41,22 @@
* @param deviceId the device identifier
* @return the instance identifier of the master
*/
- InstanceId getMaster(DeviceId deviceId);
+ NodeId getMaster(DeviceId deviceId);
/**
* Returns the devices that a controller instance is master of.
*
- * @param instanceId the instance identifier
+ * @param nodeId the instance identifier
* @return a set of device identifiers
*/
- Set<DeviceId> getDevices(InstanceId instanceId);
+ Set<DeviceId> getDevices(NodeId nodeId);
/**
* Returns the role of a device for a specific controller instance.
*
- * @param instanceId the instance identifier
+ * @param nodeId the instance identifier
* @param deviceId the device identifiers
* @return the role
*/
- MastershipRole getRole(InstanceId instanceId, DeviceId deviceId);
+ MastershipRole getRole(NodeId nodeId, DeviceId deviceId);
}
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/InstanceId.java b/core/api/src/main/java/org/onlab/onos/cluster/NodeId.java
similarity index 62%
rename from core/api/src/main/java/org/onlab/onos/cluster/InstanceId.java
rename to core/api/src/main/java/org/onlab/onos/cluster/NodeId.java
index 14f1eda..2430d52 100644
--- a/core/api/src/main/java/org/onlab/onos/cluster/InstanceId.java
+++ b/core/api/src/main/java/org/onlab/onos/cluster/NodeId.java
@@ -2,26 +2,24 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Controller cluster identity.
*/
-public class InstanceId {
+public class NodeId {
private final String id;
// Default constructor for serialization
- protected InstanceId() {
+ protected NodeId() {
id = null;
}
/**
- * Creates a new cluster instance identifier from the specified string.
+ * Creates a new cluster node identifier from the specified string.
*
* @param id string identifier
*/
- public InstanceId(String id) {
+ public NodeId(String id) {
this.id = id;
}
@@ -35,8 +33,8 @@
if (this == obj) {
return true;
}
- if (obj instanceof InstanceId) {
- final InstanceId other = (InstanceId) obj;
+ if (obj instanceof NodeId) {
+ final NodeId other = (NodeId) obj;
return Objects.equals(this.id, other.id);
}
return false;
@@ -44,7 +42,7 @@
@Override
public String toString() {
- return toStringHelper(this).add("id", id).toString();
+ return id;
}
}
diff --git a/core/api/src/main/java/org/onlab/onos/net/device/DeviceStore.java b/core/api/src/main/java/org/onlab/onos/net/device/DeviceStore.java
index 851fbc1..3ed477b 100644
--- a/core/api/src/main/java/org/onlab/onos/net/device/DeviceStore.java
+++ b/core/api/src/main/java/org/onlab/onos/net/device/DeviceStore.java
@@ -10,7 +10,7 @@
import java.util.List;
/**
- * Manages inventory of infrastructure devices.
+ * Manages inventory of infrastructure devices; not intended for direct use.
*/
public interface DeviceStore {
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleStore.java b/core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleStore.java
index 0698721..f00b595 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleStore.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleStore.java
@@ -3,7 +3,7 @@
import org.onlab.onos.net.DeviceId;
/**
- * Manages inventory of flow rules.
+ * Manages inventory of flow rules; not intended for direct use.
*/
public interface FlowRuleStore {
diff --git a/core/api/src/main/java/org/onlab/onos/net/host/HostStore.java b/core/api/src/main/java/org/onlab/onos/net/host/HostStore.java
index 94c4585..ea316b2 100644
--- a/core/api/src/main/java/org/onlab/onos/net/host/HostStore.java
+++ b/core/api/src/main/java/org/onlab/onos/net/host/HostStore.java
@@ -12,8 +12,7 @@
import java.util.Set;
/**
- * Manages inventory of end-station hosts. It may do so using whatever
- * means are appropriate.
+ * Manages inventory of end-station hosts; not intended for direct use.
*/
public interface HostStore {
diff --git a/core/api/src/main/java/org/onlab/onos/net/link/LinkStore.java b/core/api/src/main/java/org/onlab/onos/net/link/LinkStore.java
index 4391471..dbe4877 100644
--- a/core/api/src/main/java/org/onlab/onos/net/link/LinkStore.java
+++ b/core/api/src/main/java/org/onlab/onos/net/link/LinkStore.java
@@ -8,8 +8,7 @@
import java.util.Set;
/**
- * Manages inventory of infrastructure links. It may do so using whatever
- * means are appropriate.
+ * Manages inventory of infrastructure links; not intended for direct use.
*/
public interface LinkStore {
diff --git a/core/api/src/main/java/org/onlab/onos/net/topology/TopologyStore.java b/core/api/src/main/java/org/onlab/onos/net/topology/TopologyStore.java
index 5e8b19d..adc6145 100644
--- a/core/api/src/main/java/org/onlab/onos/net/topology/TopologyStore.java
+++ b/core/api/src/main/java/org/onlab/onos/net/topology/TopologyStore.java
@@ -11,8 +11,7 @@
import java.util.Set;
/**
- * Manages inventory of topology snapshots. It may do so using whatever
- * means appropriate.
+ * Manages inventory of topology snapshots; not intended for direct use.
*/
public interface TopologyStore {
diff --git a/core/net/src/main/java/org/onlab/onos/cluster/impl/ClusterManager.java b/core/net/src/main/java/org/onlab/onos/cluster/impl/ClusterManager.java
new file mode 100644
index 0000000..43d743c
--- /dev/null
+++ b/core/net/src/main/java/org/onlab/onos/cluster/impl/ClusterManager.java
@@ -0,0 +1,86 @@
+package org.onlab.onos.cluster.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.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.onlab.onos.cluster.ClusterEvent;
+import org.onlab.onos.cluster.ClusterEventListener;
+import org.onlab.onos.cluster.ClusterService;
+import org.onlab.onos.cluster.ClusterStore;
+import org.onlab.onos.cluster.ControllerNode;
+import org.onlab.onos.cluster.NodeId;
+import org.onlab.onos.event.AbstractListenerRegistry;
+import org.onlab.onos.event.EventDeliveryService;
+import org.slf4j.Logger;
+
+import java.util.Set;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Implementation of the cluster service.
+ */
+@Component(immediate = true)
+@Service
+public class ClusterManager implements ClusterService {
+
+ public static final String INSTANCE_ID_NULL = "Instance ID cannot be null";
+ private final Logger log = getLogger(getClass());
+
+ protected final AbstractListenerRegistry<ClusterEvent, ClusterEventListener>
+ listenerRegistry = new AbstractListenerRegistry<>();
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected ClusterStore store;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected EventDeliveryService eventDispatcher;
+
+ @Activate
+ public void activate() {
+ eventDispatcher.addSink(ClusterEvent.class, listenerRegistry);
+ log.info("Started");
+ }
+
+ @Deactivate
+ public void deactivate() {
+ eventDispatcher.removeSink(ClusterEvent.class);
+ log.info("Stopped");
+ }
+
+ @Override
+ public ControllerNode getLocalNode() {
+ return store.getLocalNode();
+ }
+
+ @Override
+ public Set<ControllerNode> getNodes() {
+ return store.getNodes();
+ }
+
+ @Override
+ public ControllerNode getNode(NodeId nodeId) {
+ checkNotNull(nodeId, INSTANCE_ID_NULL);
+ return store.getNode(nodeId);
+ }
+
+ @Override
+ public ControllerNode.State getState(NodeId nodeId) {
+ checkNotNull(nodeId, INSTANCE_ID_NULL);
+ return store.getState(nodeId);
+ }
+
+ @Override
+ public void addListener(ClusterEventListener listener) {
+ listenerRegistry.addListener(listener);
+ }
+
+ @Override
+ public void removeListener(ClusterEventListener listener) {
+ listenerRegistry.removeListener(listener);
+ }
+}
diff --git a/core/net/src/main/java/org/onlab/onos/net/device/impl/DeviceManager.java b/core/net/src/main/java/org/onlab/onos/net/device/impl/DeviceManager.java
index 5964c08..8dcba64 100644
--- a/core/net/src/main/java/org/onlab/onos/net/device/impl/DeviceManager.java
+++ b/core/net/src/main/java/org/onlab/onos/net/device/impl/DeviceManager.java
@@ -33,7 +33,7 @@
import static org.slf4j.LoggerFactory.getLogger;
/**
- * Provides basic implementation of the device SB & NB APIs.
+ * Provides implementation of the device SB & NB APIs.
*/
@Component(immediate = true)
@Service
diff --git a/core/net/src/main/java/org/onlab/onos/net/flow/impl/FlowRuleManager.java b/core/net/src/main/java/org/onlab/onos/net/flow/impl/FlowRuleManager.java
index 51ea328..7b11798 100644
--- a/core/net/src/main/java/org/onlab/onos/net/flow/impl/FlowRuleManager.java
+++ b/core/net/src/main/java/org/onlab/onos/net/flow/impl/FlowRuleManager.java
@@ -33,6 +33,9 @@
import com.google.common.collect.Lists;
+/**
+ * Provides implementation of the flow NB & SB APIs.
+ */
@Component(immediate = true)
@Service
public class FlowRuleManager
diff --git a/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleClusterStore.java b/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleClusterStore.java
new file mode 100644
index 0000000..782b389
--- /dev/null
+++ b/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleClusterStore.java
@@ -0,0 +1,65 @@
+package org.onlab.onos.net.trivial.impl;
+
+import com.google.common.collect.ImmutableSet;
+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.cluster.ClusterStore;
+import org.onlab.onos.cluster.ControllerNode;
+import org.onlab.onos.cluster.DefaultControllerNode;
+import org.onlab.onos.cluster.NodeId;
+import org.onlab.packet.IpPrefix;
+import org.slf4j.Logger;
+
+import java.util.Set;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Manages inventory of infrastructure DEVICES using trivial in-memory
+ * structures implementation.
+ */
+@Component(immediate = true)
+@Service
+public class SimpleClusterStore implements ClusterStore {
+
+ public static final IpPrefix LOCALHOST = IpPrefix.valueOf("127.0.0.1");
+
+ private final Logger log = getLogger(getClass());
+
+ private ControllerNode instance;
+
+ @Activate
+ public void activate() {
+ instance = new DefaultControllerNode(new NodeId("local"), LOCALHOST);
+ log.info("Started");
+ }
+
+ @Deactivate
+ public void deactivate() {
+ log.info("Stopped");
+ }
+
+
+ @Override
+ public ControllerNode getLocalNode() {
+ return instance;
+ }
+
+ @Override
+ public Set<ControllerNode> getNodes() {
+ return ImmutableSet.of(instance);
+ }
+
+ @Override
+ public ControllerNode getNode(NodeId nodeId) {
+ return instance.id().equals(nodeId) ? instance : null;
+ }
+
+ @Override
+ public ControllerNode.State getState(NodeId nodeId) {
+ return ControllerNode.State.ACTIVE;
+ }
+
+}
diff --git a/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceStore.java b/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceStore.java
index 5441c6d..8e42ffb 100644
--- a/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceStore.java
+++ b/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceStore.java
@@ -35,7 +35,7 @@
import static org.slf4j.LoggerFactory.getLogger;
/**
- * Manages inventory of infrastructure DEVICES using trivial in-memory
+ * Manages inventory of infrastructure devices using trivial in-memory
* structures implementation.
*/
@Component(immediate = true)
diff --git a/pom.xml b/pom.xml
index 0e51910..55a267e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -392,7 +392,7 @@
<group>
<title>Core Subsystems</title>
<packages>
- org.onlab.onos.net.device.impl:org.onlab.onos.net.link.impl:org.onlab.onos.net.host.impl:org.onlab.onos.net.topology.impl:org.onlab.onos.net.packet.impl:org.onlab.onos.net.flow.impl:org.onlab.onos.net.trivial.*:org.onlab.onos.net.*.impl:org.onlab.onos.impl:org.onlab.onos.event.impl:org.onlab.onos.store.*
+ org.onlab.onos.net.device.impl:org.onlab.onos.net.link.impl:org.onlab.onos.net.host.impl:org.onlab.onos.net.topology.impl:org.onlab.onos.net.packet.impl:org.onlab.onos.net.flow.impl:org.onlab.onos.net.trivial.*:org.onlab.onos.net.*.impl:org.onlab.onos.cluster:org.onlab.onos.event.impl:org.onlab.onos.store.*
</packages>
</group>
<group>
diff --git a/tools/build/onos-package b/tools/build/onos-package
index dca278d..03ebce6 100755
--- a/tools/build/onos-package
+++ b/tools/build/onos-package
@@ -34,15 +34,15 @@
mkdir -p $KARAF_DIST/system/org/onlab
cp -r $M2_REPO/org/onlab $KARAF_DIST/system/org/
-# Wrapper & Cellar Patching ----------------------------------------------------
+# Cellar Patching --------------------------------------------------------------
# Patch the Apache Karaf distribution file to add Cellar features repository
-perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.apache.karaf.cellar/apache-karaf-cellar/3.0.0/xml/features|" \
- $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
+#perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.apache.karaf.cellar/apache-karaf-cellar/3.0.0/xml/features|" \
+# $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
# Patch the Apache Karaf distribution file to load ONOS features
-perl -pi.old -e 's|^(featuresBoot=.*)|\1,cellar|' \
- $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
+#perl -pi.old -e 's|^(featuresBoot=.*)|\1,cellar|' \
+# $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
# ONOS Patching ----------------------------------------------------------------
@@ -50,6 +50,10 @@
perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.onlab.onos/onos-features/$ONOS_VERSION/xml/features|" \
$ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
+# Patch the Apache Karaf distribution file to load ONOS features
+perl -pi.old -e 's|^(featuresBoot=.*)|\1,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow,onos-app-tvue,onos-app-fwd|' \
+ $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
+
# Patch the Apache Karaf distribution with ONOS branding bundle
cp $M2_REPO/org/onlab/onos/onos-branding/$ONOS_VERSION/onos-branding-*.jar \
$ONOS_STAGE/$KARAF_DIST/lib