[ONOS-3857] BGP sourceprefix packetlength protocol flow specification components.

Change-Id: I4a8a209c07db954bb7fb3dcbc236bc3a8018a4b4
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsIcmpCode.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsIcmpCode.java
new file mode 100755
index 0000000..7ae2501
--- /dev/null
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsIcmpCode.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.bgpio.types;
+
+import java.util.Objects;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onosproject.bgpio.exceptions.BgpParseException;
+import org.onosproject.bgpio.util.Constants;
+import java.util.List;
+import com.google.common.base.MoreObjects;
+
+/**
+ * Provides implementation of BGP flow specification component.
+ */
+public class BgpFsIcmpCode implements BgpValueType {
+    public static final byte FLOW_SPEC_TYPE = Constants.BGP_FLOWSPEC_ICMP_CD;
+    private List<BgpFsOperatorValue> operatorValue;
+
+    /**
+     * Constructor to initialize the value.
+     *
+     * @param operatorValue list of operator and value
+     */
+    public BgpFsIcmpCode(List<BgpFsOperatorValue> operatorValue) {
+        this.operatorValue = operatorValue;
+    }
+
+    @Override
+    public short getType() {
+        return this.FLOW_SPEC_TYPE;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(operatorValue);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof BgpFsIcmpCode) {
+            BgpFsIcmpCode other = (BgpFsIcmpCode) obj;
+            return this.operatorValue.equals(other.operatorValue);
+        }
+        return false;
+    }
+
+    @Override
+    public int write(ChannelBuffer cb) {
+        int iLenStartIndex = cb.writerIndex();
+
+        cb.writeByte(FLOW_SPEC_TYPE);
+
+        for (BgpFsOperatorValue fsOperVal : operatorValue) {
+            cb.writeByte(fsOperVal.option());
+            cb.writeBytes(fsOperVal.value());
+        }
+
+        return cb.writerIndex() - iLenStartIndex;
+    }
+
+    /**
+     * Reads the channel buffer and returns object.
+     *
+     * @param cb channelBuffer
+     * @param type address type
+     * @return object of flow spec ICMP code
+     * @throws BgpParseException while parsing BgpFsIcmpCode
+     */
+    public static BgpFsIcmpCode read(ChannelBuffer cb, short type) throws BgpParseException {
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("FLOW_SPEC_TYPE", FLOW_SPEC_TYPE)
+                .add("operatorValue", operatorValue).toString();
+    }
+
+    @Override
+    public int compareTo(Object o) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+}
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsIcmpType.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsIcmpType.java
new file mode 100755
index 0000000..d3d0329
--- /dev/null
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsIcmpType.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.bgpio.types;
+
+import java.util.Objects;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onosproject.bgpio.exceptions.BgpParseException;
+import org.onosproject.bgpio.util.Constants;
+import java.util.List;
+import com.google.common.base.MoreObjects;
+
+/**
+ * Provides implementation of BGP flow specification component.
+ */
+public class BgpFsIcmpType implements BgpValueType {
+    public static final byte FLOW_SPEC_TYPE = Constants.BGP_FLOWSPEC_ICMP_TP;
+    private List<BgpFsOperatorValue> operatorValue;
+
+    /**
+     * Constructor to initialize the value.
+     *
+     * @param operatorValue list of operator and value
+     */
+    public BgpFsIcmpType(List<BgpFsOperatorValue> operatorValue) {
+        this.operatorValue = operatorValue;
+    }
+
+    @Override
+    public short getType() {
+        return this.FLOW_SPEC_TYPE;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(operatorValue);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof BgpFsIcmpType) {
+            BgpFsIcmpType other = (BgpFsIcmpType) obj;
+            return this.operatorValue.equals(other.operatorValue);
+        }
+        return false;
+    }
+
+    @Override
+    public int write(ChannelBuffer cb) {
+        int iLenStartIndex = cb.writerIndex();
+        cb.writeByte(FLOW_SPEC_TYPE);
+
+        for (BgpFsOperatorValue fsOperVal : operatorValue) {
+            cb.writeByte(fsOperVal.option());
+            cb.writeBytes(fsOperVal.value());
+        }
+
+        return cb.writerIndex() - iLenStartIndex;
+    }
+
+    /**
+     * Reads the channel buffer and returns object.
+     *
+     * @param cb channelBuffer
+     * @param type address type
+     * @return object of flow spec ICMP type
+     * @throws BgpParseException while parsing BgpFsIcmpType
+     */
+    public static BgpFsIcmpType read(ChannelBuffer cb, short type) throws BgpParseException {
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("FLOW_SPEC_TYPE", FLOW_SPEC_TYPE)
+                .add("operatorValue", operatorValue).toString();
+    }
+
+    @Override
+    public int compareTo(Object o) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+}
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsIpProtocol.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsIpProtocol.java
new file mode 100755
index 0000000..725d4ad
--- /dev/null
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsIpProtocol.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.bgpio.types;
+
+import java.util.List;
+import java.util.Objects;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onosproject.bgpio.exceptions.BgpParseException;
+import org.onosproject.bgpio.util.Constants;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * Provides implementation of BGP flow specification component.
+ */
+public class BgpFsIpProtocol implements BgpValueType {
+    public static final byte FLOW_SPEC_TYPE = Constants.BGP_FLOWSPEC_IP_PROTO;
+    private List<BgpFsOperatorValue> operatorValue;
+
+    /**
+     * Constructor to initialize the value.
+     *
+     * @param operatorValue list of operator and value
+     */
+    public BgpFsIpProtocol(List<BgpFsOperatorValue> operatorValue) {
+        this.operatorValue = operatorValue;
+    }
+
+    /**
+     * Returns flow type operator and value.
+     *
+     * @return flow type value
+     */
+    public List<BgpFsOperatorValue> operatorValue() {
+        return operatorValue;
+    }
+
+
+    @Override
+    public short getType() {
+        return this.FLOW_SPEC_TYPE;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(operatorValue);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof BgpFsIpProtocol) {
+            BgpFsIpProtocol other = (BgpFsIpProtocol) obj;
+            return Objects.equals(this.operatorValue, other.operatorValue);
+        }
+        return false;
+    }
+
+    @Override
+    public int write(ChannelBuffer cb) {
+        int iLenStartIndex = cb.writerIndex();
+        cb.writeByte(FLOW_SPEC_TYPE);
+
+        for (BgpFsOperatorValue fsOperVal : operatorValue) {
+            cb.writeByte(fsOperVal.option());
+            cb.writeBytes(fsOperVal.value());
+        }
+
+        return cb.writerIndex() - iLenStartIndex;
+    }
+
+    /**
+     * Reads the channel buffer and returns object.
+     *
+     * @param cb channelBuffer
+     * @param type address type
+     * @return object of flow spec IP protocol
+     * @throws BgpParseException while parsing BgpFsIpProtocol
+     */
+    public static BgpFsIpProtocol read(ChannelBuffer cb, short type) throws BgpParseException {
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("FLOW_SPEC_TYPE", FLOW_SPEC_TYPE)
+                .add("operatorValue", operatorValue).toString();
+    }
+
+    @Override
+    public int compareTo(Object o) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+}
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsPacketLength.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsPacketLength.java
new file mode 100755
index 0000000..5e2a83b
--- /dev/null
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsPacketLength.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.bgpio.types;
+
+import java.util.Objects;
+import java.util.List;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onosproject.bgpio.exceptions.BgpParseException;
+import org.onosproject.bgpio.util.Constants;
+import com.google.common.base.MoreObjects;
+
+/**
+ * Provides implementation of BGP flow specification component.
+ */
+public class BgpFsPacketLength implements BgpValueType {
+
+    public static final byte FLOW_SPEC_TYPE = Constants.BGP_FLOWSPEC_PCK_LEN;
+    private List<BgpFsOperatorValue> operatorValue;
+
+    /**
+     * Constructor to initialize the value.
+     *
+     * @param operatorValue list of operator and value
+     */
+    public BgpFsPacketLength(List<BgpFsOperatorValue> operatorValue) {
+        this.operatorValue = operatorValue;
+    }
+
+    @Override
+    public short getType() {
+        return this.FLOW_SPEC_TYPE;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(operatorValue);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof BgpFsPacketLength) {
+            BgpFsPacketLength other = (BgpFsPacketLength) obj;
+            return this.operatorValue.equals(other.operatorValue);
+        }
+        return false;
+    }
+
+    @Override
+    public int write(ChannelBuffer cb) {
+        int iLenStartIndex = cb.writerIndex();
+
+        cb.writeByte(FLOW_SPEC_TYPE);
+
+        for (BgpFsOperatorValue fsOperVal : operatorValue) {
+            cb.writeByte(fsOperVal.option());
+            cb.writeBytes(fsOperVal.value());
+        }
+
+        return cb.writerIndex() - iLenStartIndex;
+    }
+
+    /**
+     * Reads the channel buffer and returns object.
+     *
+     * @param cb channelBuffer
+     * @param type address type
+     * @return object of flow spec packet length
+     * @throws BgpParseException while parsing BgpFsPacketLength
+     */
+    public static BgpFsPacketLength read(ChannelBuffer cb, short type) throws BgpParseException {
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("FLOW_SPEC_TYPE", FLOW_SPEC_TYPE)
+                .add("operatorValue", operatorValue).toString();
+    }
+
+    @Override
+    public int compareTo(Object o) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+}
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsSourcePortNum.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsSourcePortNum.java
new file mode 100755
index 0000000..52f3f3c
--- /dev/null
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsSourcePortNum.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.bgpio.types;
+
+import java.util.Objects;
+import java.util.List;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onosproject.bgpio.exceptions.BgpParseException;
+import org.onosproject.bgpio.util.Constants;
+import com.google.common.base.MoreObjects;
+
+/**
+ * Provides implementation of BGP flow specification component.
+ */
+public class BgpFsSourcePortNum implements BgpValueType {
+
+    public static final byte FLOW_SPEC_TYPE = Constants.BGP_FLOWSPEC_SRC_PORT;
+    private List<BgpFsOperatorValue> operatorValue;
+
+    /**
+     * Constructor to initialize the value.
+     *
+     * @param operatorValue list of operator and value
+     */
+    public BgpFsSourcePortNum(List<BgpFsOperatorValue> operatorValue) {
+        this.operatorValue = operatorValue;
+    }
+
+    @Override
+    public short getType() {
+        return this.FLOW_SPEC_TYPE;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(operatorValue);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof BgpFsSourcePortNum) {
+            BgpFsSourcePortNum other = (BgpFsSourcePortNum) obj;
+            return this.operatorValue.equals(other.operatorValue);
+        }
+        return false;
+    }
+
+    @Override
+    public int write(ChannelBuffer cb) {
+        int iLenStartIndex = cb.writerIndex();
+
+        cb.writeByte(FLOW_SPEC_TYPE);
+
+        for (BgpFsOperatorValue fsOperVal : operatorValue) {
+            cb.writeByte(fsOperVal.option());
+            cb.writeBytes(fsOperVal.value());
+        }
+
+        return cb.writerIndex() - iLenStartIndex;
+    }
+
+    /**
+     * Reads the channel buffer and returns object.
+     *
+     * @param cb channelBuffer
+     * @param type address type
+     * @return object of flow spec source port number
+     * @throws BgpParseException while parsing BgpFsSourcePortNum
+     */
+    public static BgpFsSourcePortNum read(ChannelBuffer cb, short type) throws BgpParseException {
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("FLOW_SPEC_TYPE", FLOW_SPEC_TYPE)
+                .add("operatorValue", operatorValue).toString();
+    }
+
+    @Override
+    public int compareTo(Object o) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+}
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsSourcePrefix.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsSourcePrefix.java
new file mode 100755
index 0000000..5b75684
--- /dev/null
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsSourcePrefix.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.bgpio.types;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onlab.packet.IpPrefix;
+import org.onosproject.bgpio.exceptions.BgpParseException;
+import org.onosproject.bgpio.util.Constants;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Preconditions;
+
+/**
+ * Provides implementation of IPv4AddressTlv.
+ */
+public class BgpFsSourcePrefix implements BgpValueType {
+
+    public static final byte FLOW_SPEC_TYPE = Constants.BGP_FLOWSPEC_SRC_PREFIX;
+    private byte length;
+    private IpPrefix ipPrefix;
+
+    /**
+     * Constructor to initialize parameters.
+     *
+     * @param length length of the prefix
+     * @param ipPrefix ip prefix
+     */
+    public BgpFsSourcePrefix(byte length, IpPrefix ipPrefix) {
+        this.ipPrefix = Preconditions.checkNotNull(ipPrefix);
+        this.length = length;
+    }
+
+    /**
+     * Returns ip prefix.
+     *
+     * @return ipPrefix ip prefix
+     */
+    public IpPrefix ipPrefix() {
+        return ipPrefix;
+    }
+
+    @Override
+    public short getType() {
+        return this.FLOW_SPEC_TYPE;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(ipPrefix);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof BgpFsSourcePrefix) {
+            BgpFsSourcePrefix other = (BgpFsSourcePrefix) obj;
+            return Objects.equals(this.ipPrefix, other.ipPrefix) && Objects.equals(this.length, other.length);
+        }
+        return false;
+    }
+
+    @Override
+    public int write(ChannelBuffer cb) {
+        int iLenStartIndex = cb.writerIndex();
+        cb.writeByte(FLOW_SPEC_TYPE);
+        cb.writeByte(length);
+        cb.writeInt(ipPrefix.getIp4Prefix().address().toInt());
+        return cb.writerIndex() - iLenStartIndex;
+    }
+
+    /**
+     * Reads the channel buffer and returns object of IPv4AddressTlv.
+     *
+     * @param cb channelBuffer
+     * @param type address type
+     * @return object of flow spec source prefix
+     * @throws BgpParseException while parsing BgpFsSourcePrefix
+     */
+    public static BgpFsSourcePrefix read(ChannelBuffer cb, short type) throws BgpParseException {
+        return null;
+    }
+
+    /**
+     * Returns object of this class with specified values.
+     *
+     * @param ipPrefix ip prefix
+     * @param length length of ip prefix
+     * @return object of this class
+     */
+    public static BgpFsSourcePrefix of(final IpPrefix ipPrefix, final byte length) {
+        return new BgpFsSourcePrefix(length, ipPrefix);
+    }
+
+    @Override
+    public int compareTo(Object o) {
+        if (this.equals(o)) {
+            return 0;
+        }
+
+        if (o instanceof BgpFsSourcePrefix) {
+            BgpFsSourcePrefix that = (BgpFsSourcePrefix) o;
+
+            if (this.ipPrefix().prefixLength() == that.ipPrefix().prefixLength()) {
+                ByteBuffer value1 = ByteBuffer.wrap(this.ipPrefix.address().toOctets());
+                ByteBuffer value2 = ByteBuffer.wrap(that.ipPrefix.address().toOctets());
+                return value1.compareTo(value2);
+            }
+
+            if (this.ipPrefix().prefixLength() > that.ipPrefix().prefixLength()) {
+                return 1;
+            } else if (this.ipPrefix().prefixLength() < that.ipPrefix().prefixLength()) {
+                return -1;
+            }
+        }
+        return 1;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("FLOW_SPEC_TYPE", FLOW_SPEC_TYPE).add("length", length)
+                .add("ipPrefix", ipPrefix).toString();
+    }
+}
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsTcpFlags.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsTcpFlags.java
new file mode 100755
index 0000000..fef2d3f
--- /dev/null
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpFsTcpFlags.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.bgpio.types;
+
+import java.util.Objects;
+import java.util.List;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onosproject.bgpio.exceptions.BgpParseException;
+import org.onosproject.bgpio.util.Constants;
+import com.google.common.base.MoreObjects;
+
+/**
+ * Provides implementation of BGP flow specification component.
+ */
+public class BgpFsTcpFlags implements BgpValueType {
+
+    public static final byte FLOW_SPEC_TYPE = Constants.BGP_FLOWSPEC_TCP_FLAGS;
+    private List<BgpFsOperatorValue> operatorValue;
+
+    /**
+     * Constructor to initialize the value.
+     *
+     * @param operatorValue list of operator and value
+     */
+    public BgpFsTcpFlags(List<BgpFsOperatorValue> operatorValue) {
+        this.operatorValue = operatorValue;
+    }
+
+    @Override
+    public short getType() {
+        return this.FLOW_SPEC_TYPE;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(operatorValue);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof BgpFsTcpFlags) {
+            BgpFsTcpFlags other = (BgpFsTcpFlags) obj;
+            return this.operatorValue.equals(other.operatorValue);
+        }
+        return false;
+    }
+
+    @Override
+    public int write(ChannelBuffer cb) {
+        int iLenStartIndex = cb.writerIndex();
+        cb.writeByte(FLOW_SPEC_TYPE);
+
+        for (BgpFsOperatorValue fsOperVal : operatorValue) {
+            cb.writeByte(fsOperVal.option());
+            cb.writeBytes(fsOperVal.value());
+        }
+
+        return cb.writerIndex() - iLenStartIndex;
+    }
+
+    /**
+     * Reads the channel buffer and returns object.
+     *
+     * @param cb channelBuffer
+     * @param type address type
+     * @return object of flow spec TCP flags
+     * @throws BgpParseException while parsing BgpFsTcpFlags
+     */
+    public static BgpFsTcpFlags read(ChannelBuffer cb, short type) throws BgpParseException {
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("FLOW_SPEC_TYPE", FLOW_SPEC_TYPE)
+                .add("operatorValue", operatorValue).toString();
+    }
+
+    @Override
+    public int compareTo(Object o) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+}