Updates to the SDN-IP CLI:
* Added command options to show summary of the routes:
- "onos:routes -s" or "onos:routes --summary"
shows summary of the SDN-IP routes
- "onos:bgp-routes -s" or "onos:bgp-routes --summary"
shows summary of the BGP routes
* Implemented displaying JSON output for the "onos:routes" and
"onos:bgp-routes" commands (and the routes summary)
Also, added static methods BgpConstants.Update.AsPath.typeToString()
and BgpConstants.Update.Origin.typeToString() to return the
BGP AS_PATH type and BGP UPDATE ORIGIN type as a string.
Change-Id: I505c55a924721838bbbaf4ffccc30ffd61e90120
diff --git a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/bgp/BgpConstants.java b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/bgp/BgpConstants.java
index 92f4f07..596720c 100644
--- a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/bgp/BgpConstants.java
+++ b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/bgp/BgpConstants.java
@@ -119,6 +119,31 @@
/** BGP UPDATE ORIGIN: INCOMPLETE. */
public static final int INCOMPLETE = 2;
+
+ /**
+ * Gets the BGP UPDATE origin type as a string.
+ *
+ * @param type the BGP UPDATE origin type
+ * @return the BGP UPDATE origin type as a string
+ */
+ public static String typeToString(int type) {
+ String typeString = "UNKNOWN";
+
+ switch (type) {
+ case IGP:
+ typeString = "IGP";
+ break;
+ case EGP:
+ typeString = "EGP";
+ break;
+ case INCOMPLETE:
+ typeString = "INCOMPLETE";
+ break;
+ default:
+ break;
+ }
+ return typeString;
+ }
}
/**
@@ -142,6 +167,28 @@
/** BGP UPDATE AS_PATH Type: AS_SEQUENCE. */
public static final int AS_SEQUENCE = 2;
+
+ /**
+ * Gets the BGP AS_PATH type as a string.
+ *
+ * @param type the BGP AS_PATH type
+ * @return the BGP AS_PATH type as a string
+ */
+ public static String typeToString(int type) {
+ String typeString = "UNKNOWN";
+
+ switch (type) {
+ case AS_SET:
+ typeString = "AS_SET";
+ break;
+ case AS_SEQUENCE:
+ typeString = "AS_SEQUENCE";
+ break;
+ default:
+ break;
+ }
+ return typeString;
+ }
}
/**