Sketching cluster related stuff with Madan..
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
new file mode 100644
index 0000000..6737f68
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/cluster/ClusterEvent.java
@@ -0,0 +1,58 @@
+package org.onlab.onos.cluster;
+
+import org.onlab.onos.event.AbstractEvent;
+
+/**
+ * Describes cluster-related event.
+ */
+public class ClusterEvent extends AbstractEvent<ClusterEvent.Type, ControllerInstance> {
+
+ /**
+ * Type of device events.
+ */
+ public enum Type {
+ /**
+ * Signifies that a new cluster instance has been administratively added.
+ */
+ INSTANCE_ADDED,
+
+ /**
+ * Signifies that a cluster instance has been administratively removed.
+ */
+ INSTANCE_REMOVED,
+
+ /**
+ * Signifies that a cluster instance became active.
+ */
+ INSTANCE_ACTIVE,
+
+ /**
+ * Signifies that a cluster instance became inactive.
+ */
+ INSTANCE_INACTIVE
+ }
+ // TODO: do we need to fix the verv/adjective mix? discuss
+
+ /**
+ * Creates an event of a given type and for the specified instance and the
+ * current time.
+ *
+ * @param type cluster event type
+ * @param instance cluster device subject
+ */
+ public ClusterEvent(Type type, ControllerInstance instance) {
+ super(type, instance);
+ }
+
+ /**
+ * Creates an event of a given type and for the specified device and time.
+ *
+ * @param type device event type
+ * @param instance event device subject
+ * @param time occurrence time
+ */
+ public ClusterEvent(Type type, ControllerInstance 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
new file mode 100644
index 0000000..afbf0d5
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/cluster/ClusterService.java
@@ -0,0 +1,29 @@
+package org.onlab.onos.cluster;
+
+import java.util.Set;
+
+/**
+ * Service for obtaining information about the individual instances within
+ * the controller cluster.
+ */
+public interface ClusterService {
+
+ /**
+ * Returns the set of current cluster members.
+ *
+ * @return set of cluster members
+ */
+ Set<ControllerInstance> getInstances();
+
+ /**
+ * Returns the availability state of the specified controller instance.
+ *
+ * @return availability state
+ */
+ ControllerInstance.State getState(ControllerInstance instance);
+ // TODO: determine if this would be better attached to ControllerInstance directly
+
+
+ // addListener, removeListener
+
+}
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/ControllerInstance.java b/core/api/src/main/java/org/onlab/onos/cluster/ControllerInstance.java
new file mode 100644
index 0000000..66d753e
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/cluster/ControllerInstance.java
@@ -0,0 +1,38 @@
+package org.onlab.onos.cluster;
+
+import org.onlab.packet.IpAddress;
+
+/**
+ * Represents a controller instance as a member in a cluster.
+ */
+public interface ControllerInstance {
+
+ /** Represents the operational state of the instance. */
+ public enum State {
+ /**
+ * Signifies that the instance is active and operating normally.
+ */
+ ACTIVE,
+
+ /**
+ * Signifies that the instance is inactive, which means either down or
+ * up, but not operational.
+ */
+ INACTIVE
+ }
+
+ /**
+ * Returns the instance identifier.
+ *
+ * @return instance identifier
+ */
+ InstanceId id();
+
+ /**
+ * Returns the IP address of the controller instance.
+ *
+ * @return IP address
+ */
+ IpAddress ip();
+
+}
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/InstanceId.java b/core/api/src/main/java/org/onlab/onos/cluster/InstanceId.java
new file mode 100644
index 0000000..7292a85
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/cluster/InstanceId.java
@@ -0,0 +1,7 @@
+package org.onlab.onos.cluster;
+
+/**
+ * Controller cluster identity.
+ */
+public interface InstanceId {
+}
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/package-info.java b/core/api/src/main/java/org/onlab/onos/cluster/package-info.java
new file mode 100644
index 0000000..3cb37c3
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/cluster/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Set of abstractions for dealing with controller cluster related topics.
+ */
+package org.onlab.onos.cluster;
\ No newline at end of file
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleEvent.java b/core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleEvent.java
index 566c2b4..ce8e700 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleEvent.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleEvent.java
@@ -19,7 +19,7 @@
/**
* Signifies that a flow rule has been removed.
*/
- RULE_REMOVED,
+ RULE_REMOVED
}
/**
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleService.java b/core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleService.java
index 71434c7..ba75ae9 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleService.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleService.java
@@ -23,6 +23,8 @@
*/
Iterable<FlowEntry> getFlowEntries(DeviceId deviceId);
+ // TODO: add createFlowRule factory method and execute operations method
+
/**
* Applies the specified flow rules onto their respective devices. These
* flow rules will be retained by the system and re-applied anytime the
@@ -46,9 +48,6 @@
void removeFlowRules(FlowRule... flowRules);
- // void addInitialFlowContributor(InitialFlowContributor contributor);
- // void removeInitialFlowContributor(InitialFlowContributor contributor);
-
/**
* Adds the specified flow rule listener.
*