Bug 9196 - Maxpath value should be between 1 to 64 in BGP multipath 00/63400/2
authorGowri R <gowri.r@ericsson.com>
Thu, 21 Sep 2017 11:50:39 +0000 (17:20 +0530)
committerSam Hague <shague@redhat.com>
Fri, 22 Sep 2017 01:11:20 +0000 (01:11 +0000)
Adding a check to ensure maxpath value for BGP multipath is in the range 1
to 64

Change-Id: I03786726053672d04b8ef552cb16cc45a9c4a840
Signed-off-by: Gowri R <gowri.r@ericsson.com>
vpnservice/bgpmanager/bgpmanager-impl/src/main/java/org/opendaylight/netvirt/bgpmanager/commands/Multipath.java

index 45820df99a5aa69f0e4474c7403619a0b43a5887..09019f6dc2e4aaf565772c6ae0981fbe5ff7231c 100644 (file)
@@ -60,6 +60,7 @@ public class Multipath extends OsgiCommandSupport {
 
         af_afi afi = null;
         af_safi safi = null;
+        int imaxpath = maxpath == null ? -1 : Integer.parseInt(maxpath);
 
         if (addrFamily != null) {
             if (!addrFamily.equals("lu"))  {
@@ -72,6 +73,11 @@ public class Multipath extends OsgiCommandSupport {
             safi = af_safi.SAFI_MPLS_VPN;
         }
 
+        if (imaxpath < 1 && imaxpath > 64) {
+            session.getConsole().println("error: " + MAXPATH + " must be between 1 and 64");
+            return null;
+        }
+
         if (multipathEnable != null) {
 
             switch (multipathEnable) {