[ONOS-3857] BGP update message flow specification components parsing.
Change-Id: I9b58cdf2c47cb736a8119433cbc7911d871a83d1
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsDscpValue.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsDscpValue.java
index e383399..6165a50 100755
--- a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsDscpValue.java
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsDscpValue.java
@@ -15,6 +15,7 @@
*/
package org.onosproject.bgpio.types;
+import java.util.LinkedList;
import java.util.Objects;
import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
@@ -79,12 +80,20 @@
* Reads the channel buffer and returns object.
*
* @param cb channelBuffer
- * @param type address type
* @return object of flow spec DSCP value
* @throws BgpParseException while parsing BgpFsDscpValue
*/
- public static BgpFsDscpValue read(ChannelBuffer cb, short type) throws BgpParseException {
- return null;
+ public static BgpFsDscpValue read(ChannelBuffer cb) throws BgpParseException {
+ List<BgpFsOperatorValue> operatorValue = new LinkedList<>();
+ byte option;
+ byte dscpValue;
+
+ do {
+ option = (byte) cb.readByte();
+ dscpValue = cb.readByte();
+ operatorValue.add(new BgpFsOperatorValue(option, new byte[] {(byte) dscpValue}));
+ } while ((option & Constants.BGP_FLOW_SPEC_END_OF_LIST_MASK) == 0);
+ return new BgpFsDscpValue(operatorValue);
}
@Override