use of org.onosproject.core.Version in project onos by opennetworkinglab.
the class NodesListCommand method doExecute.
@Override
protected void doExecute() {
ClusterAdminService service = get(ClusterAdminService.class);
List<ControllerNode> nodes = newArrayList(service.getNodes());
Collections.sort(nodes, Comparators.NODE_COMPARATOR);
if (outputJson()) {
print("%s", json(service, nodes));
} else {
ControllerNode self = service.getLocalNode();
for (ControllerNode node : nodes) {
String timeAgo = service.localStatus(node.id());
Version version = service.getVersion(node.id());
print(FMT, node.id(), node.ip(), node.tcpPort(), service.getState(node.id()), version == null ? "unknown" : version, timeAgo, node.equals(self) ? "*" : "");
}
}
}
use of org.onosproject.core.Version in project onos by opennetworkinglab.
the class SummaryCommand method doExecute.
@Override
protected void doExecute() {
IpAddress nodeIp = get(ClusterService.class).getLocalNode().ip();
Version version = get(CoreService.class).version();
long numNodes = activeNodes(get(ClusterService.class).getNodes());
int numDevices = get(DeviceService.class).getDeviceCount();
int numLinks = get(LinkService.class).getLinkCount();
int numHosts = get(HostService.class).getHostCount();
int numScc = get(TopologyService.class).currentTopology().clusterCount();
int numFlows = get(FlowRuleService.class).getFlowRuleCount();
long numIntents = get(IntentService.class).getIntentCount();
String clusterId = get(ClusterMetadataService.class).getClusterMetadata().getName();
if (outputJson()) {
print("%s", new ObjectMapper().createObjectNode().put("node", nodeIp.toString()).put("version", version.toString()).put("clusterId", clusterId).put("nodes", numNodes).put("devices", numDevices).put("links", numLinks).put("hosts", numHosts).put("SCC(s)", numScc).put("flows", numFlows).put("intents", numIntents));
} else {
print("node=%s, version=%s clusterId=%s", nodeIp, version, clusterId);
print("nodes=%d, devices=%d, links=%d, hosts=%d, SCC(s)=%s, flows=%d, intents=%d", numNodes, numDevices, numLinks, numHosts, numScc, numFlows, numIntents);
}
}
use of org.onosproject.core.Version in project onos by opennetworkinglab.
the class VersionTest method testToFromInt.
@Test
public void testToFromInt() {
Version version1;
Version version2;
version1 = version("1.2");
version2 = Version.fromInt(version1.toInt());
assertEquals(version2, version(1, 2, "0", "0"));
version1 = version("1.2.foo.bar");
version2 = Version.fromInt(version1.toInt());
assertEquals(version2, version(1, 2, "0", "0"));
version1 = version("1.2.3");
version2 = Version.fromInt(version1.toInt());
assertEquals(version2, version(1, 2, "3", "0"));
version1 = version("1.2.3-SNAPSHOT");
version2 = Version.fromInt(version1.toInt());
assertEquals(version2, version(1, 2, "3", "0"));
version1 = version("255.254.253.252");
version2 = Version.fromInt(version1.toInt());
assertEquals(version2, version(255, 254, "253", "252"));
assertTrue(version("0.0.2").toInt() > version("0.0.1").toInt());
assertTrue(version("0.1.0").toInt() > version("0.0.1").toInt());
assertTrue(version("1.0.0").toInt() > version("0.1.0").toInt());
assertTrue(version("1.1.0").toInt() > version("1.0.1").toInt());
assertTrue(version("2.1.1").toInt() > version("1.10.10").toInt());
assertTrue(version("0.1.0-rc2").toInt() > version("0.1.0-rc1").toInt());
}
use of org.onosproject.core.Version in project onos by opennetworkinglab.
the class VersionTest method minimal.
@Test
public void minimal() {
Version v = version("1.4");
assertEquals("wrong major", 1, v.major());
assertEquals("wrong minor", 4, v.minor());
assertEquals("wrong patch", null, v.patch());
assertEquals("wrong build", null, v.build());
}
use of org.onosproject.core.Version in project onos by opennetworkinglab.
the class VersionTest method fromParts.
@Test
public void fromParts() {
Version v = version(1, 2, "3", "4321");
assertEquals("wrong major", 1, v.major());
assertEquals("wrong minor", 2, v.minor());
assertEquals("wrong patch", "3", v.patch());
assertEquals("wrong build", "4321", v.build());
}
Aggregations