[CORD-578] MPLS ECMP configurable
Changes:
- Adds MPLS-ECMP option to SR configuration;
- Updates the json examples;
- Implements unit tests to verify the expected behaviors;
Change-Id: I6a7f5d34161be7c85ecb76c9a09288d960aad3cb
diff --git a/src/main/java/org/onosproject/segmentrouting/config/SegmentRoutingAppConfig.java b/src/main/java/org/onosproject/segmentrouting/config/SegmentRoutingAppConfig.java
index 0eb2c8e..3fe7e4b 100644
--- a/src/main/java/org/onosproject/segmentrouting/config/SegmentRoutingAppConfig.java
+++ b/src/main/java/org/onosproject/segmentrouting/config/SegmentRoutingAppConfig.java
@@ -40,17 +40,39 @@
private static final String SUPPRESS_HOST_BY_PORT = "suppressHostByPort";
// TODO We might want to move SUPPRESS_HOST_BY_PROVIDER to Component Config
private static final String SUPPRESS_HOST_BY_PROVIDER = "suppressHostByProvider";
+ private static final String MPLS_ECMP = "MPLS-ECMP";
@Override
public boolean isValid() {
return hasOnlyFields(VROUTER_MACS, VROUTER_ID, SUPPRESS_SUBNET,
- SUPPRESS_HOST_BY_PORT, SUPPRESS_HOST_BY_PROVIDER) &&
+ SUPPRESS_HOST_BY_PORT, SUPPRESS_HOST_BY_PROVIDER, MPLS_ECMP) &&
vRouterMacs() != null && vRouterId() != null &&
suppressSubnet() != null && suppressHostByPort() != null &&
suppressHostByProvider() != null;
}
/**
+ * Gets MPLS-ECMP configuration from the config.
+ *
+ * @return the configuration of MPLS-ECMP. If it is not
+ * specified, the default behavior is false.
+ */
+ public boolean mplsEcmp() {
+ return get(MPLS_ECMP, false);
+ }
+
+ /**
+ * Sets MPLS-ECMP to the config.
+ *
+ * @param mplsEcmp the MPLS-ECMP configuration
+ * @return this {@link SegmentRoutingAppConfig}
+ */
+ public SegmentRoutingAppConfig setMplsEcmp(boolean mplsEcmp) {
+ object.put(MPLS_ECMP, mplsEcmp);
+ return this;
+ }
+
+ /**
* Gets vRouters from the config.
*
* @return Set of vRouter MAC addresses, empty is not specified,
@@ -276,6 +298,7 @@
.add("suppressSubnet", suppressSubnet())
.add("suppressHostByPort", suppressHostByPort())
.add("suppressHostByProvider", suppressHostByProvider())
+ .add("mplsEcmp", mplsEcmp())
.toString();
}
}