[ONOS-6756] Replicate node version information for ISSU
Change-Id: Ibd31c573990f2732b7abf8615ca914ffb77615ec
diff --git a/core/api/src/main/java/org/onosproject/cluster/ClusterService.java b/core/api/src/main/java/org/onosproject/cluster/ClusterService.java
index aa984c0..1c4e2d7 100644
--- a/core/api/src/main/java/org/onosproject/cluster/ClusterService.java
+++ b/core/api/src/main/java/org/onosproject/cluster/ClusterService.java
@@ -18,6 +18,7 @@
import java.util.Set;
import org.joda.time.DateTime;
+import org.onosproject.core.Version;
import org.onosproject.event.ListenerService;
/**
@@ -60,6 +61,14 @@
ControllerNode.State getState(NodeId nodeId);
/**
+ * Returns the version of the given controller node.
+ *
+ * @param nodeId controller node identifier
+ * @return controller version
+ */
+ Version getVersion(NodeId nodeId);
+
+ /**
* Returns the system time when the availability state was last updated.
*
* @param nodeId controller node identifier
diff --git a/core/api/src/main/java/org/onosproject/cluster/ClusterStore.java b/core/api/src/main/java/org/onosproject/cluster/ClusterStore.java
index e3660f3..a181c4f 100644
--- a/core/api/src/main/java/org/onosproject/cluster/ClusterStore.java
+++ b/core/api/src/main/java/org/onosproject/cluster/ClusterStore.java
@@ -17,6 +17,7 @@
import org.joda.time.DateTime;
import org.onlab.packet.IpAddress;
+import org.onosproject.core.Version;
import org.onosproject.store.Store;
import java.util.Set;
@@ -57,6 +58,14 @@
ControllerNode.State getState(NodeId nodeId);
/**
+ * Returns the version of the specified controller node.
+ *
+ * @param nodeId controller instance identifier
+ * @return controller version
+ */
+ Version getVersion(NodeId nodeId);
+
+ /**
* Marks the current node as fully started.
*
* @param started true indicates all components have been started
diff --git a/core/api/src/main/java/org/onosproject/core/VersionService.java b/core/api/src/main/java/org/onosproject/core/VersionService.java
new file mode 100644
index 0000000..409ffbe
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/core/VersionService.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2017-present 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.
+ */
+package org.onosproject.core;
+
+/**
+ * Node version service.
+ */
+public interface VersionService {
+
+ /**
+ * Returns the product version.
+ *
+ * @return product version
+ */
+ Version version();
+
+}
\ No newline at end of file
diff --git a/core/api/src/test/java/org/onosproject/cluster/ClusterServiceAdapter.java b/core/api/src/test/java/org/onosproject/cluster/ClusterServiceAdapter.java
index 6f7917d..3c8cd36 100644
--- a/core/api/src/test/java/org/onosproject/cluster/ClusterServiceAdapter.java
+++ b/core/api/src/test/java/org/onosproject/cluster/ClusterServiceAdapter.java
@@ -21,6 +21,7 @@
import org.onlab.packet.IpAddress;
import com.google.common.collect.ImmutableSet;
+import org.onosproject.core.Version;
/**
* Test adapter for the cluster service.
@@ -50,6 +51,11 @@
}
@Override
+ public Version getVersion(NodeId nodeId) {
+ return null;
+ }
+
+ @Override
public DateTime getLastUpdated(NodeId nodeId) {
return null;
}
diff --git a/core/api/src/test/java/org/onosproject/core/VersionServiceAdapter.java b/core/api/src/test/java/org/onosproject/core/VersionServiceAdapter.java
new file mode 100644
index 0000000..d0031c0
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/core/VersionServiceAdapter.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2017-present 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.
+ */
+package org.onosproject.core;
+
+/**
+ * Version service adapter.
+ */
+public class VersionServiceAdapter implements VersionService {
+ @Override
+ public Version version() {
+ return null;
+ }
+}