[ONOS-6756] Replicate node version information for ISSU
Change-Id: Ibd31c573990f2732b7abf8615ca914ffb77615ec
diff --git a/core/net/src/main/java/org/onosproject/core/impl/CoreManager.java b/core/net/src/main/java/org/onosproject/core/impl/CoreManager.java
index cda738f..4ff6eb0 100644
--- a/core/net/src/main/java/org/onosproject/core/impl/CoreManager.java
+++ b/core/net/src/main/java/org/onosproject/core/impl/CoreManager.java
@@ -35,18 +35,13 @@
import org.onosproject.core.IdBlockStore;
import org.onosproject.core.IdGenerator;
import org.onosproject.core.Version;
+import org.onosproject.core.VersionService;
import org.onosproject.event.EventDeliveryService;
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.Dictionary;
-import java.util.List;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -54,7 +49,6 @@
import static org.onosproject.security.AppPermission.Type.APP_READ;
import static org.onosproject.security.AppPermission.Type.APP_WRITE;
-
/**
* Core service implementation.
*/
@@ -64,8 +58,8 @@
private final Logger log = LoggerFactory.getLogger(getClass());
- private static final File VERSION_FILE = new File("../VERSION");
- private static Version version = Version.version("1.11.0-SNAPSHOT");
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected VersionService versionService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected ApplicationIdStore applicationIdStore;
@@ -105,16 +99,6 @@
protected void activate() {
registerApplication(CORE_APP_NAME);
cfgService.registerProperties(getClass());
- try {
- Path path = Paths.get(VERSION_FILE.getPath());
- List<String> versionLines = Files.readAllLines(path);
- if (versionLines != null && !versionLines.isEmpty()) {
- version = Version.version(versionLines.get(0));
- }
- } catch (IOException e) {
- // version file not found, using default
- log.trace("Version file not found", e);
- }
}
@Deactivate
@@ -127,7 +111,7 @@
@Override
public Version version() {
checkPermission(APP_READ);
- return version;
+ return versionService.version();
}
@Override
@@ -148,7 +132,6 @@
return applicationIdStore.getAppId(name);
}
-
@Override
public ApplicationId registerApplication(String name) {
checkPermission(APP_WRITE);
@@ -171,7 +154,6 @@
return new BlockAllocatorBasedIdGenerator(allocator);
}
-
@Modified
protected void modified(ComponentContext context) {
Dictionary<?, ?> properties = context.getProperties();