[AETHER-76] Complete T3 offline mode
- For the performance improvement, T3 offline mode uses snapshots of the network states
called Network Information Base (NIB) instead of runtime interactions with ONOS core
during troubleshooting a Trellis system.
- Enables NIB to be manually filled with the followings via T3-load commands.
- Static dump files of onos-diagnostics (t3-load-file).
- Returns of API calls to live ONOS stores (t3-load-snapshot).
- Enables NIB to be auto-filled with live ONOS stores.
- When T3-execution commands (e.g. pingall) found NIB is invalid.
- Partially tested with some mininet topos for Trellis
(https://github.com/opennetworkinglab/routing/tree/master/trellis).
- Usage instruction docs (https://docs.trellisfabric.org/troubleshooting.html).
Change-Id: I2bb546bdde454a034338cd896388fa0b37d868be
(cherry picked from commit c3803e7fad5fb28ecf3e83253f183a34936be4a0)
diff --git a/apps/t3/app/src/main/java/org/onosproject/t3/cli/TroubleshootPingAllCommand.java b/apps/t3/app/src/main/java/org/onosproject/t3/cli/TroubleshootPingAllCommand.java
index 3e7003f..e61a533 100644
--- a/apps/t3/app/src/main/java/org/onosproject/t3/cli/TroubleshootPingAllCommand.java
+++ b/apps/t3/app/src/main/java/org/onosproject/t3/cli/TroubleshootPingAllCommand.java
@@ -69,9 +69,18 @@
@Override
protected void doExecute() {
TroubleshootService service = get(TroubleshootService.class);
- if (service.checkNibsUnavailable()) {
- print(TroubleshootLoadFileCommand.ERROR_NULL);
- return;
+ if (!service.checkNibValidity()) {
+ // if the NIB is found invalid, fill it with the current network states so that this command can proceed
+ print(T3CliUtils.NIB_AUTOFILLED);
+ TroubleshootLoadSnapshotCommand cmd = new TroubleshootLoadSnapshotCommand();
+ cmd.doExecute();
+ if (!service.checkNibValidity()) {
+ // if the NIB is still invalid even after auto-filled snapshots, stop and warn
+ print(T3CliUtils.NIB_TERMINATE);
+ return;
+ }
+ } else {
+ print(service.printNibSummary());
}
EtherType type = EtherType.valueOf(ethType.toUpperCase());