[ONOS-8073] Fix for : BGP Open message keeps only last "Optional Parameter"
- Create an inner linkedlist and add that to the main Linked list of capabilities
Change-Id: I42e87d4fd3949d13ebacc36dd83682365b4cbdd8
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BgpOpenMsgVer4.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BgpOpenMsgVer4.java
index 716101c..d7550ff 100644
--- a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BgpOpenMsgVer4.java
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BgpOpenMsgVer4.java
@@ -224,7 +224,10 @@
// Parse capabilities only if optional parameter type is 2
if ((optParaType == OPT_PARA_TYPE_CAPABILITY) && (capParaLen != 0)) {
- capabilityTlv = parseCapabilityTlv(capaCb);
+ //Observed that some routers send a list of capabilities, while others send a list
+ //of optional parameters. This takes care of both
+ LinkedList<BgpValueType> currentCapabilityTlv = parseCapabilityTlv(capaCb);
+ capabilityTlv.addAll(currentCapabilityTlv);
} else {
throw new BgpParseException(BgpErrorType.OPEN_MESSAGE_ERROR,
BgpErrorType.UNSUPPORTED_OPTIONAL_PARAMETER, null);