BGP Route policy distribution and flow spec

Change-Id: I8903efd225a24db6ccc85a4a3148a4dd6076e042
diff --git a/apps/bgpflowspec/BUCK b/apps/bgpflowspec/BUCK
new file mode 100755
index 0000000..fbcc903
--- /dev/null
+++ b/apps/bgpflowspec/BUCK
@@ -0,0 +1,12 @@
+BUNDLES = [
+    '//apps/bgpflowspec/flowapi:onos-apps-bgpflowspec-flowapi',
+    '//apps/bgpflowspec/flowmgr:onos-apps-bgpflowspec-flowmgr',
+    '//apps/bgpflowspec/bgpweb:onos-apps-bgpflowspec-web',
+]
+
+onos_app (
+  title = 'BGP App',
+  url = 'http://onosproject.org',
+  included_bundles = BUNDLES,
+  description = 'ONOS framework applications',
+)
diff --git a/apps/bgpflowspec/app/app.xml b/apps/bgpflowspec/app/app.xml
new file mode 100755
index 0000000..cb1de47
--- /dev/null
+++ b/apps/bgpflowspec/app/app.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2016-present 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.
+  -->
+<app name="org.onosproject.bgpflow" origin="ON.Lab" version="${project.version}"
+     category="default" url="http://onosproject.org"
+     featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
+     features="${project.artifactId}">
+    <description>${project.description}</description>
+    <artifact>mvn:${project.groupId}/onos-app-bgp-flowmgr/${project.version}</artifact>
+    <artifact>mvn:${project.groupId}/onos-app-bgp-web/${project.version}</artifact>
+    <artifact>mvn:${project.groupId}/onos-app-bgp-flowapi/${project.version}</artifact>
+</app>
diff --git a/apps/bgpflowspec/app/features.xml b/apps/bgpflowspec/app/features.xml
new file mode 100755
index 0000000..d638a57
--- /dev/null
+++ b/apps/bgpflowspec/app/features.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+  ~ Copyright 2016-present 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.
+  -->
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
+    <feature name="${project.artifactId}" version="${project.version}"
+             description="${project.description}">
+        <feature>onos-api</feature>
+        <feature>onos-drivers</feature>
+        <bundle>mvn:${project.groupId}/onos-app-bgp-flowapi/${project.version}</bundle>
+        <bundle>mvn:${project.groupId}/onos-app-bgp-flowmgr/${project.version}</bundle>
+        <bundle>mvn:${project.groupId}/onos-app-bgp-web/${project.version}</bundle>
+    </feature>
+</features>
diff --git a/apps/bgpflowspec/app/pom.xml b/apps/bgpflowspec/app/pom.xml
new file mode 100755
index 0000000..53f4d67
--- /dev/null
+++ b/apps/bgpflowspec/app/pom.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2016-present 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-app-bgpflow</artifactId>
+        <version>1.6.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>onos-app-bgp-flow</artifactId>
+    <packaging>pom</packaging>
+
+    <description>ONOS framework applications</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-app-bgp-flowapi</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-app-bgp-flowmgr</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-app-bgp-web</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git a/apps/bgpflowspec/bgpweb/BUCK b/apps/bgpflowspec/bgpweb/BUCK
new file mode 100755
index 0000000..a5ef9e7
--- /dev/null
+++ b/apps/bgpflowspec/bgpweb/BUCK
@@ -0,0 +1,12 @@
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:javax.ws.rs-api',
+    '//utils/rest:onlab-rest',
+    '//apps/bgpflowspec/flowapi:onos-apps-bgpflowspec-flowapi',
+    '//apps/bgpflowspec/flowmgr:onos-apps-bgpflowspec-flowmgr',
+]
+
+osgi_jar_with_tests (
+    name = 'onos-apps-bgpflowspec-web',
+    deps = COMPILE_DEPS,
+)
diff --git a/apps/bgpflowspec/bgpweb/pom.xml b/apps/bgpflowspec/bgpweb/pom.xml
new file mode 100755
index 0000000..036a7d1
--- /dev/null
+++ b/apps/bgpflowspec/bgpweb/pom.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2016-present 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.
+  -->
+<project
+        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+        xmlns="http://maven.apache.org/POM/4.0.0"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-app-bgpflow</artifactId>
+        <version>1.6.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>onos-app-bgp-web</artifactId>
+    <packaging>bundle</packaging>
+    <properties>
+        <web.context>/onos/bgp</web.context>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>javax.ws.rs-api</artifactId>
+            <version>2.0.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-app-bgp-flowmgr</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-rest</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava-testlib</artifactId>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <_wab>src/main/webapp/</_wab>
+                        <Bundle-SymbolicName>
+                            ${project.groupId}.${project.artifactId}
+                        </Bundle-SymbolicName>
+                        <Import-Package>
+                            *,org.glassfish.jersey.servlet
+                        </Import-Package>
+                        <Web-ContextPath>${web.context}</Web-ContextPath>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/resources/BgpFlowWebResource.java b/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/resources/BgpFlowWebResource.java
new file mode 100755
index 0000000..44ba4a4
--- /dev/null
+++ b/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/resources/BgpFlowWebResource.java
@@ -0,0 +1,352 @@
+/*
+ * Copyright 2016-present 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.bgpweb.resources;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.flow.manager.BgpFlowService;
+import org.onosproject.flowapi.DefaultExtWideCommunityInt;
+import org.onosproject.flowapi.ExtFlowContainer;
+import org.onosproject.flowapi.ExtFlowTypes;
+import org.onosproject.flowapi.ExtTrafficAction;
+import org.onosproject.flowapi.ExtWideCommunityInt;
+import org.onosproject.rest.AbstractWebResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import java.util.ListIterator;
+
+import static javax.ws.rs.core.Response.Status.NOT_ACCEPTABLE;
+import static javax.ws.rs.core.Response.Status.OK;
+
+/**
+ * Bgp flow web resource.
+ */
+
+@Path("flow")
+public class BgpFlowWebResource extends AbstractWebResource {
+
+    private BgpFlowService flowService = get(BgpFlowService.class);
+    protected static final String BGPFLOW = "bgp_flow";
+    protected static final String DEVICEID = "deviceId";
+    protected static final int LOCAL_PERF = 20;
+    private final Logger log = LoggerFactory.getLogger(BgpFlowWebResource.class);
+
+    /**
+     * Get the Bgp flow.
+     *
+     * @return 200 OK
+     */
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response getBgpFlow() {
+        Boolean result = true;
+        //TODO
+        return ok(result.toString()).build();
+    }
+
+    /**
+     * Push the the Bgp flow spec.
+     *
+     * @param stream bgp flow spec in JSON
+     * @return status of the request - CREATED if the JSON is correct,
+     * BAD_REQUEST if the JSON is invalid
+     */
+    @POST
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response createBgpFlow(InputStream stream) {
+        try {
+            ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
+            JsonNode flow = jsonTree.get(BGPFLOW);
+            String devId = jsonTree.get(DEVICEID).asText();
+            boolean status;
+
+            List<ExtFlowTypes> list;
+            ExtFlowContainer container;
+
+            list = codec(ExtFlowTypes.class).decode((ArrayNode) flow, this);
+
+            if (!validateRpd(list)) {
+                return Response.status(NOT_ACCEPTABLE).entity(Boolean.FALSE.toString()).build();
+            }
+
+            container = new ExtFlowContainer(list);
+            container.setDeviceId(devId);
+
+
+            status = flowService.onBgpFlowCreated(container);
+            Boolean isSuccess = Boolean.valueOf(status);
+            if (!status) {
+                return Response.status(NOT_ACCEPTABLE).entity(isSuccess.toString()).build();
+            }
+
+            return Response.status(OK).entity(isSuccess.toString()).build();
+        } catch (IOException e) {
+            log.error("Exception while parsing bgp flow.", e.toString());
+            throw new IllegalArgumentException(e);
+        }
+    }
+
+    /**
+     * Validates the rpd and flow spec classes.
+     *
+     * @param list list of types
+     * @return a true if the validation succeeds else false
+     */
+    boolean validateRpd(List<ExtFlowTypes> list) {
+        ListIterator<ExtFlowTypes> iterator = list.listIterator();
+        ExtFlowTypes flow;
+        boolean key = false;
+        boolean rpd = false;
+        boolean nonRpd = false;
+        ExtTrafficAction flowAction = null;
+        boolean dstPfx = false;
+        boolean wcFlg = false;
+        boolean wcHop = false;
+        boolean wcWc = false;
+        boolean wcCAs = false;
+        boolean wcLAs = false;
+        boolean wcTarget = false;
+        boolean wcETarget = false;
+        boolean wcParm = false;
+
+        while (iterator.hasNext()) {
+            flow = iterator.next();
+            switch (flow.type()) {
+                case EXT_FLOW_RULE_KEY:
+                    key = true;
+                    break;
+                case IPV4_DST_PFX:
+                    dstPfx = true;
+                    break;
+                case IPV4_SRC_PFX:
+                    nonRpd = true;
+                    break;
+                case IP_PROTO_LIST:
+                    nonRpd = true;
+                    break;
+                case IN_PORT_LIST:
+                    nonRpd = true;
+                    break;
+                case DST_PORT_LIST:
+                    nonRpd = true;
+                    break;
+                case SRC_PORT_LIST:
+                    nonRpd = true;
+                    break;
+                case ICMP_TYPE_LIST:
+                    nonRpd = true;
+                    break;
+                case ICMP_CODE_LIST:
+                    nonRpd = true;
+                    break;
+                case TCP_FLAG_LIST:
+                    nonRpd = true;
+                    break;
+                case PACKET_LENGTH_LIST:
+                    nonRpd = true;
+                    break;
+                case DSCP_VALUE_LIST:
+                    nonRpd = true;
+                    break;
+                case FRAGMENT_LIST:
+                    nonRpd = true;
+                    break;
+                case TRAFFIC_ACTION:
+                    flowAction = (ExtTrafficAction) flow;
+                    if (flowAction.rpd()) {
+                        rpd = true;
+                    }
+                    break;
+                case TRAFFIC_RATE:
+                    nonRpd = true;
+                    break;
+                case TRAFFIC_REDIRECT:
+                    nonRpd = true;
+                    break;
+                case TRAFFIC_MARKING:
+                    nonRpd = true;
+                    break;
+                case WIDE_COMM_FLAGS:
+                    wcFlg = true;
+                    break;
+                case WIDE_COMM_HOP_COUNT:
+                    wcHop = true;
+                    break;
+                case WIDE_COMM_COMMUNITY:
+                    wcWc = true;
+                    break;
+                case WIDE_COMM_CONTEXT_AS:
+                    wcCAs = true;
+                    break;
+                case WIDE_COMM_LOCAL_AS:
+                    wcLAs = true;
+                    break;
+                case WIDE_COMM_TARGET:
+                    wcTarget = true;
+                    break;
+                case WIDE_COMM_EXT_TARGET:
+                    wcETarget = true;
+                    break;
+                case WIDE_COMM_PARAMETER:
+                    wcParm = true;
+                    break;
+                default:
+                    log.error("error: this type is not supported");
+                    break;
+            }
+        }
+
+        if (!key) {
+            return false;
+        }
+
+        /** checking for non Rpd. */
+        if (!rpd) {
+            if (wcFlg || wcHop || wcWc
+                    || wcCAs || wcLAs || wcParm) {
+                return false;
+            }
+        }
+
+        /** checking for Rpd. */
+        if (nonRpd || !dstPfx || !wcFlg || !wcHop
+                || !wcWc || !wcCAs || !wcLAs || !wcParm) {
+            return false;
+        }
+
+        /** If it is rpd then either of these two or both should be present.*/
+        if (!wcTarget && !wcETarget) {
+            rpd = false;
+        }
+
+        if (!handleRpdLocalPerf(list)) {
+            return false;
+        }
+
+        return rpd;
+    }
+
+    /**
+     * Validate and format the rpd local perf.
+     *
+     * @param list list of types
+     * @return a true if the validation succeeds else false
+     */
+    boolean handleRpdLocalPerf(List<ExtFlowTypes> list) {
+        ListIterator<ExtFlowTypes> iterator = list.listIterator();
+        ExtFlowTypes flow;
+
+        ExtWideCommunityInt wcComm = null;
+        ExtWideCommunityInt wcParam = null;
+        ListIterator<Integer> wcInt = null;
+        int community = 0;
+        int param = 0;
+
+        while (iterator.hasNext()) {
+            flow = iterator.next();
+            switch (flow.type()) {
+                case WIDE_COMM_COMMUNITY:
+                    wcComm = (ExtWideCommunityInt) flow;
+                    wcInt = wcComm.communityInt().listIterator();
+                    community = wcInt.next().intValue();
+                    break;
+
+                case WIDE_COMM_PARAMETER:
+                    wcParam = (ExtWideCommunityInt) flow;
+                    wcInt = wcParam.communityInt().listIterator();
+                    param = wcInt.next().intValue();
+                    break;
+                default:
+                    log.error("error: this type is not supported");
+                    break;
+            }
+        }
+
+        if (community == LOCAL_PERF) {
+            if (param > 127 || param < -127) {
+                return false;
+            }
+
+            /** if -ve then make it 1 bye value and set it, if it is positive then no issue.*/
+            if (param < 0) {
+                param = ~param + 129;
+                list.remove(wcParam);
+                ExtWideCommunityInt.Builder resultBuilder = new DefaultExtWideCommunityInt.Builder();
+                resultBuilder.setwCommInt(Integer.valueOf(param));
+                resultBuilder.setType(ExtFlowTypes.ExtType.WIDE_COMM_PARAMETER);
+                list.add(resultBuilder.build());
+            }
+        }
+
+        return true;
+    }
+
+    /**
+     * Delete the the Bgp flow spec.
+     *
+     * @param stream bgp flow spec in JSON
+     * @return status of the request - CREATED if the JSON is correct,
+     * BAD_REQUEST if the JSON is invalid
+     */
+    @DELETE
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response deleteBgpFlow(InputStream stream) {
+        try {
+            ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
+            JsonNode flow = jsonTree.get(BGPFLOW);
+            String devId = jsonTree.get(DEVICEID).asText();
+            boolean status;
+
+            List<ExtFlowTypes> list;
+            ExtFlowContainer container;
+
+            list = codec(ExtFlowTypes.class).decode((ArrayNode) flow, this);
+
+            if (!validateRpd(list)) {
+                return Response.status(NOT_ACCEPTABLE).entity(Boolean.FALSE.toString()).build();
+            }
+
+            container = new ExtFlowContainer(list);
+            container.setDeviceId(devId);
+
+
+            status = flowService.onBgpFlowDeleted(container);
+            Boolean isSuccess = Boolean.valueOf(status);
+            if (!status) {
+                return Response.status(NOT_ACCEPTABLE).entity(isSuccess.toString()).build();
+            }
+            return Response.status(OK).entity(isSuccess.toString()).build();
+        } catch (IOException e) {
+            log.error("Exception while parsing bgp flow.", e.toString());
+            throw new IllegalArgumentException(e);
+        }
+    }
+}
diff --git a/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/resources/BgpWebApplication.java b/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/resources/BgpWebApplication.java
new file mode 100755
index 0000000..4ab7777
--- /dev/null
+++ b/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/resources/BgpWebApplication.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016-present 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.bgpweb.resources;
+
+import org.onlab.rest.AbstractWebApplication;
+import java.util.Set;
+
+/**
+ * BGP REST API web application.
+ */
+public class BgpWebApplication extends AbstractWebApplication {
+    @Override
+    public Set<Class<?>> getClasses() {
+        return getClasses(BgpFlowWebResource.class);
+    }
+}
+
diff --git a/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/resources/package-info.java b/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/resources/package-info.java
new file mode 100755
index 0000000..09c5210
--- /dev/null
+++ b/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/resources/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present 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.
+ */
+
+/**
+ * BGP web that used rest to create BGP resources.
+ */
+package org.onosproject.bgpweb.resources;
diff --git a/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/web/BgpCodecRegistrator.java b/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/web/BgpCodecRegistrator.java
new file mode 100755
index 0000000..1140fda
--- /dev/null
+++ b/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/web/BgpCodecRegistrator.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2016-present 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.bgpweb.web;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onosproject.codec.CodecService;
+import org.onosproject.flowapi.ExtFlowTypes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Implementation of the JSON codec brokering service for BGP app.
+ */
+@Component(immediate = true)
+public class BgpCodecRegistrator {
+
+    private static Logger log = LoggerFactory.getLogger(BgpCodecRegistrator.class);
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CodecService codecService;
+
+    @Activate
+    public void activate() {
+        codecService.registerCodec(ExtFlowTypes.class, new BgpFlowExtensionCodec());
+        System.out.print("BgpCodecRegistrator started");
+        log.info("Started");
+    }
+
+    @Deactivate
+    public void deactivate() {
+        log.info("Stopped");
+    }
+}
diff --git a/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/web/BgpFlowExtensionCodec.java b/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/web/BgpFlowExtensionCodec.java
new file mode 100755
index 0000000..5c6f250
--- /dev/null
+++ b/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/web/BgpFlowExtensionCodec.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2016-present 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.bgpweb.web;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.flowapi.ExtFlowTypes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public final class BgpFlowExtensionCodec extends JsonCodec<ExtFlowTypes> {
+
+    protected static final Logger log =
+            LoggerFactory.getLogger(BgpFlowExtensionCodec.class);
+
+    protected static final String TYPE = "type";
+    protected static final String NAME = "name";
+    protected static final String PREFIX = "prefix";
+    protected static final String PROTOCOLS = "protocols";
+    protected static final String PORT = "port";
+    protected static final String DST_PORT = "destinationPort";
+    protected static final String SRC_PORT = "sourcePort";
+    protected static final String ICMP_TYPE = "icmpType";
+    protected static final String ICMP_CODE = "icmpCode";
+    protected static final String TCP_FLAG = "tcpFlag";
+    protected static final String PACKET_LENGTH = "packetLength";
+    protected static final String DSCP_VALUE = "dscpValue";
+    protected static final String FRAGMENT = "fragment";
+
+    protected static final String TRAFFIC_RATE = "trafficRate";
+    protected static final String TRAFFIC_ACTION = "trafficAction";
+    protected static final String TRAFFIC_REDIRECTION = "trafficRedirection";
+    protected static final String TRAFFIC_MARKING = "trafficMarking";
+
+    protected static final String TRAFFIC_RATE_ASN = "asn";
+    protected static final String TRAFFIC_RATE_RATE = "rate";
+    protected static final String TRAFFIC_ACTION_TERMINAL = "terminal";
+    protected static final String TRAFFIC_ACTION_SAMPLE = "sample";
+    protected static final String TRAFFIC_ACTION_RPD = "rpd";
+
+    protected static final String WIDE_COMM_FLAGS = "widecommunityFlags";
+    protected static final String WIDE_COMM_HOP_COUNT = "widecommunityHopCount";
+    protected static final String WIDE_COMM_COMMUNITY = "widecommunityCommunity";
+    protected static final String WIDE_COMM_CONTEXT_AS = "widecommunityContextAs";
+    protected static final String WIDE_COMM_LOCAL_AS = "widecommunityLocalAs";
+    protected static final String WIDE_COMM_TARGET = "widecommunityTarget";
+    protected static final String WIDE_COMM_EXT_TARGET = "widecommunityExtTarget";
+    protected static final String WIDE_COMM_PARAMETER = "widecommunityParameter";
+
+    protected static final String WIDE_COMM_TGT_LOCAL_SP = "localSpeaker";
+    protected static final String WIDE_COMM_TGT_REMOTE_SP = "remoteSpeaker";
+
+    @Override
+    public ObjectNode encode(ExtFlowTypes flowTypes, CodecContext context) {
+        return null;
+    }
+
+    @Override
+    public ExtFlowTypes decode(ObjectNode json, CodecContext context) {
+        DecodeBgpFlowExtnCodecHelper decoder = new DecodeBgpFlowExtnCodecHelper(json);
+        return decoder.decode();
+    }
+}
diff --git a/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/web/BgpParseAttributes.java b/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/web/BgpParseAttributes.java
new file mode 100755
index 0000000..464b388
--- /dev/null
+++ b/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/web/BgpParseAttributes.java
@@ -0,0 +1,402 @@
+/*
+ * Copyright 2016-present 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.bgpweb.web;
+
+import org.onosproject.flowapi.ExtOperatorValue;
+import org.slf4j.Logger;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+public class BgpParseAttributes {
+
+    private final Logger log = getLogger(getClass());
+
+    /** Bits as per flow spec rfc 5575.*/
+    final byte endBit = (byte) 0x80;
+    final byte andBit = 0x40;
+    final byte twoByteLen = (byte) (0x01 << 4);
+    final byte fourByteLen = (byte) (0x02 << 4);
+    final byte lessThan = 0x04;
+    final byte greaterThan = 0x02;
+    final byte equal = 0x01;
+
+    /** Protocol types.*/
+    protected static final byte ICMP = 1;
+    protected static final byte IGMP = 2;
+    protected static final byte TCP = 6;
+    protected static final byte UDP = 17;
+    protected static final byte IPV4 = 4;
+    protected static final byte IPV6 = 41;
+
+    /** TCP Flags.*/
+    static final byte FIN = (1 << 0);
+    static final byte SYN = (1 << 1);
+    static final byte RST = (1 << 2);
+    static final byte PSH = (1 << 3);
+    static final byte ACK = (1 << 4);
+    static final byte URG = (1 << 5);
+
+    final byte notBit = 0x02;
+    final byte matchBit = 0x01;
+
+    /** Fragment Flags.*/
+    static final byte DF = (1 << 0);
+    static final byte IF = (1 << 1);
+    static final byte FF = (1 << 2);
+    static final byte LF = (1 << 3);
+
+    List<ExtOperatorValue> parsePort(String string) {
+        List<ExtOperatorValue> operatorValue = null;
+
+        operatorValue = createOperatorValue(string);
+
+        return operatorValue;
+    }
+
+    List<ExtOperatorValue> parseIpProtocol(String string) {
+        List<ExtOperatorValue> operatorValue  = null;
+
+        string = string.replaceAll("ICMP", Byte.valueOf(ICMP).toString());
+        string = string.replaceAll("icmp", Byte.valueOf(ICMP).toString());
+        string = string.replaceAll("IPv4", Byte.valueOf(IPV4).toString());
+        string = string.replaceAll("ipv4", Byte.valueOf(IPV4).toString());
+        string = string.replaceAll("TCP", Byte.valueOf(TCP).toString());
+        string = string.replaceAll("tcp", Byte.valueOf(TCP).toString());
+        string = string.replaceAll("UDP", Byte.valueOf(UDP).toString());
+        string = string.replaceAll("udp", Byte.valueOf(UDP).toString());
+        string = string.replaceAll("IPv6", Byte.valueOf(IPV6).toString());
+        string = string.replaceAll("ipv6", Byte.valueOf(IPV6).toString());
+        string = string.replaceAll("igmp", Byte.valueOf(IGMP).toString());
+        string = string.replaceAll("IGMP", Byte.valueOf(IGMP).toString());
+
+        operatorValue = createOperatorValue(string);
+
+        return operatorValue;
+    }
+
+    List<ExtOperatorValue> parseIcmpType(String string) {
+        List<ExtOperatorValue> operatorValue  = null;
+
+        operatorValue = createOperatorValue(string);
+
+        return operatorValue;
+    }
+
+    List<ExtOperatorValue> parseIcmpCode(String string) {
+        List<ExtOperatorValue> operatorValue  = null;
+
+        operatorValue = createOperatorValue(string);
+
+        return operatorValue;
+    }
+
+
+    List<ExtOperatorValue> parseTcpFlags(String string) {
+        List<ExtOperatorValue> operatorValue  = new ArrayList<>();
+        Token token;
+        int index = 0;
+
+        string = string.replaceAll("FIN", Byte.valueOf(FIN).toString());
+        string = string.replaceAll("fin", Byte.valueOf(FIN).toString());
+        string = string.replaceAll("SYN", Byte.valueOf(SYN).toString());
+        string = string.replaceAll("syn", Byte.valueOf(SYN).toString());
+        string = string.replaceAll("RST", Byte.valueOf(RST).toString());
+        string = string.replaceAll("rst", Byte.valueOf(RST).toString());
+        string = string.replaceAll("PSH", Byte.valueOf(PSH).toString());
+        string = string.replaceAll("psh", Byte.valueOf(PSH).toString());
+        string = string.replaceAll("ACK", Byte.valueOf(ACK).toString());
+        string = string.replaceAll("ack", Byte.valueOf(ACK).toString());
+        string = string.replaceAll("URG", Byte.valueOf(URG).toString());
+        string = string.replaceAll("urg", Byte.valueOf(URG).toString());
+
+        do {
+            token = parseTcpTokenValue(string, index);
+            if (token.error) {
+                log.error("Error in parsing the TCP value list");
+                return null;
+            }
+            operatorValue.add(new ExtOperatorValue(token.operator, token.value));
+            index = token.index;
+        } while ((token.operator & endBit) != endBit);
+
+        return operatorValue;
+    }
+
+    List<ExtOperatorValue> parsePacketLength(String string) {
+        List<ExtOperatorValue> operatorValue  = null;
+        operatorValue = createOperatorValue(string);
+
+        return operatorValue;
+    }
+
+    List<ExtOperatorValue> parseDscp(String string) {
+        List<ExtOperatorValue> operatorValue  = null;
+
+        operatorValue = createOperatorValue(string);
+
+        return operatorValue;
+    }
+
+    List<ExtOperatorValue> parseFragment(String string) {
+
+        List<ExtOperatorValue> operatorValue  = null;
+
+        string = string.replaceAll("DF", Byte.valueOf(DF).toString());
+        string = string.replaceAll("df", Byte.valueOf(DF).toString());
+        string = string.replaceAll("IF", Byte.valueOf(IF).toString());
+        string = string.replaceAll("if", Byte.valueOf(IF).toString());
+        string = string.replaceAll("FF", Byte.valueOf(FF).toString());
+        string = string.replaceAll("ff", Byte.valueOf(FF).toString());
+        string = string.replaceAll("LF", Byte.valueOf(LF).toString());
+        string = string.replaceAll("lf", Byte.valueOf(LF).toString());
+
+        operatorValue = createOperatorValue(string);
+        return operatorValue;
+    }
+
+    private class Token {
+        byte operator;
+        byte[] value;
+        int index;
+        boolean error;
+    }
+
+    List<ExtOperatorValue> createOperatorValue(String string) {
+        List<ExtOperatorValue> operatorValue  = new ArrayList<>();
+        Token token;
+        int index = 0;
+
+        do {
+            token = parseMultiTokenValue(string, index);
+            if (token.error) {
+                log.error("Error in parsing the operator value list");
+                return null;
+            }
+            operatorValue.add(new ExtOperatorValue(token.operator, token.value));
+            index = token.index;
+        } while ((token.operator & endBit) != endBit);
+
+        return operatorValue;
+    }
+
+
+    Token parseMultiTokenValue(String str, int index) {
+        Token token = new Token();
+        token.error = true;
+        int number = 0;
+        int cur = 0;
+        byte operator = 0;
+        boolean prevNumber = false;
+        boolean bLess = false;
+        boolean bGreater = false;
+        boolean bAnd = false;
+        boolean bEqual = false;
+
+        while (str.length() > index) {
+
+            switch (str.charAt(index)) {
+                case '=':
+                    if (bEqual) {
+                        return token;
+                    }
+                    bEqual = true;
+                    if (prevNumber) {
+                        return windUp(str, index, number, operator);
+                    }
+                    operator = (byte) (operator | equal);
+                    break;
+                case '>':
+                    if (bGreater) {
+                        return token;
+                    }
+                    bGreater = true;
+                    if (prevNumber) {
+                        return windUp(str, index, number, operator);
+                    }
+                    operator = (byte) (operator | greaterThan);
+                    break;
+                case '<':
+                    if (bLess) {
+                        return token;
+                    }
+                    bLess = true;
+                    if (prevNumber) {
+                        return windUp(str, index, number, operator);
+                    }
+                    operator = (byte) (operator | lessThan);
+                    break;
+                case '&':
+                    if (bAnd) {
+                        return token;
+                    }
+                    bAnd = true;
+                    if (prevNumber) {
+                        return windUp(str, index, number, operator);
+                    }
+                    operator = (byte) (operator | andBit);
+                    break;
+                case '0':
+                case '1':
+                case '2':
+                case '3':
+                case '4':
+                case '5':
+                case '6':
+                case '7':
+                case '8':
+                case '9':
+                    prevNumber = true;
+                    bLess = false;
+                    bGreater = false;
+                    bAnd = false;
+                    bEqual = false;
+                    cur =  str.charAt(index);
+                    number = (number * 10) + cur - '0';
+                    break;
+
+                default:
+                    log.error("Error in parsing the token character" + str.charAt(index));
+                    return token;
+            }
+            index++;
+        }
+
+        if (prevNumber) {
+            return windUp(str, index, number, operator);
+        }
+
+        return token;
+    }
+
+    Token windUp(String str, int index, int number, byte operator) {
+        Token token = new Token();
+        byte[] array = new byte[1];
+
+        if (str.length() == index) {
+            operator = (byte) (operator | endBit);
+        }
+
+        if (number <= 255) {
+            array[0] = (byte) number;
+        } else if (number > 255 && number <= Short.MAX_VALUE) {
+            operator = (byte) (operator | twoByteLen);
+            array = shortToByteStream((short) number);
+        } else if (number > Short.MAX_VALUE) {
+            operator = (byte) (operator | fourByteLen);
+            array = intToByteStream(number);
+        }
+
+        token.value = array;
+        token.operator = operator;
+        token.index = index;
+        token.error = false;
+        return token;
+    }
+
+    byte[] intToByteStream(int val) {
+        return new byte[] {
+                (byte) (val >>> 24),
+                (byte) (val >>> 16),
+                (byte) (val >>> 8),
+                (byte) val};
+    }
+
+    byte[] shortToByteStream(short val) {
+        return new byte[] {
+                (byte) (val >>> 8),
+                (byte) val};
+    }
+
+    Token parseTcpTokenValue(String str, int index) {
+        Token token = new Token();
+        token.error = true;
+        int number = 0;
+        int cur = 0;
+        byte operator = 0;
+        boolean prevNumber = false;
+
+        boolean bNotBit = false;
+        boolean bAnd = false;
+        boolean bMatchBit = false;
+
+        while (str.length() > index) {
+
+            switch (str.charAt(index)) {
+                case '=':
+                    if (bMatchBit) {
+                        return token;
+                    }
+                    bMatchBit = true;
+                    if (prevNumber) {
+                        return windUp(str, index, number, operator);
+                    }
+                    operator = (byte) (operator | matchBit);
+                    break;
+                case '!':
+                    if (bNotBit) {
+                        return token;
+                    }
+                    bNotBit = true;
+                    if (prevNumber) {
+                        return windUp(str, index, number, operator);
+                    }
+                    operator = (byte) (operator | notBit);
+                    break;
+                case '&':
+                    if (bAnd) {
+                        return token;
+                    }
+                    bAnd = true;
+                    if (prevNumber) {
+                        return windUp(str, index, number, operator);
+                    }
+                    operator = (byte) (operator | andBit);
+                    break;
+                case '0':
+                case '1':
+                case '2':
+                case '3':
+                case '4':
+                case '5':
+                case '6':
+                case '7':
+                case '8':
+                case '9':
+                    prevNumber = true;
+                    bNotBit = false;
+                    bAnd = false;
+                    bMatchBit = false;
+                    cur =  str.charAt(index);
+                    number = (number * 10) + cur - '0';
+                    break;
+
+                default:
+                    log.error("Error in parsing the TCP token character" + str.charAt(index));
+                    return token;
+            }
+            index++;
+        }
+
+        if (prevNumber) {
+            return windUp(str, index, number, operator);
+        }
+
+        return token;
+    }
+}
diff --git a/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/web/DecodeBgpFlowExtnCodecHelper.java b/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/web/DecodeBgpFlowExtnCodecHelper.java
new file mode 100755
index 0000000..3aafde1
--- /dev/null
+++ b/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/web/DecodeBgpFlowExtnCodecHelper.java
@@ -0,0 +1,721 @@
+/*
+ * Copyright 2016-present 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.bgpweb.web;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
+import org.onosproject.flowapi.DefaultExtDscpValue;
+import org.onosproject.flowapi.DefaultExtFragment;
+import org.onosproject.flowapi.DefaultExtIcmpCode;
+import org.onosproject.flowapi.DefaultExtIcmpType;
+import org.onosproject.flowapi.DefaultExtIpProtocol;
+import org.onosproject.flowapi.DefaultExtKeyName;
+import org.onosproject.flowapi.DefaultExtPacketLength;
+import org.onosproject.flowapi.DefaultExtPort;
+import org.onosproject.flowapi.DefaultExtPrefix;
+import org.onosproject.flowapi.DefaultExtTarget;
+import org.onosproject.flowapi.DefaultExtTcpFlag;
+import org.onosproject.flowapi.DefaultExtTrafficAction;
+import org.onosproject.flowapi.DefaultExtTrafficMarking;
+import org.onosproject.flowapi.DefaultExtTrafficRate;
+import org.onosproject.flowapi.DefaultExtTrafficRedirect;
+import org.onosproject.flowapi.DefaultExtWideCommunityInt;
+import org.onosproject.flowapi.ExtDscpValue;
+import org.onosproject.flowapi.ExtFlowTypes;
+import org.onosproject.flowapi.ExtFragment;
+import org.onosproject.flowapi.ExtIcmpCode;
+import org.onosproject.flowapi.ExtIcmpType;
+import org.onosproject.flowapi.ExtIpProtocol;
+import org.onosproject.flowapi.ExtKeyName;
+import org.onosproject.flowapi.ExtPacketLength;
+import org.onosproject.flowapi.ExtPort;
+import org.onosproject.flowapi.ExtPrefix;
+import org.onosproject.flowapi.ExtTarget;
+import org.onosproject.flowapi.ExtTcpFlag;
+import org.onosproject.flowapi.ExtTrafficAction;
+import org.onosproject.flowapi.ExtTrafficMarking;
+import org.onosproject.flowapi.ExtTrafficRate;
+import org.onosproject.flowapi.ExtTrafficRedirect;
+import org.onosproject.flowapi.ExtWideCommunityInt;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import static org.onlab.util.Tools.nullIsIllegal;
+
+/**
+ * Decode the Ext extension codec.
+ */
+public final class DecodeBgpFlowExtnCodecHelper {
+
+    private final ObjectNode json;
+
+    protected static final String MISSING_MEMBER_MESSAGE =
+            " member is required in ExtTypes";
+
+    protected static final String MALFORMED_MEMBER_MESSAGE =
+            " member is malformed";
+
+    private interface ExtensionDecoder {
+        ExtFlowTypes decodeExtension(ObjectNode json);
+    }
+
+    private final Map<String, ExtensionDecoder> decoderMap;
+
+    BgpParseAttributes parse = new BgpParseAttributes();
+
+    /**
+     * Creates a decode extension codec object.
+     * Initializes the lookup map for Bgp extension types.
+     *
+     * @param json JSON object to decode
+     */
+    public DecodeBgpFlowExtnCodecHelper(ObjectNode json) {
+        this.json = json;
+        decoderMap = new HashMap<>();
+
+        decoderMap.put(ExtFlowTypes.ExtType.IPV4_SRC_PFX.name(), new BgpSourcePrefixDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.IPV4_DST_PFX.name(), new BgpDestinationPrefixDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.EXT_FLOW_RULE_KEY.name(), new BgpFlowRuleKeyDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.IP_PROTO_LIST.name(), new BgpIpProtocolDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.IN_PORT_LIST.name(), new BgpInPortDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.DST_PORT_LIST.name(), new BgpDestinationPortDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.SRC_PORT_LIST.name(), new BgpSourcePortDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.ICMP_TYPE_LIST.name(), new BgpIcmpTypeDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.ICMP_CODE_LIST.name(), new BgpIcmpCodeDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.TCP_FLAG_LIST.name(), new BgpTcpFlagDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.PACKET_LENGTH_LIST.name(), new BgpPacketLengthDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.DSCP_VALUE_LIST.name(), new BgpDscpValueDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.FRAGMENT_LIST.name(), new BgpFragmentDecode());
+
+        decoderMap.put(ExtFlowTypes.ExtType.TRAFFIC_RATE.name(), new BgpTrafficRateDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.TRAFFIC_ACTION.name(), new BgpTrafficActionDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.TRAFFIC_REDIRECT.name(), new BgpTrafficRedirectDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.TRAFFIC_MARKING.name(), new BgpTrafficMarkingDecode());
+
+        decoderMap.put(ExtFlowTypes.ExtType.WIDE_COMM_FLAGS.name(), new BgpWcommFlagsDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.WIDE_COMM_HOP_COUNT.name(), new BgpWcommHopCountDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.WIDE_COMM_COMMUNITY.name(), new BgpWcommCommunityDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.WIDE_COMM_CONTEXT_AS.name(), new BgpWcommContextAsDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.WIDE_COMM_LOCAL_AS.name(), new BgpWcommLocalAsDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.WIDE_COMM_TARGET.name(), new BgpWcommTargetDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.WIDE_COMM_EXT_TARGET.name(), new BgpWcommExtTargetDecode());
+        decoderMap.put(ExtFlowTypes.ExtType.WIDE_COMM_PARAMETER.name(), new BgpWcommParameterDecode());
+    }
+
+    /** Source prefix decoder.*/
+    private class BgpSourcePrefixDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtPrefix.Builder resultBuilder = new DefaultExtPrefix.Builder();
+
+            String ip = nullIsIllegal(json.get(BgpFlowExtensionCodec.PREFIX),
+                    BgpFlowExtensionCodec.PREFIX + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setPrefix(IpPrefix.valueOf(ip));
+            resultBuilder.setType(ExtFlowTypes.ExtType.IPV4_SRC_PFX);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Destination prefix decoder.*/
+    private class BgpDestinationPrefixDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtPrefix.Builder resultBuilder = new DefaultExtPrefix.Builder();
+
+            String ip = nullIsIllegal(json.get(BgpFlowExtensionCodec.PREFIX),
+                    BgpFlowExtensionCodec.PREFIX + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setPrefix(IpPrefix.valueOf(ip));
+            resultBuilder.setType(ExtFlowTypes.ExtType.IPV4_DST_PFX);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Flow rule key decoder.*/
+    private class BgpFlowRuleKeyDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtKeyName.Builder resultBuilder = new DefaultExtKeyName.Builder();
+
+            String name = nullIsIllegal(json.get(BgpFlowExtensionCodec.NAME),
+                    BgpFlowExtensionCodec.NAME + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setKeyName(name);
+            resultBuilder.setType(ExtFlowTypes.ExtType.EXT_FLOW_RULE_KEY);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Ip protocol decoder.*/
+    private class BgpIpProtocolDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtIpProtocol.Builder resultBuilder = new DefaultExtIpProtocol.Builder();
+
+            String protocols = nullIsIllegal(json.get(BgpFlowExtensionCodec.PROTOCOLS),
+                    BgpFlowExtensionCodec.PROTOCOLS + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setIpProtocol(parse.parseIpProtocol(protocols));
+            resultBuilder.setType(ExtFlowTypes.ExtType.IP_PROTO_LIST);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** In port decoder.*/
+    private class BgpInPortDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtPort.Builder resultBuilder = new DefaultExtPort.Builder();
+
+            String portList = nullIsIllegal(json.get(BgpFlowExtensionCodec.PORT),
+                    BgpFlowExtensionCodec.PORT + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setPort(parse.parsePort(portList));
+            resultBuilder.setType(ExtFlowTypes.ExtType.IN_PORT_LIST);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Destination decoder.*/
+    private class BgpDestinationPortDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtPort.Builder resultBuilder = new DefaultExtPort.Builder();
+
+            String portList = nullIsIllegal(json.get(BgpFlowExtensionCodec.DST_PORT),
+                    BgpFlowExtensionCodec.DST_PORT + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setPort(parse.parsePort(portList));
+            resultBuilder.setType(ExtFlowTypes.ExtType.DST_PORT_LIST);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Source decoder.*/
+    private class BgpSourcePortDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtPort.Builder resultBuilder = new DefaultExtPort.Builder();
+
+            String portList = nullIsIllegal(json.get(BgpFlowExtensionCodec.SRC_PORT),
+                    BgpFlowExtensionCodec.SRC_PORT + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setPort(parse.parsePort(portList));
+            resultBuilder.setType(ExtFlowTypes.ExtType.SRC_PORT_LIST);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Icmp type decoder.*/
+    private class BgpIcmpTypeDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtIcmpType.Builder resultBuilder = new DefaultExtIcmpType.Builder();
+
+            String icmpType = nullIsIllegal(json.get(BgpFlowExtensionCodec.ICMP_TYPE),
+                    BgpFlowExtensionCodec.ICMP_TYPE + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setIcmpType(parse.parseIcmpType(icmpType));
+            resultBuilder.setType(ExtFlowTypes.ExtType.ICMP_TYPE_LIST);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Icmp code decoder.*/
+    private class BgpIcmpCodeDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtIcmpCode.Builder resultBuilder = new DefaultExtIcmpCode.Builder();
+
+            String icmpCode = nullIsIllegal(json.get(BgpFlowExtensionCodec.ICMP_CODE),
+                    BgpFlowExtensionCodec.ICMP_CODE + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setIcmpCode(parse.parseIcmpCode(icmpCode));
+            resultBuilder.setType(ExtFlowTypes.ExtType.ICMP_CODE_LIST);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Tcp flag decoder.*/
+    private class BgpTcpFlagDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtTcpFlag.Builder resultBuilder = new DefaultExtTcpFlag.Builder();
+
+            String tcpFlag = nullIsIllegal(json.get(BgpFlowExtensionCodec.TCP_FLAG),
+                    BgpFlowExtensionCodec.TCP_FLAG + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setTcpFlag(parse.parseTcpFlags(tcpFlag));
+            resultBuilder.setType(ExtFlowTypes.ExtType.TCP_FLAG_LIST);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Packet length decoder.*/
+    private class BgpPacketLengthDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtPacketLength.Builder resultBuilder = new DefaultExtPacketLength.Builder();
+
+            String packetLength = nullIsIllegal(json.get(BgpFlowExtensionCodec.PACKET_LENGTH),
+                    BgpFlowExtensionCodec.PACKET_LENGTH + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setPacketLength(parse.parsePacketLength(packetLength));
+            resultBuilder.setType(ExtFlowTypes.ExtType.PACKET_LENGTH_LIST);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Dscp value decoder.*/
+    private class BgpDscpValueDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtDscpValue.Builder resultBuilder = new DefaultExtDscpValue.Builder();
+
+            String dscpValue = nullIsIllegal(json.get(BgpFlowExtensionCodec.DSCP_VALUE),
+                    BgpFlowExtensionCodec.DSCP_VALUE + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setDscpValue(parse.parseDscp(dscpValue));
+            resultBuilder.setType(ExtFlowTypes.ExtType.DSCP_VALUE_LIST);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Fragment decoder.*/
+    private class BgpFragmentDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtFragment.Builder resultBuilder = new DefaultExtFragment.Builder();
+
+            String fragment = nullIsIllegal(json.get(BgpFlowExtensionCodec.FRAGMENT),
+                    BgpFlowExtensionCodec.FRAGMENT + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setFragment(parse.parseFragment(fragment));
+            resultBuilder.setType(ExtFlowTypes.ExtType.FRAGMENT_LIST);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Traffic rate decoder.*/
+    private class BgpTrafficRateDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtTrafficRate.Builder resultBuilder = new DefaultExtTrafficRate.Builder();
+
+            String rate = nullIsIllegal(json.get(BgpFlowExtensionCodec.TRAFFIC_RATE),
+                    BgpFlowExtensionCodec.TRAFFIC_RATE + MISSING_MEMBER_MESSAGE).asText();
+
+            String[] commaPart = rate.split(",");
+            String[] valuePart = commaPart[0].split("=");
+
+            if (valuePart[0].matches(BgpFlowExtensionCodec.TRAFFIC_RATE_ASN)) {
+                short s = Short.decode(valuePart[1].trim()).shortValue();
+                resultBuilder.setAsn(s);
+            } else {
+                nullIsIllegal(valuePart[0], BgpFlowExtensionCodec.TRAFFIC_RATE + MALFORMED_MEMBER_MESSAGE);
+            }
+
+            valuePart = commaPart[1].split("=");
+            if (valuePart[0].matches(BgpFlowExtensionCodec.TRAFFIC_RATE_RATE)) {
+                float f = Float.parseFloat(valuePart[1].trim());
+                resultBuilder.setRate(f);
+            } else {
+                nullIsIllegal(valuePart[0], BgpFlowExtensionCodec.TRAFFIC_RATE + MALFORMED_MEMBER_MESSAGE);
+            }
+
+            resultBuilder.setType(ExtFlowTypes.ExtType.TRAFFIC_RATE);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Traffic action decoder.*/
+    private class BgpTrafficActionDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtTrafficAction.Builder resultBuilder = new DefaultExtTrafficAction.Builder();
+
+            String rate = nullIsIllegal(json.get(BgpFlowExtensionCodec.TRAFFIC_ACTION),
+                    BgpFlowExtensionCodec.TRAFFIC_ACTION + MISSING_MEMBER_MESSAGE).asText();
+
+            String[] commaPart = rate.split(",");
+            String[] valuePart = commaPart[0].split("=");
+
+            if (valuePart[0].matches(BgpFlowExtensionCodec.TRAFFIC_ACTION_TERMINAL)) {
+                boolean terminal = Boolean.parseBoolean(valuePart[1].trim());
+                resultBuilder.setTerminal(terminal);
+            } else {
+                nullIsIllegal(valuePart[0], BgpFlowExtensionCodec.TRAFFIC_ACTION_TERMINAL + MISSING_MEMBER_MESSAGE);
+            }
+
+            valuePart = commaPart[1].split("=");
+            if (valuePart[0].matches(BgpFlowExtensionCodec.TRAFFIC_ACTION_SAMPLE)) {
+                boolean sample = Boolean.parseBoolean(valuePart[1].trim());
+                resultBuilder.setSample(sample);
+            } else {
+                nullIsIllegal(valuePart[0], BgpFlowExtensionCodec.TRAFFIC_ACTION_SAMPLE + MISSING_MEMBER_MESSAGE);
+            }
+
+            valuePart = commaPart[2].split("=");
+            if (valuePart[0].matches(BgpFlowExtensionCodec.TRAFFIC_ACTION_RPD)) {
+                boolean rpd = Boolean.parseBoolean(valuePart[1].trim());
+                resultBuilder.setRpd(rpd);
+            } else {
+                nullIsIllegal(valuePart[0], BgpFlowExtensionCodec.TRAFFIC_ACTION_RPD + MISSING_MEMBER_MESSAGE);
+            }
+
+            resultBuilder.setType(ExtFlowTypes.ExtType.TRAFFIC_ACTION);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Traffic redirect decoder.*/
+    private class BgpTrafficRedirectDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtTrafficRedirect.Builder resultBuilder = new DefaultExtTrafficRedirect.Builder();
+
+            String action = nullIsIllegal(json.get(BgpFlowExtensionCodec.TRAFFIC_REDIRECTION),
+                    BgpFlowExtensionCodec.TRAFFIC_REDIRECTION + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setRedirect(action);
+            resultBuilder.setType(ExtFlowTypes.ExtType.TRAFFIC_REDIRECT);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Traffic marking decoder.*/
+    private class BgpTrafficMarkingDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtTrafficMarking.Builder resultBuilder = new DefaultExtTrafficMarking.Builder();
+
+            String action = nullIsIllegal(json.get(BgpFlowExtensionCodec.TRAFFIC_MARKING),
+                    BgpFlowExtensionCodec.TRAFFIC_MARKING + MISSING_MEMBER_MESSAGE).asText();
+
+            if ((action.length() != 1) || action.isEmpty()) {
+                nullIsIllegal(action, BgpFlowExtensionCodec.TRAFFIC_MARKING + MALFORMED_MEMBER_MESSAGE);
+            }
+
+            resultBuilder.setMarking((byte) action.charAt(0));
+            resultBuilder.setType(ExtFlowTypes.ExtType.TRAFFIC_MARKING);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Wide community flag decoder.*/
+    private class BgpWcommFlagsDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtWideCommunityInt.Builder resultBuilder = new DefaultExtWideCommunityInt.Builder();
+
+            String wideComm = nullIsIllegal(json.get(BgpFlowExtensionCodec.WIDE_COMM_FLAGS),
+                    BgpFlowExtensionCodec.WIDE_COMM_FLAGS + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setwCommInt(Integer.valueOf(wideComm));
+            resultBuilder.setType(ExtFlowTypes.ExtType.WIDE_COMM_FLAGS);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Wide community hop count decoder.*/
+    private class BgpWcommHopCountDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtWideCommunityInt.Builder resultBuilder = new DefaultExtWideCommunityInt.Builder();
+
+            String wideComm = nullIsIllegal(json.get(BgpFlowExtensionCodec.WIDE_COMM_HOP_COUNT),
+                    BgpFlowExtensionCodec.WIDE_COMM_HOP_COUNT + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setwCommInt(Integer.valueOf(wideComm));
+            resultBuilder.setType(ExtFlowTypes.ExtType.WIDE_COMM_HOP_COUNT);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Wide community decoder.*/
+    private class BgpWcommCommunityDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtWideCommunityInt.Builder resultBuilder = new DefaultExtWideCommunityInt.Builder();
+
+            String wideComm = nullIsIllegal(json.get(BgpFlowExtensionCodec.WIDE_COMM_COMMUNITY),
+                    BgpFlowExtensionCodec.WIDE_COMM_COMMUNITY + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setwCommInt(Integer.valueOf(wideComm));
+            resultBuilder.setType(ExtFlowTypes.ExtType.WIDE_COMM_COMMUNITY);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Wide community context AS decoder.*/
+    private class BgpWcommContextAsDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtWideCommunityInt.Builder resultBuilder = new DefaultExtWideCommunityInt.Builder();
+
+            String wideComm = nullIsIllegal(json.get(BgpFlowExtensionCodec.WIDE_COMM_CONTEXT_AS),
+                    BgpFlowExtensionCodec.WIDE_COMM_CONTEXT_AS + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setwCommInt(Integer.valueOf(wideComm));
+            resultBuilder.setType(ExtFlowTypes.ExtType.WIDE_COMM_CONTEXT_AS);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Wide community local AS decoder.*/
+    private class BgpWcommLocalAsDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtWideCommunityInt.Builder resultBuilder = new DefaultExtWideCommunityInt.Builder();
+
+            String wideComm = nullIsIllegal(json.get(BgpFlowExtensionCodec.WIDE_COMM_LOCAL_AS),
+                    BgpFlowExtensionCodec.WIDE_COMM_LOCAL_AS + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setwCommInt(Integer.valueOf(wideComm));
+            resultBuilder.setType(ExtFlowTypes.ExtType.WIDE_COMM_LOCAL_AS);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Wide community parameter decoder.*/
+    private class BgpWcommParameterDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtWideCommunityInt.Builder resultBuilder = new DefaultExtWideCommunityInt.Builder();
+
+            String wideComm = nullIsIllegal(json.get(BgpFlowExtensionCodec.WIDE_COMM_PARAMETER),
+                    BgpFlowExtensionCodec.WIDE_COMM_PARAMETER + MISSING_MEMBER_MESSAGE).asText();
+            resultBuilder.setwCommInt(Integer.valueOf(wideComm));
+            resultBuilder.setType(ExtFlowTypes.ExtType.WIDE_COMM_PARAMETER);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Wide community target decoder.*/
+    private class BgpWcommTargetDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtTarget.Builder resultBuilder = new DefaultExtTarget.Builder();
+
+            JsonNode jsonNodes = json.get(BgpFlowExtensionCodec.WIDE_COMM_TARGET);
+            if (jsonNodes == null) {
+                nullIsIllegal(json.get(BgpFlowExtensionCodec.WIDE_COMM_TARGET),
+                        BgpFlowExtensionCodec.WIDE_COMM_TARGET + MISSING_MEMBER_MESSAGE).asText();
+            }
+
+            JsonNode array = jsonNodes.path(BgpFlowExtensionCodec.WIDE_COMM_TGT_LOCAL_SP);
+            if (array == null) {
+                nullIsIllegal(array, BgpFlowExtensionCodec.WIDE_COMM_TGT_LOCAL_SP + MISSING_MEMBER_MESSAGE).asText();
+            }
+
+            ExtPrefix.Builder resultBuilderPfx = parseIpArrayToPrefix(array);
+            resultBuilderPfx.setType(ExtFlowTypes.ExtType.IPV4_SRC_PFX);
+            resultBuilder.setLocalSpeaker(resultBuilderPfx.build());
+
+            array = jsonNodes.path(BgpFlowExtensionCodec.WIDE_COMM_TGT_REMOTE_SP);
+            if (array == null) {
+                nullIsIllegal(array, BgpFlowExtensionCodec.WIDE_COMM_TGT_REMOTE_SP + MISSING_MEMBER_MESSAGE).asText();
+            }
+
+            resultBuilderPfx = parseIpArrayToPrefix(array);
+            resultBuilderPfx.setType(ExtFlowTypes.ExtType.IPV4_DST_PFX);
+            resultBuilder.setRemoteSpeaker(resultBuilderPfx.build());
+            resultBuilder.setType(ExtFlowTypes.ExtType.WIDE_COMM_TARGET);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Wide community extended target decoder.*/
+    private class BgpWcommExtTargetDecode implements ExtensionDecoder {
+        @Override
+        public ExtFlowTypes decodeExtension(ObjectNode json) {
+            if (json == null || !json.isObject()) {
+                return null;
+            }
+
+            ExtTarget.Builder resultBuilder = new DefaultExtTarget.Builder();
+
+            JsonNode jsonNodes = json.get(BgpFlowExtensionCodec.WIDE_COMM_EXT_TARGET);
+            if (jsonNodes == null) {
+                nullIsIllegal(json.get(BgpFlowExtensionCodec.WIDE_COMM_EXT_TARGET),
+                        BgpFlowExtensionCodec.WIDE_COMM_EXT_TARGET + MISSING_MEMBER_MESSAGE).asText();
+            }
+
+            JsonNode array = jsonNodes.path(BgpFlowExtensionCodec.WIDE_COMM_TGT_LOCAL_SP);
+            if (array == null) {
+                nullIsIllegal(array, BgpFlowExtensionCodec.WIDE_COMM_TGT_LOCAL_SP + MISSING_MEMBER_MESSAGE).asText();
+            }
+
+            ExtPrefix.Builder resultBuilderPfx = parseIpArrayToPrefix(array);
+            resultBuilderPfx.setType(ExtFlowTypes.ExtType.IPV4_SRC_PFX);
+            resultBuilder.setLocalSpeaker(resultBuilderPfx.build());
+
+            array = jsonNodes.path(BgpFlowExtensionCodec.WIDE_COMM_TGT_REMOTE_SP);
+            if (array == null) {
+                nullIsIllegal(array, BgpFlowExtensionCodec.WIDE_COMM_TGT_REMOTE_SP + MISSING_MEMBER_MESSAGE).asText();
+            }
+
+            resultBuilderPfx = parseIpArrayToPrefix(array);
+            resultBuilderPfx.setType(ExtFlowTypes.ExtType.IPV4_DST_PFX);
+            resultBuilder.setRemoteSpeaker(resultBuilderPfx.build());
+            resultBuilder.setType(ExtFlowTypes.ExtType.WIDE_COMM_EXT_TARGET);
+
+            return resultBuilder.build();
+        }
+    }
+
+    /** Ip address parser decoder.*/
+    public ExtPrefix.Builder parseIpArrayToPrefix(JsonNode array) {
+
+        ExtPrefix.Builder resultBuilder = new DefaultExtPrefix.Builder();
+        String ip;
+        IpPrefix prefix;
+        IpAddress ipAddr;
+
+        Iterator<JsonNode> itr =  array.iterator();
+        while (itr.hasNext()) {
+            ip = itr.next().asText();
+            ipAddr = IpAddress.valueOf(ip);
+            prefix = IpPrefix.valueOf(ipAddr, 32);
+            resultBuilder.setPrefix(prefix);
+        }
+
+        return resultBuilder;
+    }
+
+    /**
+     * Decodes the JSON into a BgpFlowType extension object.
+     *
+     * @return ExtFlowTypes object
+     * @throws IllegalArgumentException if the JSON is invalid
+     */
+    public ExtFlowTypes decode() {
+        String type = json.get(BgpFlowExtensionCodec.TYPE).asText();
+
+        ExtensionDecoder decoder = decoderMap.get(type);
+        if (decoder != null) {
+            return decoder.decodeExtension(json);
+        }
+
+        throw new IllegalArgumentException("Type " + type + " is unknown");
+    }
+}
diff --git a/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/web/package-info.java b/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/web/package-info.java
new file mode 100755
index 0000000..2f6d844
--- /dev/null
+++ b/apps/bgpflowspec/bgpweb/src/main/java/org/onosproject/bgpweb/web/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-prensent 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.
+ */
+
+/**
+ * Codec for bgp flow.
+ */
+package org.onosproject.bgpweb.web;
diff --git a/apps/bgpflowspec/bgpweb/src/main/webapp/WEB-INF/web.xml b/apps/bgpflowspec/bgpweb/src/main/webapp/WEB-INF/web.xml
new file mode 100755
index 0000000..2a13327
--- /dev/null
+++ b/apps/bgpflowspec/bgpweb/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2016-present 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.
+  -->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         id="ONOS" version="2.5">
+    <display-name>BGP REST API v1.0</display-name>
+
+
+    <servlet>
+        <servlet-name>JAX-RS Service</servlet-name>
+        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
+        <init-param>
+            <param-name>javax.ws.rs.Application</param-name>
+            <param-value>org.onosproject.bgpweb.resources.BgpWebApplication</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>JAX-RS Service</servlet-name>
+        <url-pattern>/*</url-pattern>
+    </servlet-mapping>
+</web-app>
diff --git a/apps/bgpflowspec/flowapi/BUCK b/apps/bgpflowspec/flowapi/BUCK
new file mode 100755
index 0000000..2686bce
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/BUCK
@@ -0,0 +1,19 @@
+COMPILE_DEPS = [
+    '//utils/osgi:onlab-osgi',
+    '//utils/misc:onlab-misc',
+    '//lib:commons-io',
+    '//lib:guava',
+    '//lib:kryo',
+    '//lib:slf4j-api',
+]
+
+TEST_DEPS = [
+    '//lib:TEST_ADAPTERS',
+]
+
+osgi_jar_with_tests (
+    name = 'onos-apps-bgpflowspec-flowapi',
+    deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
+    visibility = ['PUBLIC'],
+)
diff --git a/apps/bgpflowspec/flowapi/pom.xml b/apps/bgpflowspec/flowapi/pom.xml
new file mode 100755
index 0000000..01cb23b
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2016-present 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-app-bgpflow</artifactId>
+        <version>1.6.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>onos-app-bgp-flowapi</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>api bundle to be accessible across the layers</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onlab-misc</artifactId>
+            <version>1.6.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava-testlib</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtDscpValue.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtDscpValue.java
new file mode 100755
index 0000000..987c455
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtDscpValue.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.List;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * DSCP value extension implementation.
+ */
+public class DefaultExtDscpValue implements ExtDscpValue {
+
+    private List<ExtOperatorValue> dscpValue;
+    private ExtType type;
+
+    /**
+     * Creates an object of type DefaultExtDscpValue which contains dscp operator value list.
+     *
+     * @param dscpValue is a dscp value rule list
+     * @param type ExtType type
+     */
+    DefaultExtDscpValue(List<ExtOperatorValue> dscpValue, ExtType type) {
+        this.dscpValue = dscpValue;
+        this.type = type;
+    }
+
+    @Override
+    public ExtType type() {
+        return type;
+    }
+
+    @Override
+    public List<ExtOperatorValue> dscpValue() {
+        return dscpValue;
+    }
+
+    @Override
+    public boolean exactMatch(ExtDscpValue value) {
+        return this.equals(value) &&
+                Objects.equals(this.dscpValue, value.dscpValue())
+                && Objects.equals(this.type, value.type());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(dscpValue, type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DefaultExtDscpValue) {
+            DefaultExtDscpValue that = (DefaultExtDscpValue) obj;
+            return Objects.equals(dscpValue, that.dscpValue())
+                    && Objects.equals(this.type, that.type());
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("dscpValue", dscpValue.toString())
+                .add("type", type.toString())
+                .toString();
+    }
+
+    /**
+     * Builder class for extension dscp value.
+     */
+    public static class Builder implements ExtDscpValue.Builder {
+        private List<ExtOperatorValue> dscpValue;
+        private ExtType type;
+
+        @Override
+        public Builder setDscpValue(List<ExtOperatorValue> dscpValue) {
+            this.dscpValue = dscpValue;
+            return this;
+        }
+
+        @Override
+        public Builder setType(ExtType type) {
+            this.type = type;
+            return this;
+        }
+
+        @Override
+        public ExtDscpValue build() {
+            checkNotNull(dscpValue, "dscpValue cannot be null");
+            return new DefaultExtDscpValue(dscpValue, type);
+        }
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtFragment.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtFragment.java
new file mode 100755
index 0000000..fba5446
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtFragment.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.List;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Fragment extension implementation.
+ */
+public class DefaultExtFragment implements ExtFragment {
+
+    private List<ExtOperatorValue> fragment;
+    private ExtType type;
+
+    /**
+     * Creates an object of type DefaultExtFragment which contains fragment operator value list.
+     *
+     * @param fragment is a fragment value rule list
+     * @param type ExtType type
+     */
+    DefaultExtFragment(List<ExtOperatorValue> fragment, ExtType type) {
+        this.fragment = fragment;
+        this.type = type;
+    }
+
+    @Override
+    public ExtType type() {
+        return type;
+    }
+
+    @Override
+    public List<ExtOperatorValue> fragment() {
+        return fragment;
+    }
+
+    @Override
+    public boolean exactMatch(ExtFragment value) {
+        return this.equals(value) &&
+                Objects.equals(this.fragment, value.fragment())
+                && Objects.equals(this.type, value.type());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(fragment, type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DefaultExtFragment) {
+            DefaultExtFragment that = (DefaultExtFragment) obj;
+            return Objects.equals(fragment, that.fragment())
+                    && Objects.equals(this.type, that.type());
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("fragment", fragment.toString())
+                .add("type", type.toString())
+                .toString();
+    }
+
+    /**
+     * Builder class for extension fragment value.
+     */
+    public static class Builder implements ExtFragment.Builder {
+        private List<ExtOperatorValue> fragment;
+        private ExtType type;
+
+        @Override
+        public Builder setFragment(List<ExtOperatorValue> fragment) {
+            this.fragment = fragment;
+            return this;
+        }
+
+        @Override
+        public Builder setType(ExtType type) {
+            this.type = type;
+            return this;
+        }
+
+        @Override
+        public ExtFragment build() {
+            checkNotNull(fragment, "fragment cannot be null");
+            return new DefaultExtFragment(fragment, type);
+        }
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtIcmpCode.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtIcmpCode.java
new file mode 100755
index 0000000..46632d5
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtIcmpCode.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.List;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Icmp code extension implementation.
+ */
+public class DefaultExtIcmpCode implements ExtIcmpCode {
+
+    private List<ExtOperatorValue> icmpCode;
+    private ExtType type;
+
+    /**
+     * Creates an object of type DefaultExtIcmpCode which contains ICMP code operator value list.
+     *
+     * @param icmpCode is a icmp code rule list
+     * @param type ExtType type
+     */
+    DefaultExtIcmpCode(List<ExtOperatorValue> icmpCode, ExtType type) {
+        this.icmpCode = icmpCode;
+        this.type = type;
+    }
+
+    @Override
+    public ExtType type() {
+        return type;
+    }
+
+    @Override
+    public List<ExtOperatorValue> icmpCode() {
+        return icmpCode;
+    }
+
+    @Override
+    public boolean exactMatch(ExtIcmpCode icmpCode) {
+        return this.equals(icmpCode) &&
+                Objects.equals(this.icmpCode, icmpCode.icmpCode())
+                && Objects.equals(this.type, icmpCode.type());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(icmpCode, type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DefaultExtIcmpCode) {
+            DefaultExtIcmpCode that = (DefaultExtIcmpCode) obj;
+            return Objects.equals(icmpCode, that.icmpCode())
+                    && Objects.equals(this.type, that.type());
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("icmpCode", icmpCode.toString())
+                .add("type", type.toString())
+                .toString();
+    }
+
+    /**
+     * Builder class for extension icmp type.
+     */
+    public static class Builder implements ExtIcmpCode.Builder {
+        private List<ExtOperatorValue> icmpCode;
+        private ExtType type;
+
+        @Override
+        public Builder setIcmpCode(List<ExtOperatorValue> icmpCode) {
+            this.icmpCode = icmpCode;
+            return this;
+        }
+
+        @Override
+        public Builder setType(ExtType type) {
+            this.type = type;
+            return this;
+        }
+
+        @Override
+        public ExtIcmpCode build() {
+            checkNotNull(icmpCode, "icmpCode cannot be null");
+            return new DefaultExtIcmpCode(icmpCode, type);
+        }
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtIcmpType.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtIcmpType.java
new file mode 100755
index 0000000..3b5d723
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtIcmpType.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.List;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Icmp type extension implementation.
+ */
+public class DefaultExtIcmpType implements ExtIcmpType {
+
+    private List<ExtOperatorValue> icmpType;
+    private ExtType type;
+
+    /**
+     * Creates an object of type DefaultExtIcmpType which contains ICMP type operator value list.
+     *
+     * @param icmpType is a icmp type rule list
+     * @param type ExtType type
+     */
+    DefaultExtIcmpType(List<ExtOperatorValue> icmpType, ExtType type) {
+        this.icmpType = icmpType;
+        this.type = type;
+    }
+
+    @Override
+    public ExtType type() {
+        return type;
+    }
+
+    @Override
+    public List<ExtOperatorValue> icmpType() {
+        return icmpType;
+    }
+
+    @Override
+    public boolean exactMatch(ExtIcmpType icmpType) {
+        return this.equals(icmpType) &&
+                Objects.equals(this.icmpType, icmpType.icmpType())
+                && Objects.equals(this.type, icmpType.type());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(icmpType, type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DefaultExtIcmpType) {
+            DefaultExtIcmpType that = (DefaultExtIcmpType) obj;
+            return Objects.equals(icmpType, that.icmpType())
+                    && Objects.equals(this.type, that.type());
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("icmpType", icmpType.toString())
+                .add("type", type.toString())
+                .toString();
+    }
+
+    /**
+     * Builder class for extension icmp type.
+     */
+    public static class Builder implements ExtIcmpType.Builder {
+        private List<ExtOperatorValue> icmpType;
+        private ExtType type;
+
+        @Override
+        public Builder setIcmpType(List<ExtOperatorValue> icmpType) {
+            this.icmpType = icmpType;
+            return this;
+        }
+
+        @Override
+        public Builder setType(ExtType type) {
+            this.type = type;
+            return this;
+        }
+
+        @Override
+        public ExtIcmpType build() {
+            checkNotNull(icmpType, "icmpType cannot be null");
+            return new DefaultExtIcmpType(icmpType, type);
+        }
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtIpProtocol.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtIpProtocol.java
new file mode 100755
index 0000000..d1e0e22
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtIpProtocol.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.List;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Ip protocol extension implementation.
+ */
+public final class DefaultExtIpProtocol implements ExtIpProtocol {
+
+    private List<ExtOperatorValue> ipProtocol;
+    private ExtType type;
+
+    /**
+     * Creates an object of type DefaultExtIpProtocol which contains Ip protocol list.
+     *
+     * @param ipProtocol Ip protocol operator value list
+     * @param type BgpType type
+     */
+    DefaultExtIpProtocol(List<ExtOperatorValue> ipProtocol, ExtType type) {
+        this.ipProtocol = ipProtocol;
+        this.type = type;
+    }
+
+    @Override
+    public ExtType type() {
+        return type;
+    }
+
+    @Override
+    public List<ExtOperatorValue> ipProtocol() {
+        return ipProtocol;
+    }
+
+    @Override
+    public boolean exactMatch(ExtIpProtocol ipProto) {
+        return this.equals(ipProto) &&
+                Objects.equals(this.ipProtocol, ipProto.ipProtocol())
+                && Objects.equals(this.type, ipProto.type());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(ipProtocol, type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DefaultExtIpProtocol) {
+            DefaultExtIpProtocol that = (DefaultExtIpProtocol) obj;
+            return Objects.equals(ipProtocol, that.ipProtocol())
+                    && Objects.equals(this.type, that.type);
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("ipProtocol", ipProtocol.toString())
+                .add("type", type.toString())
+                .toString();
+    }
+
+    /**
+     * Builder class for extension Ip protocol.
+     */
+    public static class Builder implements ExtIpProtocol.Builder {
+        private List<ExtOperatorValue> ipProtocol;
+        private ExtType type;
+
+        @Override
+        public Builder setIpProtocol(List<ExtOperatorValue> ipProtocol) {
+            this.ipProtocol = ipProtocol;
+            return this;
+        }
+
+        @Override
+        public Builder setType(ExtType type) {
+            this.type = type;
+            return this;
+        }
+
+        @Override
+        public ExtIpProtocol build() {
+            checkNotNull(ipProtocol, "Ip protocol cannot be null");
+            return new DefaultExtIpProtocol(ipProtocol, type);
+        }
+    }
+}
+
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtKeyName.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtKeyName.java
new file mode 100755
index 0000000..0b9e18d
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtKeyName.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.Objects;
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Key Name for the extension implementation.
+ */
+public class DefaultExtKeyName implements ExtKeyName {
+
+    private String keyName;
+    private ExtType type;
+
+    /**
+     * Creates an object of type DefaultExtKeyName which name for the flow rule.
+     *
+     * @param keyName is a key for the extended rule
+     * @param type ExtType type
+     */
+    DefaultExtKeyName(String keyName, ExtType type) {
+        this.keyName = keyName;
+        this.type = type;
+    }
+
+    @Override
+    public ExtType type() {
+        return type;
+    }
+
+    @Override
+    public String keyName() {
+        return keyName;
+    }
+
+    @Override
+    public boolean exactMatch(ExtKeyName value) {
+        return this.equals(value) &&
+                Objects.equals(this.keyName, value.keyName())
+                && Objects.equals(this.type, value.type());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(keyName, type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DefaultExtKeyName) {
+            DefaultExtKeyName that = (DefaultExtKeyName) obj;
+            return Objects.equals(keyName, that.keyName())
+                    && Objects.equals(this.type, that.type());
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("keyName", keyName.toString())
+                .add("type", type.toString())
+                .toString();
+    }
+
+    /**
+     * Builder class for Extended key name for the rule.
+     */
+    public static class Builder implements ExtKeyName.Builder {
+        private String keyName;
+        private ExtType type;
+
+        @Override
+        public Builder setKeyName(String keyName) {
+            this.keyName = keyName;
+            return this;
+        }
+
+        @Override
+        public Builder setType(ExtType type) {
+            this.type = type;
+            return this;
+        }
+
+        @Override
+        public ExtKeyName build() {
+            checkNotNull(keyName, "keyName cannot be null");
+            return new DefaultExtKeyName(keyName, type);
+        }
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtPacketLength.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtPacketLength.java
new file mode 100755
index 0000000..3d3c501
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtPacketLength.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.List;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Packet length extension implementation.
+ */
+public class DefaultExtPacketLength implements ExtPacketLength {
+
+    private List<ExtOperatorValue> packetLength;
+    private ExtType type;
+
+    /**
+     * Creates an object of type DefaultExtPacketLength which contains packet length list..
+     *
+     * @param packetLength is a packet length rule
+     * @param type ExtType type
+     */
+    DefaultExtPacketLength(List<ExtOperatorValue> packetLength, ExtType type) {
+        this.packetLength = packetLength;
+        this.type = type;
+    }
+
+    @Override
+    public ExtType type() {
+        return type;
+    }
+
+    @Override
+    public List<ExtOperatorValue> packetLength() {
+        return packetLength;
+    }
+
+    @Override
+    public boolean exactMatch(ExtPacketLength length) {
+        return this.equals(packetLength) &&
+                Objects.equals(this.packetLength, length.packetLength())
+                && Objects.equals(this.type, length.type());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(packetLength, type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DefaultExtPacketLength) {
+            DefaultExtPacketLength that = (DefaultExtPacketLength) obj;
+            return Objects.equals(packetLength, that.packetLength())
+                    && Objects.equals(this.type, that.type());
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("packetLength", packetLength.toString())
+                .add("type", type.toString())
+                .toString();
+    }
+
+    /**
+     * Builder class for extension packet length.
+     */
+    public static class Builder implements ExtPacketLength.Builder {
+        private List<ExtOperatorValue> packetLength;
+        private ExtType type;
+
+        @Override
+        public Builder setPacketLength(List<ExtOperatorValue> packetLength) {
+            this.packetLength = packetLength;
+            return this;
+        }
+
+        @Override
+        public Builder setType(ExtType type) {
+            this.type = type;
+            return this;
+        }
+
+        @Override
+        public ExtPacketLength build() {
+            checkNotNull(packetLength, "packetLength cannot be null");
+            return new DefaultExtPacketLength(packetLength, type);
+        }
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtPort.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtPort.java
new file mode 100755
index 0000000..65c7297
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtPort.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.List;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Port extension implementation.
+ */
+public class DefaultExtPort implements ExtPort {
+
+    private List<ExtOperatorValue> port;
+    private ExtType type;
+
+    /**
+     * Creates an object of type DefaultExtPort which contains port list.
+     *
+     * @param port is a port rule list
+     * @param type ExtType type
+     */
+    DefaultExtPort(List<ExtOperatorValue> port, ExtType type) {
+        this.port = port;
+        this.type = type;
+    }
+
+    @Override
+    public ExtType type() {
+        return type;
+    }
+
+    @Override
+    public List<ExtOperatorValue> port() {
+        return port;
+    }
+
+    @Override
+    public boolean exactMatch(ExtPort port) {
+        return this.equals(port) &&
+                Objects.equals(this.port, port.port())
+                && Objects.equals(this.type, port.type());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(port, type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DefaultExtPort) {
+            DefaultExtPort that = (DefaultExtPort) obj;
+            return Objects.equals(port, that.port())
+                    && Objects.equals(this.type, that.type());
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("port", port.toString())
+                .add("type", type.toString())
+                .toString();
+    }
+
+    /**
+     * Builder class for extension port.
+     */
+    public static class Builder implements ExtPort.Builder {
+        private List<ExtOperatorValue> port;
+        private ExtType type;
+
+        @Override
+        public Builder setPort(List<ExtOperatorValue> port) {
+            this.port = port;
+            return this;
+        }
+
+        @Override
+        public Builder setType(ExtType type) {
+            this.type = type;
+            return this;
+        }
+
+        @Override
+        public ExtPort build() {
+            checkNotNull(port, "port cannot be null");
+            return new DefaultExtPort(port, type);
+        }
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtPrefix.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtPrefix.java
new file mode 100755
index 0000000..4b152d2
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtPrefix.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import org.onlab.packet.IpPrefix;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Ip prefix extension implementation.
+ */
+public final class DefaultExtPrefix implements ExtPrefix {
+
+    private List<IpPrefix> prefix;
+    private ExtType type;
+
+    /**
+     * Creates an object of type DefaultExtPrefix which contains Ip prefix list.
+     *
+     * @param prefix Ip prefix list
+     * @param type ExtType type
+     */
+    DefaultExtPrefix(List<IpPrefix> prefix, ExtType type) {
+        this.prefix = prefix;
+        this.type = type;
+    }
+
+    @Override
+    public ExtType type() {
+        return type;
+    }
+
+    @Override
+    public List<IpPrefix> prefix() {
+        return prefix;
+    }
+
+    @Override
+    public boolean exactMatch(ExtPrefix prefix) {
+        return this.equals(prefix) &&
+                Objects.equals(this.prefix, prefix.prefix())
+                && Objects.equals(this.type, prefix.type());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(prefix, type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DefaultExtPrefix) {
+            DefaultExtPrefix that = (DefaultExtPrefix) obj;
+            return Objects.equals(prefix, that.prefix())
+                    && Objects.equals(this.type, that.type);
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("prefix", prefix.toString())
+                .add("type", type.toString())
+                .toString();
+    }
+
+    /**
+     * Builder class for extension Ip prefix.
+     */
+    public static class Builder implements ExtPrefix.Builder {
+        private List<IpPrefix> prefix = new ArrayList<>();
+        private ExtType type;
+
+        @Override
+        public Builder setPrefix(IpPrefix ip) {
+            this.prefix.add(ip);
+            return this;
+        }
+
+        @Override
+        public Builder setType(ExtType type) {
+            this.type = type;
+            return this;
+        }
+
+        @Override
+        public ExtPrefix build() {
+            checkNotNull(prefix, "Ip prefix cannot be null");
+            return new DefaultExtPrefix(prefix, type);
+        }
+    }
+}
+
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtTarget.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtTarget.java
new file mode 100755
index 0000000..63c8c2f
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtTarget.java
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Target local and remote speaker implementation for wide community.
+ */
+public final class DefaultExtTarget implements ExtTarget {
+
+    private ExtPrefix localSpeaker;
+    private ExtPrefix remoteSpeaker;
+    private ExtType type;
+
+    /**
+     * Creates an object of type DefaultExtTarget which contains local and remote speakers.
+     *
+     * @param localSpeaker local speaker prefix list
+     * @param remoteSpeaker remoteSpeaker speaker prefix list
+     * @param type ExtType type
+     */
+    DefaultExtTarget(ExtPrefix localSpeaker, ExtPrefix remoteSpeaker, ExtType type) {
+        this.localSpeaker = localSpeaker;
+        this.remoteSpeaker = remoteSpeaker;
+        this.type = type;
+    }
+
+    @Override
+    public ExtType type() {
+        return type;
+    }
+
+    /**
+     * Returns the local speaker prefix list.
+     *
+     * @return the ExtPrefix
+     */
+    @Override
+    public ExtPrefix localSpeaker() {
+        return localSpeaker;
+    }
+
+    /**
+     * Returns the remote speaker prefix list.
+     *
+     * @return the ExtPrefix
+     */
+    @Override
+    public ExtPrefix remoteSpeaker() {
+        return remoteSpeaker;
+    }
+
+    /**
+     * Returns whether this target is an exact match to the target given
+     * in the argument.
+     *
+     * @param target other target to match
+     * @return true if the target are an exact match, otherwise false
+     */
+    @Override
+    public boolean exactMatch(ExtTarget target) {
+        return this.equals(target) &&
+                Objects.equals(this.localSpeaker, target.localSpeaker())
+                && Objects.equals(this.remoteSpeaker, target.remoteSpeaker())
+                && Objects.equals(this.type, target.type());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(localSpeaker, remoteSpeaker, type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DefaultExtTarget) {
+            DefaultExtTarget that = (DefaultExtTarget) obj;
+            return Objects.equals(localSpeaker, that.localSpeaker())
+                    && Objects.equals(remoteSpeaker, that.remoteSpeaker())
+                    && Objects.equals(this.type, that.type);
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("localSpeaker", localSpeaker)
+                .add("remoteSpeaker", remoteSpeaker)
+                .add("type", type)
+                .toString();
+    }
+
+    /**
+     * Builder class for wide community target.
+     */
+    public static class Builder implements ExtTarget.Builder {
+        private ExtPrefix localSpeaker;
+        private ExtPrefix remoteSpeaker;
+        private ExtType type;
+
+        @Override
+        public Builder setLocalSpeaker(ExtPrefix localSpeaker) {
+            this.localSpeaker = localSpeaker;
+            return this;
+        }
+
+        @Override
+        public Builder setRemoteSpeaker(ExtPrefix remoteSpeaker) {
+            this.remoteSpeaker = remoteSpeaker;
+            return this;
+        }
+
+        @Override
+        public Builder setType(ExtType type) {
+            this.type = type;
+            return this;
+        }
+
+        @Override
+        public ExtTarget build() {
+            checkNotNull(localSpeaker, "localSpeaker cannot be null");
+            checkNotNull(remoteSpeaker, "remoteSpeaker cannot be null");
+            return new DefaultExtTarget(localSpeaker, remoteSpeaker, type);
+        }
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtTcpFlag.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtTcpFlag.java
new file mode 100755
index 0000000..468e528
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtTcpFlag.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.List;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Tcp flag extension implementation.
+ */
+public class DefaultExtTcpFlag implements ExtTcpFlag {
+
+    private List<ExtOperatorValue> tcpFlag;
+    private ExtType type;
+
+    /**
+     * Creates an object of type DefaultExtTcpFlag which contains tcp flag.
+     *
+     * @param tcpFlag is a Tcp Flag rule list
+     * @param type ExtType type
+     */
+    DefaultExtTcpFlag(List<ExtOperatorValue> tcpFlag, ExtType type) {
+        this.tcpFlag = tcpFlag;
+        this.type = type;
+    }
+
+    @Override
+    public ExtType type() {
+        return type;
+    }
+
+    @Override
+    public List<ExtOperatorValue> tcpFlag() {
+        return tcpFlag;
+    }
+
+    @Override
+    public boolean exactMatch(ExtTcpFlag flag) {
+        return this.equals(tcpFlag) &&
+                Objects.equals(this.tcpFlag, flag.tcpFlag())
+                && Objects.equals(this.type, flag.type());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(tcpFlag, type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DefaultExtTcpFlag) {
+            DefaultExtTcpFlag that = (DefaultExtTcpFlag) obj;
+            return Objects.equals(tcpFlag, that.tcpFlag())
+                    && Objects.equals(this.type, that.type());
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("tcpFlag", tcpFlag.toString())
+                .add("type", type.toString())
+                .toString();
+    }
+
+    /**
+     * Builder class for extension tcp flag.
+     */
+    public static class Builder implements ExtTcpFlag.Builder {
+        private List<ExtOperatorValue> tcpFlag;
+        private ExtType type;
+
+        @Override
+        public Builder setTcpFlag(List<ExtOperatorValue> tcpFlag) {
+            this.tcpFlag = tcpFlag;
+            return this;
+        }
+
+        @Override
+        public Builder setType(ExtType type) {
+            this.type = type;
+            return this;
+        }
+
+        @Override
+        public ExtTcpFlag build() {
+            checkNotNull(tcpFlag, "tcpFlag cannot be null");
+            return new DefaultExtTcpFlag(tcpFlag, type);
+        }
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtTrafficAction.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtTrafficAction.java
new file mode 100755
index 0000000..1a2bc27
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtTrafficAction.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Extended traffic action implementation.
+ */
+public class DefaultExtTrafficAction implements ExtTrafficAction {
+
+    private boolean terminal;
+    private boolean sample;
+    private boolean rpd;
+    private ExtType type;
+
+    /**
+     * Creates an object of type DefaultExtTrafficAction which contains traffic action flag.
+     *
+     * @param terminal traffic action terminal bit
+     * @param sample is a traffic action sampling
+     * @param rpd traffic action rpd bit
+     * @param type ExtType type
+     */
+    DefaultExtTrafficAction(boolean terminal, boolean sample, boolean rpd, ExtType type) {
+        this.terminal = terminal;
+        this.sample = sample;
+        this.rpd = rpd;
+        this.type = type;
+    }
+
+    @Override
+    public ExtType type() {
+        return type;
+    }
+
+    @Override
+    public boolean terminal() {
+        return terminal;
+    }
+
+    @Override
+    public boolean sample() {
+        return sample;
+    }
+
+    @Override
+    public boolean rpd() {
+        return rpd;
+    }
+
+    @Override
+    public boolean exactMatch(ExtTrafficAction value) {
+        return this.equals(value) &&
+                Objects.equals(this.terminal, value.terminal())
+                && Objects.equals(this.sample, value.sample())
+                && Objects.equals(this.rpd, value.rpd())
+                && Objects.equals(this.type, value.type());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(terminal, sample, rpd, type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DefaultExtTrafficAction) {
+            DefaultExtTrafficAction that = (DefaultExtTrafficAction) obj;
+            return Objects.equals(terminal, that.terminal())
+                    && Objects.equals(this.sample, that.sample())
+                    && Objects.equals(this.rpd, that.rpd())
+                    && Objects.equals(this.type, that.type());
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("terminal", Boolean.valueOf(terminal).toString())
+                .add("sample",  Boolean.valueOf(sample).toString())
+                .add("rpd",  Boolean.valueOf(rpd).toString())
+                .add("type", type.toString())
+                .toString();
+    }
+
+    /**
+     * Builder class for extended traffic rate rule.
+     */
+    public static class Builder implements ExtTrafficAction.Builder {
+        private boolean terminal;
+        private boolean sample;
+        private boolean rpd;
+        private ExtType type;
+
+        @Override
+        public Builder setTerminal(boolean terminal) {
+            this.terminal = terminal;
+            return this;
+        }
+
+        @Override
+        public Builder setSample(boolean sample) {
+            this.sample = sample;
+            return this;
+        }
+
+        @Override
+        public Builder setRpd(boolean rpd) {
+            this.rpd = rpd;
+            return this;
+        }
+
+        @Override
+        public Builder setType(ExtType type) {
+            this.type = type;
+            return this;
+        }
+
+        @Override
+        public ExtTrafficAction build() {
+            checkNotNull(terminal, "terminal cannot be null");
+            checkNotNull(sample, "sample cannot be null");
+            checkNotNull(rpd, "rpd cannot be null");
+            return new DefaultExtTrafficAction(terminal, sample, rpd, type);
+        }
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtTrafficMarking.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtTrafficMarking.java
new file mode 100755
index 0000000..d014710
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtTrafficMarking.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Extended traffic marking implementation.
+ */
+public class DefaultExtTrafficMarking implements ExtTrafficMarking {
+
+    private byte marking;
+    private ExtType type;
+
+    /**
+     * Creates an object of type DefaultExtTrafficMarking which contains traffic marking byte.
+     *
+     * @param marking is a marking rule
+     * @param type ExtType type
+     */
+    DefaultExtTrafficMarking(byte marking, ExtType type) {
+        this.marking = marking;
+        this.type = type;
+    }
+
+    @Override
+    public ExtType type() {
+        return type;
+    }
+
+    @Override
+    public byte marking() {
+        return marking;
+    }
+
+    @Override
+    public boolean exactMatch(ExtTrafficMarking value) {
+        return this.equals(value) &&
+                Objects.equals(this.marking, value.marking())
+                && Objects.equals(this.type, value.type());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(marking, type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DefaultExtTrafficMarking) {
+            DefaultExtTrafficMarking that = (DefaultExtTrafficMarking) obj;
+            return Objects.equals(marking, that.marking())
+                    && Objects.equals(this.type, that.type());
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("marking", marking)
+                .add("type", type.toString())
+                .toString();
+    }
+
+    /**
+     * Builder class for extended traffic marking value rule.
+     */
+    public static class Builder implements ExtTrafficMarking.Builder {
+        private byte marking;
+        private ExtType type;
+
+        @Override
+        public Builder setMarking(byte marking) {
+            this.marking = marking;
+            return this;
+        }
+
+        @Override
+        public Builder setType(ExtType type) {
+            this.type = type;
+            return this;
+        }
+
+        @Override
+        public ExtTrafficMarking build() {
+            checkNotNull(marking, "marking cannot be null");
+            return new DefaultExtTrafficMarking(marking, type);
+        }
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtTrafficRate.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtTrafficRate.java
new file mode 100755
index 0000000..fc4b2bf
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtTrafficRate.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Extended traffic rate implementation.
+ */
+public class DefaultExtTrafficRate implements ExtTrafficRate {
+
+    private Short asn;
+    private Float rate;
+    private ExtType type;
+
+    /**
+     * Creates an object of type DefaultExtTrafficRate which contains traffic rate action.
+     *
+     * @param asn is a AS number
+     * @param rate is a traffic rate in bytes per second
+     * @param type ExtType type
+     */
+    DefaultExtTrafficRate(short asn, float rate, ExtType type) {
+        this.asn = Short.valueOf(asn);
+        this.rate = Float.valueOf(rate);
+        this.type = type;
+    }
+
+    @Override
+    public ExtType type() {
+        return type;
+    }
+
+    @Override
+    public Short asn() {
+        return asn;
+    }
+
+    @Override
+    public Float rate() {
+        return rate;
+    }
+
+    @Override
+    public boolean exactMatch(ExtTrafficRate value) {
+        return this.equals(value) &&
+                Objects.equals(this.asn, value.asn())
+                && Objects.equals(this.rate, value.rate())
+                && Objects.equals(this.type, value.type());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(asn, rate, type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DefaultExtTrafficRate) {
+            DefaultExtTrafficRate that = (DefaultExtTrafficRate) obj;
+            return Objects.equals(asn, that.asn())
+                    && Objects.equals(this.rate, that.rate())
+                    && Objects.equals(this.type, that.type());
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("asn", asn.toString())
+                .add("rate", rate.toString())
+                .add("type", type.toString())
+                .toString();
+    }
+
+    /**
+     * Builder class for extended traffic rate rule.
+     */
+    public static class Builder implements ExtTrafficRate.Builder {
+        private Short asn;
+        private Float rate;
+        private ExtType type;
+
+        @Override
+        public Builder setAsn(short asn) {
+            this.asn = Short.valueOf(asn);
+            return this;
+        }
+
+        @Override
+        public Builder setRate(float rate) {
+            this.rate = Float.valueOf(rate);
+            return this;
+        }
+
+        @Override
+        public Builder setType(ExtType type) {
+            this.type = type;
+            return this;
+        }
+
+        @Override
+        public ExtTrafficRate build() {
+            checkNotNull(asn, "asn cannot be null");
+            checkNotNull(rate, "rate cannot be null");
+            return new DefaultExtTrafficRate(asn, rate, type);
+        }
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtTrafficRedirect.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtTrafficRedirect.java
new file mode 100755
index 0000000..2a45d06
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtTrafficRedirect.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Extended traffic redirect implementation.
+ */
+public class DefaultExtTrafficRedirect implements ExtTrafficRedirect {
+
+    private String redirect;
+    private ExtType type;
+
+    /**
+     * Creates an object of type DefaultExtTrafficRedirect which contains traffic redirect action.
+     *
+     * @param redirect is a redirect rule
+     * @param type ExtType type
+     */
+    DefaultExtTrafficRedirect(String redirect, ExtType type) {
+        this.redirect = redirect;
+        this.type = type;
+    }
+
+    @Override
+    public ExtType type() {
+        return type;
+    }
+
+    @Override
+    public String redirect() {
+        return redirect;
+    }
+
+    @Override
+    public boolean exactMatch(ExtTrafficRedirect value) {
+        return this.equals(value) &&
+                Objects.equals(this.redirect, value.redirect())
+                && Objects.equals(this.type, value.type());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(redirect, type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DefaultExtTrafficRedirect) {
+            DefaultExtTrafficRedirect that = (DefaultExtTrafficRedirect) obj;
+            return Objects.equals(redirect, that.redirect())
+                    && Objects.equals(this.type, that.type());
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("redirect", redirect.toString())
+                .add("type", type.toString())
+                .toString();
+    }
+
+    /**
+     * Builder class for extended redirect value rule.
+     */
+    public static class Builder implements ExtTrafficRedirect.Builder {
+        private String redirect;
+        private ExtType type;
+
+        @Override
+        public Builder setRedirect(String redirect) {
+            this.redirect = redirect;
+            return this;
+        }
+
+        @Override
+        public Builder setType(ExtType type) {
+            this.type = type;
+            return this;
+        }
+
+        @Override
+        public ExtTrafficRedirect build() {
+            checkNotNull(redirect, "redirect cannot be null");
+            return new DefaultExtTrafficRedirect(redirect, type);
+        }
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtWideCommunityInt.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtWideCommunityInt.java
new file mode 100755
index 0000000..05ed379
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/DefaultExtWideCommunityInt.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Wide community attributes for RPD implementation.
+ */
+public class DefaultExtWideCommunityInt implements ExtWideCommunityInt {
+
+    private List<Integer> wCommInt;
+    private ExtType type;
+
+    /**
+     * Creates an object of type DefaultExtWideCommunityInt which contains wide community attributes.
+     *
+     * @param wCommInt is a wide community value
+     * @param type ExtType type
+     */
+    DefaultExtWideCommunityInt(List<Integer> wCommInt, ExtType type) {
+        this.wCommInt = wCommInt;
+        this.type = type;
+    }
+
+    @Override
+    public ExtType type() {
+        return type;
+    }
+
+    @Override
+    public List<Integer> communityInt() {
+        return wCommInt;
+    }
+
+    @Override
+    public boolean exactMatch(ExtWideCommunityInt value) {
+        return this.equals(value) &&
+                Objects.equals(this.wCommInt, value.communityInt())
+                && Objects.equals(this.type, value.type());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(wCommInt, type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DefaultExtWideCommunityInt) {
+            DefaultExtWideCommunityInt that = (DefaultExtWideCommunityInt) obj;
+            return Objects.equals(wCommInt, that.communityInt())
+                    && Objects.equals(this.type, that.type());
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("value", wCommInt.toString())
+                .add("type", type.toString())
+                .toString();
+    }
+
+    /**
+     * Builder class for wide community value rule.
+     */
+    public static class Builder implements ExtWideCommunityInt.Builder {
+        private List<Integer> wCommInt = new ArrayList<>();
+        private ExtType type;
+
+        @Override
+        public Builder setwCommInt(Integer wCommInt) {
+            this.wCommInt.add(wCommInt);
+            return this;
+        }
+
+        @Override
+        public Builder setType(ExtType type) {
+            this.type = type;
+            return this;
+        }
+
+        @Override
+        public ExtWideCommunityInt build() {
+            checkNotNull(wCommInt, "value cannot be null");
+            return new DefaultExtWideCommunityInt(wCommInt, type);
+        }
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtDscpValue.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtDscpValue.java
new file mode 100755
index 0000000..55b7150
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtDscpValue.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.List;
+
+/**
+ * Extended multivalue Dscp value class.
+ */
+public interface ExtDscpValue extends ExtFlowTypes {
+
+    /**
+     * Returns the ExtType.
+     *
+     * @return the ExtType
+     */
+    ExtType type();
+
+    /**
+     * Returns the dscp value operator value list.
+     *
+     * @return the dscp value operator value list
+     */
+    List<ExtOperatorValue> dscpValue();
+
+    /**
+     * Returns whether this dscp value list is an exact match to the dscp value list given
+     * in the argument.
+     *
+     * @param dscpValue other dscp value to match against
+     * @return true if the dscp value list are an exact match, otherwise false
+     */
+    boolean exactMatch(ExtDscpValue dscpValue);
+
+    /**
+     * A dscp value extended builder..
+     */
+    interface Builder {
+
+        /**
+         * Assigns the ExtType to this object.
+         *
+         * @param type extended type
+         * @return this the builder object
+         */
+        Builder setType(ExtType type);
+
+        /**
+         * Assigns the dscp operator value to this object.
+         *
+         * @param dscpValue the dscp value
+         * @return this the builder object
+         */
+        Builder setDscpValue(List<ExtOperatorValue> dscpValue);
+
+        /**
+         * Builds a dscp value object.
+         *
+         * @return a dscp value object.
+         */
+        ExtDscpValue build();
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtFlowContainer.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtFlowContainer.java
new file mode 100755
index 0000000..14f493c
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtFlowContainer.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import com.google.common.base.MoreObjects;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * Representation of Multi value flow container having custom rules.
+ */
+public final class ExtFlowContainer {
+
+    private List<ExtFlowTypes> container = new ArrayList<>();
+    private String deviceId;
+
+    /**
+     * Creates an object of type ExtFlowContainer.
+     */
+    public ExtFlowContainer(List<ExtFlowTypes> container) {
+        this.container = container;
+    }
+
+    /**
+     * Returns the ExtFlowContainer by setting its value.
+     *
+     * @return ExtFlowContainer
+     */
+    public static ExtFlowContainer of(List<ExtFlowTypes> container) {
+        return new ExtFlowContainer(container);
+    }
+
+    /**
+     * Returns the list of  ExtFlowTypes value.
+     *
+     * @return list of ExtFlowTypes
+     */
+    public List<ExtFlowTypes> container() {
+        return container;
+    }
+
+    /**
+     * Returns the device Id.
+     *
+     * @return deviceId
+     */
+    public String deviceId() {
+        return deviceId;
+    }
+
+    /**
+     * Adds the flow type to the container list.
+     *
+     * @param  obj of ExtFlowTypes type
+     */
+    public void add(ExtFlowTypes obj) {
+        container.add(obj);
+    }
+
+    /**
+     * Removes the flow type from the container list.
+     *
+     * @param  obj of ExtFlowTypes type
+     */
+    public void remove(ExtFlowTypes obj) {
+        container.remove(obj);
+    }
+
+    /**
+     * Sets the device Id to this container.
+     *
+     * @param deviceId to be set to this container
+     */
+    public void setDeviceId(String deviceId) {
+        this.deviceId = deviceId;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(container);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof ExtFlowContainer)) {
+            return false;
+        }
+        final ExtFlowContainer other = (ExtFlowContainer) obj;
+        return Objects.equals(this.container, other.container)
+                && Objects.equals(this.deviceId, other.deviceId);
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(this)
+                .add("container", container)
+                .add("deviceId", deviceId)
+                .toString();
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtFlowTypes.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtFlowTypes.java
new file mode 100755
index 0000000..777598c
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtFlowTypes.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+/**
+ * Representation of BgpFlow container having custom rules.
+ */
+public interface ExtFlowTypes {
+
+    /**
+     * Bgp types.
+     */
+    public enum ExtType {
+
+        /** Extended flow rule key. */
+        EXT_FLOW_RULE_KEY(0),
+
+        /** IPv4 destination address. */
+        IPV4_DST_PFX(1),
+
+        /** IPv4 source address. */
+        IPV4_SRC_PFX(2),
+
+        /** IP protocol list. */
+        IP_PROTO_LIST(3),
+
+        /** Input port list. */
+        IN_PORT_LIST(4),
+
+        /** Destination port list. */
+        DST_PORT_LIST(5),
+
+        /** Source port list. */
+        SRC_PORT_LIST(6),
+
+        /** ICMP type list. */
+        ICMP_TYPE_LIST(7),
+
+        /** ICMP code list. */
+        ICMP_CODE_LIST(8),
+
+        /** TCP flag list. */
+        TCP_FLAG_LIST(9),
+
+        /** Packet length list. */
+        PACKET_LENGTH_LIST(10),
+
+        /** DSCP Value component. */
+        DSCP_VALUE_LIST(11),
+
+        /** Fragment list. */
+        FRAGMENT_LIST(12),
+
+        /** Wide community flags. */
+        WIDE_COMM_FLAGS(13),
+
+        /** Wide community hop count. */
+        WIDE_COMM_HOP_COUNT(14),
+
+        /** Wide community community attribute. */
+        WIDE_COMM_COMMUNITY(15),
+
+        /** Wide community context AS. */
+        WIDE_COMM_CONTEXT_AS(16),
+
+        /** Wide community local AS. */
+        WIDE_COMM_LOCAL_AS(17),
+
+        /** Wide community target prefixes. */
+        WIDE_COMM_TARGET(18),
+
+        /** Wide community extended target prefixes. */
+        WIDE_COMM_EXT_TARGET(19),
+
+        /** Wide community parameter. */
+        WIDE_COMM_PARAMETER(20),
+
+        /** Traffic filtering actions. */
+
+        TRAFFIC_RATE(0x8006),
+        TRAFFIC_ACTION(0x8007),
+        TRAFFIC_REDIRECT(0x8008),
+        TRAFFIC_MARKING(0x8009);
+
+        private int type;
+
+        /**
+         * Creates a new type.
+         *
+         * @param type type code
+         */
+        ExtType(int type) {
+            this.type = type;
+        }
+
+        /**
+         * Returns the type object for this type code.
+         *
+         * @return ExtType object
+         */
+        public int type() {
+            return (type);
+        }
+    }
+
+    ExtType type();
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtFragment.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtFragment.java
new file mode 100755
index 0000000..8a606e8
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtFragment.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.List;
+
+/**
+ * Extended multivalue Fragment value list class.
+ */
+public interface ExtFragment extends ExtFlowTypes {
+
+    /**
+     * Returns the ExtType.
+     *
+     * @return the ExtType
+     */
+    ExtType type();
+
+    /**
+     * Returns the fragment operator value list.
+     *
+     * @return the fragment operator value list
+     */
+    List<ExtOperatorValue> fragment();
+
+    /**
+     * Returns whether this fragment value list is an exact match to the fragment value list given
+     * in the argument.
+     *
+     * @param fragment other fragment value to match against
+     * @return true if the fragment value list are an exact match, otherwise false
+     */
+    boolean exactMatch(ExtFragment fragment);
+
+    /**
+     * Extended fragment value builder..
+     */
+    interface Builder {
+
+        /**
+         * Assigns the ExtType to this object.
+         *
+         * @param type extended type
+         * @return this the builder object
+         */
+        Builder setType(ExtType type);
+
+        /**
+         * Assigns the fragment operator value to this object.
+         *
+         * @param fragment the fragment value
+         * @return this the builder object
+         */
+        Builder setFragment(List<ExtOperatorValue> fragment);
+
+        /**
+         * Builds a fragment value object.
+         *
+         * @return a fragment value object.
+         */
+        ExtFragment build();
+    }
+}
+
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtIcmpCode.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtIcmpCode.java
new file mode 100755
index 0000000..2e42aa0
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtIcmpCode.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.List;
+
+/**
+ * Extended multivalue ICMP code class.
+ */
+public interface ExtIcmpCode extends ExtFlowTypes {
+
+    /**
+     * Returns the ExtType.
+     *
+     * @return the ExtType
+     */
+    ExtType type();
+
+    /**
+     * Returns the Icmp code operator value list.
+     *
+     * @return the Icmp code operator value list
+     */
+    List<ExtOperatorValue> icmpCode();
+
+    /**
+     * Returns whether this Icmp code list is an exact match to the Icmp code list given
+     * in the argument.
+     *
+     * @param icmpCode other Icmp code to match against
+     * @return true if the Icmp code list are an exact match, otherwise false
+     */
+    boolean exactMatch(ExtIcmpCode icmpCode);
+
+    /**
+     * An Icmp code extension builder..
+     */
+    interface Builder {
+
+        /**
+         * Assigns the ExtType to this object.
+         *
+         * @param type extended type
+         * @return this the builder object
+         */
+        Builder setType(ExtType type);
+
+        /**
+         * Assigns the Icmp code operator value to this object.
+         *
+         * @param icmpCode the Icmp code operator value combination
+         * @return this the builder object
+         */
+        Builder setIcmpCode(List<ExtOperatorValue> icmpCode);
+
+        /**
+         * Builds a Icmp code object.
+         *
+         * @return a Tcmp code object.
+         */
+        ExtIcmpCode build();
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtIcmpType.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtIcmpType.java
new file mode 100755
index 0000000..480c73d
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtIcmpType.java
@@ -0,0 +1,76 @@
+/*
+ * 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.flowapi;
+
+import java.util.List;
+
+/**
+ * Extended multivalue ICMP type class.
+ */
+public interface ExtIcmpType extends ExtFlowTypes {
+
+    /**
+     * Returns the ExtType.
+     *
+     * @return the ExtType
+     */
+    ExtType type();
+
+    /**
+     * Returns the Icmp type operator value list.
+     *
+     * @return the Icmp type operator value list
+     */
+    List<ExtOperatorValue> icmpType();
+
+    /**
+     * Returns whether this Icmp type list is an exact match to the Icmp type list given
+     * in the argument.
+     *
+     * @param icmpType other Icmp type to match against
+     * @return true if the Icmp type list are an exact match, otherwise false
+     */
+    boolean exactMatch(ExtIcmpType icmpType);
+
+    /**
+     * An Icmp type extension builder..
+     */
+    interface Builder {
+
+        /**
+         * Assigns the ExtType to this object.
+         *
+         * @param type extended type
+         * @return this the builder object
+         */
+        Builder setType(ExtType type);
+
+        /**
+         * Assigns the Icmp type operator value to this object.
+         *
+         * @param icmpType the Icmp type operator value combination
+         * @return this the builder object
+         */
+        Builder setIcmpType(List<ExtOperatorValue> icmpType);
+
+        /**
+         * Builds a Icmp type object.
+         *
+         * @return a Tcmp type object.
+         */
+        ExtIcmpType build();
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtIpProtocol.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtIpProtocol.java
new file mode 100755
index 0000000..bee44c0
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtIpProtocol.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.List;
+
+/**
+ * Extended multivalue Ip protocol class.
+ */
+public interface ExtIpProtocol extends ExtFlowTypes {
+
+    /**
+     * Returns the ExtType.
+     *
+     * @return the ExtType
+     */
+    ExtType type();
+
+    /**
+     * Returns the Ip protocol operator value list.
+     *
+     * @return the Ip protocol operator value list
+     */
+    List<ExtOperatorValue> ipProtocol();
+
+    /**
+     * Returns whether this Ip protocol list is an exact match to the Ip protocol list given
+     * in the argument.
+     *
+     * @param ipProto other Ip protocols list to match against
+     * @return true if the Ip protocols list are an exact match, otherwise false
+     */
+    boolean exactMatch(ExtIpProtocol ipProto);
+
+    /**
+     * Ip protocol extension builder.
+     */
+    interface Builder {
+
+        /**
+         * Assigns the ExtType to this object.
+         *
+         * @param type extended type
+         * @return this the builder object
+         */
+        Builder setType(ExtType type);
+
+        /**
+         * Adds the Ip protocol operator value to this object.
+         *
+         * @param ipProto is the operator-value combination
+         * @return this the builder object
+         */
+        Builder setIpProtocol(List<ExtOperatorValue> ipProto);
+
+        /**
+         * Builds a Ip protocol object.
+         *
+         * @return a Ip protocol object.
+         */
+        ExtIpProtocol build();
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtKeyName.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtKeyName.java
new file mode 100755
index 0000000..4759ef3
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtKeyName.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+/**
+ * Ext flwo key name class.
+ */
+public interface ExtKeyName extends ExtFlowTypes {
+
+    /**
+     * Returns the ExtType.
+     *
+     * @return the ExtType
+     */
+    ExtType type();
+
+    /**
+     * Returns the key name identifier for the flow.
+     *
+     * @return the key name
+     */
+    String keyName();
+
+    /**
+     * Returns whether this key name is an exact match to the key name given
+     * in the argument.
+     *
+     * @param key other key name to match against
+     * @return true if the key name are an exact match, otherwise false
+     */
+    boolean exactMatch(ExtKeyName key);
+
+    /**
+     * A key name value list builder..
+     */
+    interface Builder {
+
+        /**
+         * Assigns the ExtType to this object.
+         *
+         * @param type extended type
+         * @return this the builder object
+         */
+        Builder setType(ExtType type);
+
+        /**
+         * Assigns the key name to this object.
+         *
+         * @param key the key name
+         * @return this the builder object
+         */
+        Builder setKeyName(String key);
+
+        /**
+         * Builds a key name object.
+         *
+         * @return a key name object.
+         */
+        ExtKeyName build();
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtOperatorValue.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtOperatorValue.java
new file mode 100755
index 0000000..459b993
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtOperatorValue.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import com.google.common.base.MoreObjects;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Arrays;
+import java.util.Objects;
+
+/**
+ * Flow specification type operator and value implementation.
+ */
+public class ExtOperatorValue {
+
+    protected static final Logger log = LoggerFactory.getLogger(ExtOperatorValue.class);
+
+    private final byte option;
+    private final byte[] value;
+
+    /**
+     * Creates an object of type ExtOperatorValue.
+     *
+     * @param option for a specific flow type
+     * @param value for a specific flow type
+     */
+    public ExtOperatorValue(byte option, byte[] value) {
+        this.option = option;
+        this.value = Arrays.copyOf(value, value.length);
+    }
+
+    /**
+     * Returns option of the flow type.
+     *
+     * @return option of the flow type
+     */
+    public byte option() {
+        return option;
+    }
+
+    /**
+     * Returns value of the flow type.
+     *
+     * @return value of the flow type
+     */
+    public byte[] value() {
+        return value;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(option, Arrays.hashCode(value));
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof ExtOperatorValue) {
+            ExtOperatorValue other = (ExtOperatorValue) obj;
+            return Objects.equals(this.option, other.option) && Arrays.equals(this.value, other.value);
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass()).add("option", option).add("value", value).toString();
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtPacketLength.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtPacketLength.java
new file mode 100755
index 0000000..6c3dedf
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtPacketLength.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.List;
+
+/**
+ * Extended multivalue packet length list class.
+ */
+public interface ExtPacketLength extends ExtFlowTypes {
+
+    /**
+     * Returns the ExtType.
+     *
+     * @return the ExtType
+     */
+    ExtType type();
+
+    /**
+     * Returns the packet length operator value list.
+     *
+     * @return the packet length operator value list
+     */
+    List<ExtOperatorValue> packetLength();
+
+    /**
+     * Returns whether this packet length list is an exact match to the packet length list given
+     * in the argument.
+     *
+     * @param packetLength other packet length to match against
+     * @return true if the packet length list are an exact match, otherwise false
+     */
+    boolean exactMatch(ExtPacketLength packetLength);
+
+    /**
+     * A packet length extended builder..
+     */
+    interface Builder {
+
+        /**
+         * Assigns the ExtType to this object.
+         *
+         * @param type extended type
+         * @return this the builder object
+         */
+        Builder setType(ExtType type);
+
+        /**
+         * Assigns the packet length list to this object.
+         *
+         * @param packetLength the packet length
+         * @return this the builder object
+         */
+        Builder setPacketLength(List<ExtOperatorValue> packetLength);
+
+        /**
+         * Builds a packet length object.
+         *
+         * @return a packet length object.
+         */
+        ExtPacketLength build();
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtPort.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtPort.java
new file mode 100755
index 0000000..a84b8e7
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtPort.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.List;
+
+/**
+ * Extended multivalue port class.
+ */
+public interface ExtPort extends ExtFlowTypes {
+
+    /**
+     * Returns the ExtType.
+     *
+     * @return the ExtType
+     */
+    ExtType type();
+
+    /**
+     * Returns the port operator value list.
+     *
+     * @return the port operator value list
+     */
+    List<ExtOperatorValue> port();
+
+    /**
+     * Returns whether this port list is an exact match to the port list given
+     * in the argument.
+     *
+     * @param port other port to match against
+     * @return true if the port list are an exact match, otherwise false
+     */
+    boolean exactMatch(ExtPort port);
+
+    /**
+     * An extended port extension builder..
+     */
+    interface Builder {
+
+        /**
+         * Assigns the ExtType to this object.
+         *
+         * @param type extended type
+         * @return this the builder object
+         */
+        Builder setType(ExtType type);
+
+        /**
+         * Assigns the port list operator value to this object.
+         *
+         * @param port is the operator-value combination
+         * @return this the builder object
+         */
+        Builder setPort(List<ExtOperatorValue> port);
+
+        /**
+         * Builds a port object.
+         *
+         * @return a port object.
+         */
+        ExtPort build();
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtPrefix.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtPrefix.java
new file mode 100755
index 0000000..3539ef2
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtPrefix.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import org.onlab.packet.IpPrefix;
+
+import java.util.List;
+
+/**
+ * Ext Prefix class.
+ */
+public interface ExtPrefix extends ExtFlowTypes {
+
+    /**
+     * Returns the ExtType.
+     *
+     * @return the ExtType
+     */
+    ExtType type();
+
+    /**
+     * Returns the prefix list.
+     *
+     * @return the IpPrefix list
+     */
+    List<IpPrefix> prefix();
+
+    /**
+     * Returns whether this prefix list is an exact match to the prefix list given
+     * in the argument.
+     *
+     * @param prefix other prefix to match against
+     * @return true if the prefix are an exact match, otherwise false
+     */
+    boolean exactMatch(ExtPrefix prefix);
+
+    /**
+     * A prefix builder..
+     */
+    interface Builder {
+
+        /**
+         * Assigns the ExtType to this object.
+         *
+         * @param type the prefix
+         * @return this the builder object
+         */
+        Builder setType(ExtType type);
+
+        /**
+         * Add the prefix to this object.
+         *
+         * @param prefix the prefix
+         * @return this the builder object
+         */
+        Builder setPrefix(IpPrefix prefix);
+
+        /**
+         * Builds a prefix object.
+         *
+         * @return a port chain.
+         */
+        ExtPrefix build();
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtTarget.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtTarget.java
new file mode 100755
index 0000000..157ce9a
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtTarget.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+/**
+ * Ext target prefix class class.
+ */
+public interface ExtTarget extends ExtFlowTypes {
+
+    /**
+     * Returns the ExtType.
+     *
+     * @return the ExtType
+     */
+    ExtType type();
+
+    /**
+     * Returns the local speaker prefix list.
+     *
+     * @return the prefix list
+     */
+    ExtPrefix localSpeaker();
+
+    /**
+     * Returns the remote speaker prefix list.
+     *
+     * @return the prefix list
+     */
+    ExtPrefix remoteSpeaker();
+
+    /**
+     * Returns whether this prefix list is an exact match to the prefix list given
+     * in the argument.
+     *
+     * @param prefix other prefix to match against
+     * @return true if the prefix are an exact match, otherwise false
+     */
+    boolean exactMatch(ExtTarget prefix);
+
+    /**
+     * A prefix builder..
+     */
+    interface Builder {
+
+        /**
+         * Assigns the ExtType to this object.
+         *
+         * @param type the prefix
+         * @return this the builder object
+         */
+        Builder setType(ExtType type);
+
+        /**
+         * Add the local speaker prefix to this object.
+         *
+         * @param localSpeaker list of local speakers
+         * @return this the builder object
+         */
+        Builder setLocalSpeaker(ExtPrefix localSpeaker);
+
+        /**
+         * Add the remote speaker prefix to this object.
+         *
+         * @param remoteSpeaker list of remote speakers
+         * @return this the builder object
+         */
+        Builder setRemoteSpeaker(ExtPrefix remoteSpeaker);
+
+        /**
+         * Builds a prefix object.
+         *
+         * @return a port chain.
+         */
+        ExtTarget build();
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtTcpFlag.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtTcpFlag.java
new file mode 100755
index 0000000..17e5145
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtTcpFlag.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.List;
+
+/**
+ * Extended multivalue Tcp Flags list class.
+ */
+public interface ExtTcpFlag extends ExtFlowTypes {
+
+    /**
+     * Returns the ExtType.
+     *
+     * @return the ExtType
+     */
+    ExtType type();
+
+    /**
+     * Returns the Tcp flag Extended multivalue.
+     *
+     * @return the Tcp flag Extended multivalue
+     */
+    List<ExtOperatorValue> tcpFlag();
+
+    /**
+     * Returns whether this Tcp flag list is an exact match to the Tcp flag list given
+     * in the argument.
+     *
+     * @param tcpFlag other Tcp flag to match against
+     * @return true if the Tcp flag list are an exact match, otherwise false
+     */
+    boolean exactMatch(ExtTcpFlag tcpFlag);
+
+    /**
+     * A Tcp flag extended builder..
+     */
+    interface Builder {
+
+        /**
+         * Assigns the ExtType to this object.
+         *
+         * @param type extended type
+         * @return this the builder object
+         */
+        Builder setType(ExtType type);
+
+        /**
+         * Assigns the Tcp flag operator value to this object.
+         *
+         * @param tcpFlag the Tcp flag
+         * @return this the builder object
+         */
+        Builder setTcpFlag(List<ExtOperatorValue> tcpFlag);
+
+        /**
+         * Builds a Tcp flag object.
+         *
+         * @return a Tcp flag object.
+         */
+        ExtTcpFlag build();
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtTrafficAction.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtTrafficAction.java
new file mode 100755
index 0000000..170cd6c
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtTrafficAction.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+/**
+ * Extended flow traffic action class.
+ */
+public interface ExtTrafficAction extends ExtFlowTypes {
+
+    /**
+     * Returns the ExtType.
+     *
+     * @return the ExtType
+     */
+    ExtType type();
+
+    /**
+     * Returns the terminal action.
+     *
+     * @return the terminal action is set or not
+     */
+    boolean terminal();
+
+    /**
+     * Returns the traffic sampling.
+     *
+     * @return the traffic sampling set or not
+     */
+    boolean sample();
+
+    /**
+     * Returns the traffic action to be taken is rpd.
+     *
+     * @return the traffic action rpd is set or not
+     */
+    boolean rpd();
+
+    /**
+     * Returns whether this traffic action is an exact match to the traffic action given
+     * in the argument.
+     *
+     * @param trafficAction other traffic action to match against
+     * @return true if the traffic action are an exact match, otherwise false
+     */
+    boolean exactMatch(ExtTrafficAction trafficAction);
+
+    /**
+     * A traffic action builder..
+     */
+    interface Builder {
+
+        /**
+         * Assigns the ExtType to this object.
+         *
+         * @param type extended type
+         * @return this the builder object
+         */
+        Builder setType(ExtType type);
+
+        /**
+         * Assigns the terminal action to this object.
+         *
+         * @param terminal action
+         * @return this the builder object
+         */
+        Builder setTerminal(boolean terminal);
+
+        /**
+         * Assigns the traffic sampling to this object.
+         *
+         * @param sample to be done or not
+         * @return this the builder object
+         */
+        Builder setSample(boolean sample);
+
+        /**
+         * Assigns the traffic action rpd to this object.
+         *
+         * @param rpd rpd or not
+         * @return this the builder object
+         */
+        Builder setRpd(boolean rpd);
+
+        /**
+         * Builds a traffic action object.
+         *
+         * @return a traffic action object.
+         */
+        ExtTrafficAction build();
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtTrafficMarking.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtTrafficMarking.java
new file mode 100755
index 0000000..ee43ba0
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtTrafficMarking.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+/**
+ * Extended traffic marking class.
+ */
+public interface ExtTrafficMarking extends ExtFlowTypes {
+
+    /**
+     * Returns the ExtType.
+     *
+     * @return the ExtType
+     */
+    ExtType type();
+
+    /**
+     * Returns the traffic marking DSCP value.
+     *
+     * @return the marking rule
+     */
+    byte marking();
+
+    /**
+     * Returns whether this traffic marking is an exact match to the traffic marking given
+     * in the argument.
+     *
+     * @param marking other traffic marking to match against
+     * @return true if the traffic marking are an exact match, otherwise false
+     */
+    boolean exactMatch(ExtTrafficMarking marking);
+
+    /**
+     * A traffic marking builder..
+     */
+    interface Builder {
+
+        /**
+         * Assigns the ExtType to this object.
+         *
+         * @param type extended type
+         * @return this the builder object
+         */
+        Builder setType(ExtType type);
+
+        /**
+         * Assigns the traffic marking to this object.
+         *
+         * @param marking the marking value
+         * @return this the builder object
+         */
+        Builder setMarking(byte marking);
+
+        /**
+         * Builds a traffic marking object.
+         *
+         * @return a marking value object.
+         */
+        ExtTrafficMarking build();
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtTrafficRate.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtTrafficRate.java
new file mode 100755
index 0000000..a903fb7
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtTrafficRate.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+/**
+ * Extended flow traffic rate class.
+ */
+public interface ExtTrafficRate extends ExtFlowTypes {
+
+    /**
+     * Returns the ExtType.
+     *
+     * @return the ExtType
+     */
+    ExtType type();
+
+    /**
+     * Returns the AS number.
+     *
+     * @return the 2 byte ASN
+     */
+    Short asn();
+
+    /**
+     * Returns the traffic rate.
+     *
+     * @return the floating point traffic rate
+     */
+    Float rate();
+
+    /**
+     * Returns whether this traffic rate is an exact match to the traffic rate given
+     * in the argument.
+     *
+     * @param trafficRate other traffic rate to match against
+     * @return true if the traffic rate list are an exact match, otherwise false
+     */
+    boolean exactMatch(ExtTrafficRate trafficRate);
+
+    /**
+     * A traffic rate builder..
+     */
+    interface Builder {
+
+        /**
+         * Assigns the ExtType to this object.
+         *
+         * @param type extended type
+         * @return this the builder object
+         */
+        Builder setType(ExtType type);
+
+        /**
+         * Assigns the AS number to this object.
+         *
+         * @param asn the ASN
+         * @return this the builder object
+         */
+        Builder setAsn(short asn);
+
+        /**
+         * Assigns the traffic rate to this object.
+         *
+         * @param rate in floating point number bytes per second
+         * @return this the builder object
+         */
+        Builder setRate(float rate);
+
+        /**
+         * Builds a traffic rate object.
+         *
+         * @return a traffic rate object.
+         */
+        ExtTrafficRate build();
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtTrafficRedirect.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtTrafficRedirect.java
new file mode 100755
index 0000000..861e667
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtTrafficRedirect.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+/**
+ * Extended flow traffic redirect class.
+ */
+public interface ExtTrafficRedirect extends ExtFlowTypes {
+
+    /**
+     * Returns the ExtType.
+     *
+     * @return the ExtType
+     */
+    ExtType type();
+
+    /**
+     * Returns the traffic redirect in human readable format.
+     *
+     * @return the redirect rule
+     */
+    String redirect();
+
+    /**
+     * Returns whether this traffic redirect is an exact match to the traffic redirect given
+     * in the argument.
+     *
+     * @param redirect other traffic redirect to match against
+     * @return true if the traffic redirect are an exact match, otherwise false
+     */
+    boolean exactMatch(ExtTrafficRedirect redirect);
+
+    /**
+     * A dscp value list builder..
+     */
+    interface Builder {
+
+        /**
+         * Assigns the ExtType to this object.
+         *
+         * @param type extended type
+         * @return this the builder object
+         */
+        Builder setType(ExtType type);
+
+        /**
+         * Assigns the traffic redirect to this object.
+         *
+         * @param redirect the redirect value
+         * @return this the builder object
+         */
+        Builder setRedirect(String redirect);
+
+        /**
+         * Builds a traffic redirect object.
+         *
+         * @return a redirect value object.
+         */
+        ExtTrafficRedirect build();
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtWideCommunityInt.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtWideCommunityInt.java
new file mode 100755
index 0000000..cd23a77
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/ExtWideCommunityInt.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import java.util.List;
+
+/**
+ * Extended wide community integer class.
+ */
+public interface ExtWideCommunityInt extends ExtFlowTypes {
+
+    /**
+     * Returns the ExtType.
+     *
+     * @return the ExtType
+     */
+    ExtType type();
+
+    /**
+     * Returns the wide community integer list.
+     *
+     * @return the wide community integer list
+     */
+    List<Integer> communityInt();
+
+    /**
+     * Returns whether this wide community integer is an exact match to the wide community int given
+     * in the argument.
+     *
+     * @param wCommInt other wide community integer to match against
+     * @return true if the wide community integer are an exact match, otherwise false
+     */
+    boolean exactMatch(ExtWideCommunityInt wCommInt);
+
+    /**
+     * A wide community integer list builder..
+     */
+    interface Builder {
+
+        /**
+         * Assigns the ExtType to this object.
+         *
+         * @param type extended type
+         * @return this the builder object
+         */
+        Builder setType(ExtType type);
+
+        /**
+         * Assigns the wide community integer to this object.
+         *
+         * @param wCommInt the wide community integer
+         * @return this the builder object
+         */
+        Builder setwCommInt(Integer wCommInt);
+
+        /**
+         * Builds a wide community integer object.
+         *
+         * @return a wide community integer value object.
+         */
+        ExtWideCommunityInt build();
+    }
+}
diff --git a/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/package-info.java b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/package-info.java
new file mode 100755
index 0000000..9abf0be
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/main/java/org/onosproject/flowapi/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present 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.
+ */
+
+/**
+ * API bundle.
+ */
+package org.onosproject.flowapi;
diff --git a/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtDscpValueTest.java b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtDscpValueTest.java
new file mode 100644
index 0000000..bd2fca5
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtDscpValueTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Test for extended dscp value attribute.
+ */
+public class DefaultExtDscpValueTest {
+
+    private List<ExtOperatorValue> dscpValue = new ArrayList<>();
+    private List<ExtOperatorValue> dscpValue1 = new ArrayList<>();
+    private ExtOperatorValue opVal = new ExtOperatorValue((byte) 1, new byte[100]);
+    private ExtOperatorValue opVal1 = new ExtOperatorValue((byte) 1, new byte[200]);
+    private ExtFlowTypes.ExtType type = ExtFlowTypes.ExtType.DSCP_VALUE_LIST;
+
+    @Test
+    public void basics() {
+        dscpValue.add(opVal);
+        dscpValue1.add(opVal1);
+        DefaultExtDscpValue data = new DefaultExtDscpValue(dscpValue, type);
+        DefaultExtDscpValue sameAsData = new DefaultExtDscpValue(dscpValue, type);
+        DefaultExtDscpValue diffData = new DefaultExtDscpValue(dscpValue1, type);
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+                .addEqualityGroup(diffData).testEquals();
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtFragmentTest.java b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtFragmentTest.java
new file mode 100644
index 0000000..df7893c
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtFragmentTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Test for extended fragment value attribute.
+ */
+public class DefaultExtFragmentTest {
+
+    private List<ExtOperatorValue> fragment = new ArrayList<>();
+    private List<ExtOperatorValue> fragment1 = new ArrayList<>();
+    private ExtOperatorValue opVal = new ExtOperatorValue((byte) 1, new byte[100]);
+    private ExtOperatorValue opVal1 = new ExtOperatorValue((byte) 1, new byte[200]);
+    private ExtFlowTypes.ExtType type = ExtFlowTypes.ExtType.FRAGMENT_LIST;
+
+    @Test
+    public void basics() {
+        fragment.add(opVal);
+        fragment1.add(opVal1);
+        DefaultExtFragment data = new DefaultExtFragment(fragment, type);
+        DefaultExtFragment sameAsData = new DefaultExtFragment(fragment, type);
+        DefaultExtFragment diffData = new DefaultExtFragment(fragment1, type);
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+                .addEqualityGroup(diffData).testEquals();
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtIcmpCodeTest.java b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtIcmpCodeTest.java
new file mode 100644
index 0000000..105d5bc
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtIcmpCodeTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Test for extended icmp code value attribute.
+ */
+public class DefaultExtIcmpCodeTest {
+
+    private List<ExtOperatorValue> icmpCode = new ArrayList<>();
+    private List<ExtOperatorValue> icmpCode1 = new ArrayList<>();
+    private ExtOperatorValue opVal = new ExtOperatorValue((byte) 1, new byte[100]);
+    private ExtOperatorValue opVal1 = new ExtOperatorValue((byte) 1, new byte[200]);
+    private ExtFlowTypes.ExtType type = ExtFlowTypes.ExtType.ICMP_CODE_LIST;
+
+    @Test
+    public void basics() {
+        icmpCode.add(opVal);
+        icmpCode1.add(opVal1);
+        DefaultExtIcmpCode data = new DefaultExtIcmpCode(icmpCode, type);
+        DefaultExtIcmpCode sameAsData = new DefaultExtIcmpCode(icmpCode, type);
+        DefaultExtIcmpCode diffData = new DefaultExtIcmpCode(icmpCode1, type);
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+                .addEqualityGroup(diffData).testEquals();
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtIcmpTypeTest.java b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtIcmpTypeTest.java
new file mode 100644
index 0000000..3c313e9
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtIcmpTypeTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+        import com.google.common.testing.EqualsTester;
+        import org.junit.Test;
+
+        import java.util.ArrayList;
+        import java.util.List;
+
+/**
+ * Test for extended icmp type value attribute.
+ */
+public class DefaultExtIcmpTypeTest {
+
+    private List<ExtOperatorValue> icmpType = new ArrayList<>();
+    private List<ExtOperatorValue> icmpType1 = new ArrayList<>();
+    private ExtOperatorValue opVal = new ExtOperatorValue((byte) 1, new byte[100]);
+    private ExtOperatorValue opVal1 = new ExtOperatorValue((byte) 1, new byte[200]);
+    private ExtFlowTypes.ExtType type = ExtFlowTypes.ExtType.ICMP_TYPE_LIST;
+
+    @Test
+    public void basics() {
+        icmpType.add(opVal);
+        icmpType1.add(opVal1);
+        DefaultExtIcmpType data = new DefaultExtIcmpType(icmpType, type);
+        DefaultExtIcmpType sameAsData = new DefaultExtIcmpType(icmpType, type);
+        DefaultExtIcmpType diffData = new DefaultExtIcmpType(icmpType1, type);
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+                .addEqualityGroup(diffData).testEquals();
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtIpProtocolTest.java b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtIpProtocolTest.java
new file mode 100644
index 0000000..4ac3685
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtIpProtocolTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Test for extended icmp type value attribute.
+ */
+public class DefaultExtIpProtocolTest {
+
+    private List<ExtOperatorValue> ipProtocol = new ArrayList<>();
+    private List<ExtOperatorValue> ipProtocol1 = new ArrayList<>();
+    private ExtOperatorValue opVal = new ExtOperatorValue((byte) 1, new byte[100]);
+    private ExtOperatorValue opVal1 = new ExtOperatorValue((byte) 1, new byte[200]);
+    private ExtFlowTypes.ExtType type = ExtFlowTypes.ExtType.IP_PROTO_LIST;
+
+    @Test
+    public void basics() {
+        ipProtocol.add(opVal);
+        ipProtocol1.add(opVal1);
+        DefaultExtIpProtocol data = new DefaultExtIpProtocol(ipProtocol, type);
+        DefaultExtIpProtocol sameAsData = new DefaultExtIpProtocol(ipProtocol, type);
+        DefaultExtIpProtocol diffData = new DefaultExtIpProtocol(ipProtocol1, type);
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+                .addEqualityGroup(diffData).testEquals();
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtKeyNameTest.java b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtKeyNameTest.java
new file mode 100644
index 0000000..64a4b97
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtKeyNameTest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+
+/**
+ * Test for extended key name value attribute.
+ */
+public class DefaultExtKeyNameTest {
+
+    private String keyName = new String("hello");
+    private String keyName1 = new String("Hi");
+
+    private ExtFlowTypes.ExtType type = ExtFlowTypes.ExtType.EXT_FLOW_RULE_KEY;
+
+    @Test
+    public void basics() {
+
+        DefaultExtKeyName data = new DefaultExtKeyName(keyName, type);
+        DefaultExtKeyName sameAsData = new DefaultExtKeyName(keyName, type);
+        DefaultExtKeyName diffData = new DefaultExtKeyName(keyName1, type);
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+                .addEqualityGroup(diffData).testEquals();
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtPacketLengthTest.java b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtPacketLengthTest.java
new file mode 100644
index 0000000..d0d2f9c
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtPacketLengthTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Test for extended packet length value attribute.
+ */
+public class DefaultExtPacketLengthTest {
+
+    private List<ExtOperatorValue> packetLength = new ArrayList<>();
+    private List<ExtOperatorValue> packetLength1 = new ArrayList<>();
+    private ExtOperatorValue opVal = new ExtOperatorValue((byte) 1, new byte[100]);
+    private ExtOperatorValue opVal1 = new ExtOperatorValue((byte) 1, new byte[200]);
+    private ExtFlowTypes.ExtType type = ExtFlowTypes.ExtType.PACKET_LENGTH_LIST;
+
+    @Test
+    public void basics() {
+        packetLength.add(opVal);
+        packetLength1.add(opVal1);
+        DefaultExtPacketLength data = new DefaultExtPacketLength(packetLength, type);
+        DefaultExtPacketLength sameAsData = new DefaultExtPacketLength(packetLength, type);
+        DefaultExtPacketLength diffData = new DefaultExtPacketLength(packetLength1, type);
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+                .addEqualityGroup(diffData).testEquals();
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtPortTest.java b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtPortTest.java
new file mode 100644
index 0000000..9e41e6c
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtPortTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+        import com.google.common.testing.EqualsTester;
+        import org.junit.Test;
+
+        import java.util.ArrayList;
+        import java.util.List;
+
+/**
+ * Test for extended icmp type value attribute.
+ */
+public class DefaultExtPortTest {
+
+    private List<ExtOperatorValue> port = new ArrayList<>();
+    private List<ExtOperatorValue> port1 = new ArrayList<>();
+    private ExtOperatorValue opVal = new ExtOperatorValue((byte) 1, new byte[100]);
+    private ExtOperatorValue opVal1 = new ExtOperatorValue((byte) 1, new byte[200]);
+    private ExtFlowTypes.ExtType type = ExtFlowTypes.ExtType.IN_PORT_LIST;
+
+    @Test
+    public void basics() {
+        port.add(opVal);
+        port1.add(opVal1);
+        DefaultExtPort data = new DefaultExtPort(port, type);
+        DefaultExtPort sameAsData = new DefaultExtPort(port, type);
+        DefaultExtPort diffData = new DefaultExtPort(port1, type);
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+                .addEqualityGroup(diffData).testEquals();
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtPrefixTest.java b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtPrefixTest.java
new file mode 100644
index 0000000..71eb9e8
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtPrefixTest.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+        import com.google.common.testing.EqualsTester;
+        import org.junit.Test;
+        import org.onlab.packet.IpAddress;
+        import org.onlab.packet.IpPrefix;
+
+        import java.util.ArrayList;
+        import java.util.List;
+
+/**
+ * Test for extended prefix value attribute.
+ */
+public class DefaultExtPrefixTest {
+
+    private List<IpPrefix> prefix = new ArrayList<>();
+    private List<IpPrefix> prefix1 = new ArrayList<>();
+    private IpAddress address = IpAddress.valueOf("192.168.1.1");
+    private IpPrefix opVal = IpPrefix.valueOf(address, 16);
+    private IpPrefix opVal1 = IpPrefix.valueOf(address, 20);
+    private ExtFlowTypes.ExtType type = ExtFlowTypes.ExtType.IPV4_DST_PFX;
+
+    @Test
+    public void basics() {
+        prefix.add(opVal);
+        prefix1.add(opVal1);
+        DefaultExtPrefix data = new DefaultExtPrefix(prefix, type);
+        DefaultExtPrefix sameAsData = new DefaultExtPrefix(prefix, type);
+        DefaultExtPrefix diffData = new DefaultExtPrefix(prefix1, type);
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+                .addEqualityGroup(diffData).testEquals();
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtTargetTest.java b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtTargetTest.java
new file mode 100644
index 0000000..2f8c37c
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtTargetTest.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Test for extended t value target ttribute.
+ */
+public class DefaultExtTargetTest {
+    private List<IpPrefix> prefix = new ArrayList<>();
+    private List<IpPrefix> prefix1 = new ArrayList<>();
+    private IpAddress address = IpAddress.valueOf("192.168.1.1");
+    private IpPrefix opVal = IpPrefix.valueOf(address, 16);
+    private IpPrefix opVal1 = IpPrefix.valueOf(address, 20);
+    private ExtFlowTypes.ExtType type = ExtFlowTypes.ExtType.IPV4_DST_PFX;
+    private ExtFlowTypes.ExtType typeThis = ExtFlowTypes.ExtType.WIDE_COMM_TARGET;
+
+    @Test
+    public void basics() {
+        prefix.add(opVal);
+        prefix1.add(opVal1);
+        DefaultExtPrefix localSpeaker = new DefaultExtPrefix(prefix, type);
+        DefaultExtPrefix remoteSpeaker = new DefaultExtPrefix(prefix, type);
+        DefaultExtPrefix localSpeaker1 = new DefaultExtPrefix(prefix1, type);
+        DefaultExtPrefix remoteSpeaker1 = new DefaultExtPrefix(prefix1, type);
+
+        DefaultExtTarget data = new DefaultExtTarget(localSpeaker, remoteSpeaker, typeThis);
+        DefaultExtTarget sameAsData = new DefaultExtTarget(localSpeaker, remoteSpeaker, typeThis);
+        DefaultExtTarget diffData = new DefaultExtTarget(localSpeaker1, remoteSpeaker1, typeThis);
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+                .addEqualityGroup(diffData).testEquals();
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtTcpFlagTest.java b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtTcpFlagTest.java
new file mode 100644
index 0000000..3ecedc1
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtTcpFlagTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Test for extended tcp flag value attribute.
+ */
+public class DefaultExtTcpFlagTest {
+
+    private List<ExtOperatorValue> tcpFlag = new ArrayList<>();
+    private List<ExtOperatorValue> tcpFlag1 = new ArrayList<>();
+    private ExtOperatorValue opVal = new ExtOperatorValue((byte) 1, new byte[100]);
+    private ExtOperatorValue opVal1 = new ExtOperatorValue((byte) 1, new byte[200]);
+    private ExtFlowTypes.ExtType type = ExtFlowTypes.ExtType.TCP_FLAG_LIST;
+
+    @Test
+    public void basics() {
+        tcpFlag.add(opVal);
+        tcpFlag1.add(opVal1);
+        DefaultExtTcpFlag data = new DefaultExtTcpFlag(tcpFlag, type);
+        DefaultExtTcpFlag sameAsData = new DefaultExtTcpFlag(tcpFlag, type);
+        DefaultExtTcpFlag diffData = new DefaultExtTcpFlag(tcpFlag1, type);
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+                .addEqualityGroup(diffData).testEquals();
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtTrafficActionTest.java b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtTrafficActionTest.java
new file mode 100644
index 0000000..4f42a39
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtTrafficActionTest.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+
+/**
+ * Test for extended traffic action value attribute.
+ */
+public class DefaultExtTrafficActionTest {
+
+    private boolean terminal = true;
+    private boolean sample = true;
+    private boolean rpd = true;
+    private boolean terminal1 = false;
+    private boolean sample1 = false;
+    private boolean rpd1 = false;
+    private ExtFlowTypes.ExtType type = ExtFlowTypes.ExtType.TRAFFIC_ACTION;
+
+    @Test
+    public void basics() {
+
+        DefaultExtTrafficAction data = new DefaultExtTrafficAction(terminal, sample, rpd, type);
+        DefaultExtTrafficAction sameAsData = new DefaultExtTrafficAction(terminal, sample, rpd, type);
+        DefaultExtTrafficAction diffData = new DefaultExtTrafficAction(terminal1, sample1, rpd1, type);
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+                .addEqualityGroup(diffData).testEquals();
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtTrafficMarkingTest.java b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtTrafficMarkingTest.java
new file mode 100644
index 0000000..adee1ac
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtTrafficMarkingTest.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+
+/**
+ * Test for extended traffic marking value attribute.
+ */
+public class DefaultExtTrafficMarkingTest {
+
+    private byte marking = 01;
+    private byte marking1 = 02;
+    private ExtFlowTypes.ExtType type = ExtFlowTypes.ExtType.TRAFFIC_MARKING;
+
+    @Test
+    public void basics() {
+        DefaultExtTrafficMarking data = new DefaultExtTrafficMarking(marking, type);
+        DefaultExtTrafficMarking sameAsData = new DefaultExtTrafficMarking(marking, type);
+        DefaultExtTrafficMarking diffData = new DefaultExtTrafficMarking(marking1, type);
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+                .addEqualityGroup(diffData).testEquals();
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtTrafficRateTest.java b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtTrafficRateTest.java
new file mode 100644
index 0000000..f772e11
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtTrafficRateTest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+
+/**
+ * Test for extended traffic rate value attribute.
+ */
+public class DefaultExtTrafficRateTest {
+
+    private Short asn = new Short((short) 1);
+    private Float rate = new Float(1.0);
+    private Short asn1 = new Short((short) 2);
+    private Float rate1 = new Float(1.0);
+    private ExtFlowTypes.ExtType type = ExtFlowTypes.ExtType.TRAFFIC_RATE;
+
+    @Test
+    public void basics() {
+        DefaultExtTrafficRate data = new DefaultExtTrafficRate(asn, rate, type);
+        DefaultExtTrafficRate sameAsData = new DefaultExtTrafficRate(asn, rate, type);
+        DefaultExtTrafficRate diffData = new DefaultExtTrafficRate(asn1, rate1, type);
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+                .addEqualityGroup(diffData).testEquals();
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtTrafficRedirectTest.java b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtTrafficRedirectTest.java
new file mode 100644
index 0000000..00ee162
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtTrafficRedirectTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+
+/**
+ * Test for extended traffic redirect value attribute.
+ */
+public class DefaultExtTrafficRedirectTest {
+
+    String redirect = new String("vpnid1");
+    String redirect1 = new String("vpnid2");
+    private ExtFlowTypes.ExtType type = ExtFlowTypes.ExtType.TRAFFIC_REDIRECT;
+
+    @Test
+    public void basics() {
+
+        DefaultExtTrafficRedirect data = new DefaultExtTrafficRedirect(redirect, type);
+        DefaultExtTrafficRedirect sameAsData = new DefaultExtTrafficRedirect(redirect, type);
+        DefaultExtTrafficRedirect diffData = new DefaultExtTrafficRedirect(redirect1, type);
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+                .addEqualityGroup(diffData).testEquals();
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtWideCommunityIntTest.java b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtWideCommunityIntTest.java
new file mode 100644
index 0000000..f209217
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/DefaultExtWideCommunityIntTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Test for extended wide community value attribute.
+ */
+public class DefaultExtWideCommunityIntTest {
+
+    private List<Integer> wCommInt = new ArrayList<>();
+    private List<Integer> wCommInt1 = new ArrayList<>();
+    private Integer opVal = new Integer(1);
+    private Integer opVal1 = new Integer(2);
+    private ExtFlowTypes.ExtType type = ExtFlowTypes.ExtType.WIDE_COMM_COMMUNITY;
+
+    @Test
+    public void basics() {
+        wCommInt.add(opVal);
+        wCommInt1.add(opVal1);
+        DefaultExtWideCommunityInt data = new DefaultExtWideCommunityInt(wCommInt, type);
+        DefaultExtWideCommunityInt sameAsData = new DefaultExtWideCommunityInt(wCommInt, type);
+        DefaultExtWideCommunityInt diffData = new DefaultExtWideCommunityInt(wCommInt1, type);
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+                .addEqualityGroup(diffData).testEquals();
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/ExtFlowContainerTest.java b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/ExtFlowContainerTest.java
new file mode 100644
index 0000000..e8113ce
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/ExtFlowContainerTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Test for extended flow container value attribute.
+ */
+public class ExtFlowContainerTest {
+
+    private List<ExtFlowTypes> container = new ArrayList<>();
+    private List<ExtFlowTypes> container1 = new ArrayList<>();
+    private ExtFlowTypes.ExtType type = ExtFlowTypes.ExtType.EXT_FLOW_RULE_KEY;
+    ExtFlowTypes val = new DefaultExtKeyName("Name", type);
+    ExtFlowTypes val1 = new DefaultExtKeyName("Name1", type);
+
+    @Test
+    public void basics() {
+        container.add(val);
+        container1.add(val1);
+        ExtFlowContainer data = new ExtFlowContainer(container);
+        ExtFlowContainer sameAsData = new ExtFlowContainer(container);
+        ExtFlowContainer diffData = new ExtFlowContainer(container1);
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+                .addEqualityGroup(diffData).testEquals();
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/ExtOperatorValueTest.java b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/ExtOperatorValueTest.java
new file mode 100644
index 0000000..8e9e3b7
--- /dev/null
+++ b/apps/bgpflowspec/flowapi/src/test/java/org/onosproject/flowapi/ExtOperatorValueTest.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2016-present 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.flowapi;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for ExtOperatorValue flow specification component.
+ */
+public class ExtOperatorValueTest {
+    ExtOperatorValue tlv1 = new ExtOperatorValue((byte) 1, new byte[100]);
+    ExtOperatorValue sameAsTlv1 = new ExtOperatorValue((byte) 1, new byte[100]);
+    ExtOperatorValue tlv2 = new ExtOperatorValue((byte) 1, new byte[200]);
+
+    @Test
+    public void testEquality() {
+        new EqualsTester()
+                .addEqualityGroup(tlv1, sameAsTlv1)
+                .addEqualityGroup(tlv2)
+                .testEquals();
+    }
+}
diff --git a/apps/bgpflowspec/flowmgr/BUCK b/apps/bgpflowspec/flowmgr/BUCK
new file mode 100755
index 0000000..dd7ae7e
--- /dev/null
+++ b/apps/bgpflowspec/flowmgr/BUCK
@@ -0,0 +1,10 @@
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//core/store/serializers:onos-core-serializers',
+    '//apps/bgpflowspec/flowapi:onos-apps-bgpflowspec-flowapi',
+]
+
+osgi_jar_with_tests (
+    name = 'onos-apps-bgpflowspec-flowmgr',
+    deps = COMPILE_DEPS,
+)
diff --git a/apps/bgpflowspec/flowmgr/pom.xml b/apps/bgpflowspec/flowmgr/pom.xml
new file mode 100755
index 0000000..5d9afbe
--- /dev/null
+++ b/apps/bgpflowspec/flowmgr/pom.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2015 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.
+  -->
+<project
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-app-bgpflow</artifactId>
+        <version>1.6.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>onos-app-bgp-flowmgr</artifactId>
+    <packaging>bundle</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>javax.ws.rs-api</artifactId>
+            <version>2.0.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.console</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-app-bgp-flowapi</artifactId>
+            <version>1.6.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/forwarder/BgpFlowForwarderService.java b/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/forwarder/BgpFlowForwarderService.java
new file mode 100755
index 0000000..e2527b9
--- /dev/null
+++ b/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/forwarder/BgpFlowForwarderService.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2016-present 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.flow.forwarder;
+
+import org.onosproject.flowapi.ExtFlowContainer;
+
+/**
+ * Abstraction of an entity which provides Bgp Flow Service.
+ */
+public interface BgpFlowForwarderService {
+
+    /**
+     * Install forwarding rule.
+     *
+     * @param container BgpFlow container
+     * @return a true if success else false
+     */
+    boolean installForwardingRule(ExtFlowContainer container);
+
+    /**
+     * Uninstall forwarding rule.
+     *
+     * @param container BgpFlow container
+     * @return a true if success else false
+     */
+    boolean unInstallForwardingRule(ExtFlowContainer container);
+}
diff --git a/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/forwarder/impl/BgpFlowForwarderImpl.java b/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/forwarder/impl/BgpFlowForwarderImpl.java
new file mode 100755
index 0000000..bc5170d
--- /dev/null
+++ b/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/forwarder/impl/BgpFlowForwarderImpl.java
@@ -0,0 +1,208 @@
+/*
+ * Copyright 2016-present 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.flow.forwarder.impl;
+
+import org.onosproject.core.ApplicationId;
+import org.onosproject.flow.forwarder.BgpFlowForwarderService;
+
+import org.onosproject.flowapi.ExtFlowContainer;
+import org.onosproject.net.Annotations;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.behaviour.ExtensionSelectorResolver;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.driver.DriverHandler;
+import org.onosproject.net.driver.DriverService;
+import org.onosproject.net.flow.DefaultTrafficSelector;
+import org.onosproject.net.flow.DefaultTrafficTreatment;
+import org.onosproject.net.flow.TrafficSelector;
+import org.onosproject.net.flow.TrafficTreatment;
+import org.onosproject.net.flow.criteria.ExtensionSelector;
+import org.onosproject.net.flowobjective.DefaultForwardingObjective;
+import org.onosproject.net.flowobjective.FlowObjectiveService;
+import org.onosproject.net.flowobjective.ForwardingObjective;
+import org.onosproject.net.flowobjective.ForwardingObjective.Flag;
+import org.onosproject.net.flowobjective.Objective;
+import org.slf4j.Logger;
+
+import java.util.Iterator;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.onosproject.net.flow.criteria.ExtensionSelectorType.ExtensionSelectorTypes.EXT_MATCH_FLOW_TYPE;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Provides Bgp flow forwarder implementation.
+ */
+public class BgpFlowForwarderImpl implements BgpFlowForwarderService {
+
+    protected DriverService driverService;
+    protected DeviceService deviceService;
+    protected FlowObjectiveService flowObjectiveService;
+    private final Logger log = getLogger(getClass());
+    protected ApplicationId appId;
+
+    private static final String BGP_FLOW_CONTAINER_NOT_NULL = "Bgp flow container cannot be null";
+    private static final String APP_ID_NOT_NULL = "Application-Id cannot be null";
+    public static final String FLOW_PEER = "flowPeer";
+
+    /**
+     * Default constructor.
+     */
+    public BgpFlowForwarderImpl() {
+    }
+
+    /**
+     * Explicit constructor.
+     *
+     * @param appId Application id
+     * @param flowObjectiveService flow service
+     * @param deviceService device service
+     * @param driverService driver service
+     */
+    public BgpFlowForwarderImpl(ApplicationId appId, FlowObjectiveService flowObjectiveService,
+                                DeviceService deviceService, DriverService driverService) {
+        this.appId = checkNotNull(appId, APP_ID_NOT_NULL);
+        this.flowObjectiveService = flowObjectiveService;
+        this.deviceService = deviceService;
+        this.driverService = driverService;
+    }
+
+    @Override
+    public boolean installForwardingRule(ExtFlowContainer container) {
+        checkNotNull(container, BGP_FLOW_CONTAINER_NOT_NULL);
+        return pushBgpFlowRuleForwarder(container, Objective.Operation.ADD);
+    }
+
+    @Override
+    public boolean unInstallForwardingRule(ExtFlowContainer container) {
+        checkNotNull(container, BGP_FLOW_CONTAINER_NOT_NULL);
+        return pushBgpFlowRuleForwarder(container, Objective.Operation.REMOVE);
+    }
+
+    /**
+     * Find the bgp device and push the rule.
+     *
+     * @param container is a flow rule container
+     * @param type either add or remove the service rule
+     * @return a true if success else false
+     */
+    public boolean pushBgpFlowRuleForwarder(ExtFlowContainer container,
+                                             Objective.Operation type) {
+        DeviceId deviceId = null;
+
+        Iterable<Device> devices = deviceService.getAvailableDevices();
+        Iterator<Device> itr = devices.iterator();
+        while (itr.hasNext()) {
+            DeviceId tmp = itr.next().id();
+            if (tmp.toString().equals(container.deviceId())) {
+                if (validatePeer(tmp)) {
+                    deviceId = tmp;
+                    break;
+                }
+            }
+        }
+
+        if (deviceId != null) {
+            // pack traffic selector
+            TrafficSelector.Builder selector = packTrafficSelector(deviceId, container);
+
+            // pack traffic treatment
+            TrafficTreatment.Builder treatment = packTrafficTreatment(container);
+
+            sendBgpFlowRuleForwarder(selector, treatment, deviceId, type);
+        } else {
+            log.error("Bgp devices are not available..");
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Validates the device id is a flow peer or not.
+     *
+     * @param deviceId device to which the flow needed to be pushed.
+     * @return true if success else false
+     */
+    boolean validatePeer(DeviceId deviceId) {
+        boolean ret = false;
+        Device d = deviceService.getDevice(deviceId);
+        Annotations a = d != null ? d.annotations() : null;
+        String ipAddress = a.value(FLOW_PEER);
+        if (ipAddress != null) {
+            ret = true;
+        }
+        return ret;
+    }
+
+    /**
+     * Traffic selector builder function.
+     *
+     * @param deviceId device id.
+     * @param container container need to be pushed.
+     * @return the traffic selector builder
+     */
+    public TrafficSelector.Builder packTrafficSelector(DeviceId deviceId, ExtFlowContainer container) {
+        TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
+
+        DriverHandler handler = driverService.createHandler(deviceId);
+        ExtensionSelectorResolver resolver = handler.behaviour(ExtensionSelectorResolver.class);
+        ExtensionSelector bgpExtSelector = resolver.getExtensionSelector(EXT_MATCH_FLOW_TYPE.type());
+
+        try {
+            bgpExtSelector.setPropertyValue("container", container);
+        } catch (Exception e) {
+            log.error("Failed to get extension instruction for bgp flow {}", deviceId);
+        }
+
+        selector.extension(bgpExtSelector, deviceId);
+        return selector;
+    }
+
+    /**
+     * Traffic treatment builder function.
+     *
+     * @param container container need to be pushed.
+     * @return the traffic treatment builder
+     */
+    public TrafficTreatment.Builder packTrafficTreatment(ExtFlowContainer container) {
+        TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
+
+        return treatment;
+    }
+
+    /**
+     * Send bgp flow forwarder to bgp provider.
+     *
+     * @param selector traffic selector
+     * @param treatment traffic treatment
+     * @param deviceId device id
+     * @param type operation type
+     */
+    public void sendBgpFlowRuleForwarder(TrafficSelector.Builder selector, TrafficTreatment.Builder treatment,
+            DeviceId deviceId, Objective.Operation type) {
+        ForwardingObjective.Builder objective = DefaultForwardingObjective.builder().withTreatment(treatment.build())
+                .withSelector(selector.build()).fromApp(appId).makePermanent().withFlag(Flag.VERSATILE);
+        if (type.equals(Objective.Operation.ADD)) {
+            log.debug("ADD");
+            flowObjectiveService.forward(deviceId, objective.add());
+        } else {
+            log.debug("REMOVE");
+            flowObjectiveService.forward(deviceId, objective.remove());
+        }
+    }
+}
diff --git a/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/forwarder/impl/package-info.java b/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/forwarder/impl/package-info.java
new file mode 100755
index 0000000..4ae602f
--- /dev/null
+++ b/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/forwarder/impl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present 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.
+ */
+
+/**
+ * Bgp service manager for interacting with bgp provider.
+ */
+package org.onosproject.flow.forwarder.impl;
diff --git a/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/forwarder/package-info.java b/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/forwarder/package-info.java
new file mode 100755
index 0000000..0000150
--- /dev/null
+++ b/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/forwarder/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present 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.
+ */
+
+/**
+ * Service forwarder for bgp flow.
+ */
+package org.onosproject.flow.forwarder;
diff --git a/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/manager/BgpFlowService.java b/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/manager/BgpFlowService.java
new file mode 100755
index 0000000..cf7aada
--- /dev/null
+++ b/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/manager/BgpFlowService.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2016-present 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.flow.manager;
+
+import org.onosproject.flowapi.ExtFlowContainer;
+
+/**
+ * Bgp flow service application.
+ */
+public interface BgpFlowService {
+
+    /**
+     * Bgp flow rule create interface.
+     *
+     * @param container flow container class
+     * @return true if success else false
+     */
+    boolean onBgpFlowCreated(ExtFlowContainer container);
+
+    /**
+     * Bgp flow rule delete interface.
+     *
+     * @param container flow container class
+     * @return true if success else false
+     */
+    boolean onBgpFlowDeleted(ExtFlowContainer container);
+}
diff --git a/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/manager/impl/BgpFlowManager.java b/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/manager/impl/BgpFlowManager.java
new file mode 100755
index 0000000..deccf38
--- /dev/null
+++ b/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/manager/impl/BgpFlowManager.java
@@ -0,0 +1,83 @@
+/*
+ * 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.flow.manager.impl;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.flow.forwarder.BgpFlowForwarderService;
+import org.onosproject.flow.forwarder.impl.BgpFlowForwarderImpl;
+import org.onosproject.flow.manager.BgpFlowService;
+import org.onosproject.flowapi.ExtFlowContainer;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.driver.DriverService;
+import org.onosproject.net.flowobjective.FlowObjectiveService;
+import org.slf4j.Logger;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Provides implementation of Bgp flow Service.
+ */
+@Component(immediate = true)
+@Service
+public class BgpFlowManager implements BgpFlowService {
+
+    private final Logger log = getLogger(getClass());
+    private static final String APP_ID = "org.onosproject.app.bgpflow";
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CoreService coreService;
+
+    protected ApplicationId appId;
+    private BgpFlowForwarderService bgpFlowForwarderService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected DriverService driverService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected DeviceService deviceService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected FlowObjectiveService flowObjectiveService;
+
+    @Activate
+    public void activate() {
+        appId = coreService.registerApplication(APP_ID);
+        bgpFlowForwarderService = new BgpFlowForwarderImpl(appId, flowObjectiveService, deviceService, driverService);
+        log.info("Started");
+    }
+
+    @Deactivate
+    public void deactivate() {
+        log.info("Stopped");
+    }
+
+    @Override
+    public boolean onBgpFlowCreated(ExtFlowContainer container) {
+        return bgpFlowForwarderService.installForwardingRule(container);
+    }
+
+    @Override
+    public boolean onBgpFlowDeleted(ExtFlowContainer container) {
+        return bgpFlowForwarderService.unInstallForwardingRule(container);
+    }
+}
diff --git a/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/manager/impl/package-info.java b/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/manager/impl/package-info.java
new file mode 100755
index 0000000..e686bb8
--- /dev/null
+++ b/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/manager/impl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present 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.
+ */
+
+/**
+ * Bgp service manager for interacting provider.
+ */
+package org.onosproject.flow.manager.impl;
diff --git a/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/manager/package-info.java b/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/manager/package-info.java
new file mode 100755
index 0000000..b3ba1cb
--- /dev/null
+++ b/apps/bgpflowspec/flowmgr/src/main/java/org/onosproject/flow/manager/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present 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.
+ */
+
+/**
+ * Bgp flow manager.
+ */
+package org.onosproject.flow.manager;
diff --git a/apps/bgpflowspec/pom.xml b/apps/bgpflowspec/pom.xml
new file mode 100755
index 0000000..1ce57ca
--- /dev/null
+++ b/apps/bgpflowspec/pom.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2016-present 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-apps</artifactId>
+        <version>1.6.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>onos-app-bgpflow</artifactId>
+    <packaging>pom</packaging>
+
+    <description>ONOS bgp flow spec applications</description>
+
+    <modules>
+        <module>app</module>
+        <module>flowapi</module>
+        <module>flowmgr</module>
+        <module>bgpweb</module>
+    </modules>
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onlab-junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava-testlib</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymock</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onlab-osgi</artifactId>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-api</artifactId>
+            <scope>test</scope>
+            <classifier>tests</classifier>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.jersey.containers</groupId>
+            <artifactId>jersey-container-servlet</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.jersey.test-framework</groupId>
+            <artifactId>jersey-test-framework-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.jersey.test-framework.providers</groupId>
+            <artifactId>jersey-test-framework-provider-jetty</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/apps/pom.xml b/apps/pom.xml
index 0479658..c6cc9c6 100644
--- a/apps/pom.xml
+++ b/apps/pom.xml
@@ -42,6 +42,7 @@
         <module>reactive-routing</module>
         <module>virtualbng</module>
         <module>bgprouter</module>
+        <module>bgpflowspec</module>
         <module>test</module>
         <module>segmentrouting</module>
         <module>xos-integration</module>