use of org.onosproject.k8snode.api.K8sNodeService in project onos by opennetworkinglab.
the class K8sHostnameCompleter method complete.
@Override
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
StringsCompleter delegate = new StringsCompleter();
K8sNodeService nodeService = get(K8sNodeService.class);
Set<String> hostnames = nodeService.nodes().stream().map(K8sNode::hostname).collect(Collectors.toSet());
SortedSet<String> strings = delegate.getStrings();
strings.addAll(hostnames);
return delegate.complete(session, commandLine, candidates);
}
use of org.onosproject.k8snode.api.K8sNodeService in project onos by opennetworkinglab.
the class K8sNodeCheckCommand method doExecute.
@Override
protected void doExecute() {
K8sNodeService nodeService = get(K8sNodeService.class);
DeviceService deviceService = get(DeviceService.class);
K8sNode node = nodeService.node(hostname);
if (node == null) {
print("Cannot find %s from registered nodes", hostname);
return;
}
print("[Integration Bridge Status]");
Device intgBridge = deviceService.getDevice(node.intgBridge());
if (intgBridge != null) {
print("%s %s=%s available=%s %s", deviceService.isAvailable(intgBridge.id()) ? MSG_OK : MSG_ERROR, node.intgBridgeName(), intgBridge.id(), deviceService.isAvailable(intgBridge.id()), intgBridge.annotations());
printPortState(deviceService, node.intgBridge(), node.intgBridgePortName());
printPortState(deviceService, node.intgBridge(), node.intgToExtPatchPortName());
printPortState(deviceService, node.intgBridge(), node.intgToLocalPatchPortName());
} else {
print("%s %s=%s is not available", MSG_ERROR, node.intgBridgeName(), node.intgBridge());
}
print("");
print("[External Bridge Status]");
Device extBridge = deviceService.getDevice(node.extBridge());
if (extBridge != null) {
print("%s %s=%s available=%s %s", deviceService.isAvailable(extBridge.id()) ? MSG_OK : MSG_ERROR, node.extBridgeName(), extBridge.id(), deviceService.isAvailable(extBridge.id()), extBridge.annotations());
printPortState(deviceService, node.extBridge(), node.extToIntgPatchPortName());
} else {
print("%s %s=%s is not available", MSG_ERROR, node.extBridgeName(), node.extBridge());
}
print("");
print("[Local Bridge Status]");
Device localBridge = deviceService.getDevice(node.localBridge());
if (localBridge != null) {
print("%s %s=%s available=%s %s", deviceService.isAvailable(localBridge.id()) ? MSG_OK : MSG_ERROR, node.localBridgeName(), localBridge.id(), deviceService.isAvailable(localBridge.id()), localBridge.annotations());
printPortState(deviceService, node.localBridge(), node.localToIntgPatchPortName());
}
print("");
print("[Tunnel Bridge Status]");
Device tunBridge = deviceService.getDevice(node.tunBridge());
if (tunBridge != null) {
print("%s %s=%s available=%s %s", deviceService.isAvailable(tunBridge.id()) ? MSG_OK : MSG_ERROR, node.tunBridgeName(), tunBridge.id(), deviceService.isAvailable(tunBridge.id()), tunBridge.annotations());
printPortState(deviceService, node.tunBridge(), node.tunToIntgPatchPortName());
if (node.dataIp() != null) {
printPortState(deviceService, node.tunBridge(), node.vxlanPortName());
printPortState(deviceService, node.tunBridge(), node.grePortName());
printPortState(deviceService, node.tunBridge(), node.genevePortName());
}
}
}
Aggregations