diff --git a/ipfix/NOTICE.txt b/ipfix/NOTICE.txt
new file mode 100644
index 0000000..258f9e5
--- /dev/null
+++ b/ipfix/NOTICE.txt
@@ -0,0 +1,8 @@
+Code in the org.onosproject.ipfix.packet package is developed
+and modified from the source of jFlowLib library, which is the
+open source software and it is originally developed by 
+DE-CIX Management GmbH <http://www.de-cix.net> 
+and by the author Thomas King <thomas.king@de-cix.net>
+It is licensed under Apache License 2.0. 
+More information about jFlowLib library can be found on GitHub at
+https://github.com/de-cix/jFlowLib
\ No newline at end of file
diff --git a/ipfix/README.md b/ipfix/README.md
new file mode 100644
index 0000000..4882128
--- /dev/null
+++ b/ipfix/README.md
@@ -0,0 +1,150 @@
+ONOS IPFIX demo application
+===========================
+
+##Introduction
+ONOS IPFIX application is the demo application that shows the concept of the OpenFlow statistics export over IPFIX protocol and possibly other similar protocols (e.g NetFlow).
+
+Currently, application supports two scenarios of the OpenFlow statistics export:
+ 1. Export of the flow statistics for ONOS Reactive Forwarding application flows.
+ 2. Export of the switch port statistics
+
+The intent of the application is to demonstrate the concept which can be possibly extended to export OpenFlow flow statistics for other ONOS applications, like bgprouter, sdnip, mfwd, etc. 
+
+
+
+#User guide
+
+###Installation
+ONOS IPFIX requires at least ONOS version 1.3.
+
+ONOS IPFIX application can be downloaded from the onos-app-samples GIT repository with the following command:
+```
+git clone https://gerrit.onosproject.org/onos-app-samples.git
+```
+Enter the ONOS IPFIX application directory and compile the application:
+```
+cd onos-app-samples/onos-app-ipfix
+mvn clean install
+```
+After successful compilation of the application, it can be installed on the running ONOS instance with the following command:
+```
+onos-app <ip-address-of-ONOS-instance> reinstall! target/onos-app-ipfix-1.3.0-SNAPSHOT.oar
+```
+
+###General configuration
+ONOS IPFIX application generally requires that user configures IP address and port of the IPFIX collector. This is configured with the following ONOS configuration commands:
+```
+set org.onosporject.ipfix.IpfixManager CollectorAddress <ip-address>
+cfg set org.onosporject.ipfix.IpfixManager CollectorPort <udp-port>
+```
+IPFIX packets are transported over UDP and default port is 2055. 
+
+###Flow statistics export for ONOS Reactive Forwarding application
+The export of the Flow statistics for ONOS Reactive Forwarding application is enabled by default. It is realized over Flow Rule Listener. When the flow rule created by the ONOS reactive forwarding application is removed from ONOS, IPFIX application will collect its statistics, covert them to the appropriate IPFIX format and export them over IPFIX protocol.
+
+Currently, ONOS IPFIX supports three IPFIX record templates that are used for exporting of these flows:
+
+ - **MAC template** (template ID = 331) - matches only MAC addresses, VLAN and switch ports. This template is used with default configuration of the reactive forwarding application that matches only source and destination MAC address and input port. This template has following IPFIX information elements (IEs):
+	- ID 130 - *exporterIPv4Address* - IPv4 address of the OpenFlow switch where flow was installed.
+	- ID 131 - *exporterIPv6Address* - OpenFlow switch DPID where flow was installed is embedded in the last 8 bytes of the fields.
+	- ID - 152 - *flowStartMilliseconds* - The absolute timestamp when the flow is installed by ONOS at the switch.
+	- ID - 153 - *flowEndMilliseconds* - The absolute timestamp when the flow is removed by the ONOS from the switch. 
+	- ID 1 - *octetDeltaCount* - number of bytes matched by the flow.
+	- ID 2 - *packeDeltaCount* - number of packets matched by the flow.
+	- ID 10 - *ingressInterface* - OpenFlow switch input port of the flow. 
+	- ID 14 - *egressInterface* - OpenFlow switch output port from the flow rule action structure. 
+	- ID 56 - *sourceMacAddress* - source MAC address matched by the flow rule.
+	- ID 80 - *destinationMacAddress* - destination MAC address matched by the flow rule. 
+	- ID 256 - *etherType* - Ethertype field matched by flow rule (0 if not matched) 
+	- ID 14 - *vlanId* - VLAN ID matched by the flow rule (0 if not matched)
+
+ - **IPv4 template** (template ID = 332) - matches MAC template with addition to IPv4 addresses, Protocol, DSCP and TCP/UDP port. This template will be used if the matching of the IPv4 address is enabled in the ONOS Reactive Forwarding Application. This template has following IPFIX information elements (IEs) in addition to MAC template:
+	- ID 8 - *sourceIPv4Address* - source IPv4 address matched by the flow rule.
+	- ID 12 - *destinationIPv4Address* - destination IPv4 address matched by the flow rule. 
+	- ID 4 - *protocolIdentifier* - IPv4Protocol field matched by flow rule (255 if not matched) 
+	- ID 5 - *ipClassOfService* - IPv4 ToS field matched by the flow rule, constructed from DSCP and ECN OpenFlow matching conditions (0 if not matched).
+	- ID 7 - *sourceTransportPort* - source TCP/UDP port matched by the flow rule.
+	- ID 11 - *destinationTransportPort* - destination TCP/UDP port matched by the flow rule.
+
+
+ - **IPv6 template** (template ID = 333) - matches MAC template with addition to IPv6 addresses, Next-Header, Flow Label and TCP/UDP port. This template will be used if the matching of the IPv6 address is enabled in the ONOS Reactive Forwarding application. This template has following IPFIX information elements (IEs) in addition to MAC template:
+	- ID 27 - *sourceIPv6Address* - source IPv6 address matched by the flow rule.
+	- ID 28 - *destinationIPv6Address* - destination IPv6 address matched by the flow rule. 
+	- ID 31 - *flowLabel* - IPv6 Flow Label field matched by flow rule (0 if not matched) 
+	- ID 4 - *protocolIdentifier* - IPv4Protocol field matched by flow rule (255 if not matched) 
+	- ID 5 - *ipClassOfService* - IPv4 ToS field matched by the flow rule, constructed from DSCP and ECN OpenFlow matching conditions (0 if not matched).
+	- ID 7 - *sourceTransportPort* - source TCP/UDP port matched by the flow rule.
+	- ID 11 - *destinationTransportPort* - destination TCP/UDP port matched by the flow rule.
+
+User can enable matching of the IPv4 address and other IPv4 fields in ONOS Reactive Forwarding application with following ONOS commands:
+```
+cfg set org.onosproject.fwd.ReactiveForwarding matchIpv4Addresses true
+cfg set org.onosproject.fwd.ReactiveForwarding matchIpv4Dscp true
+```
+
+User can enable matching of the IPv4 address and other IPv4 fields in ONOS Reactive Forwarding application with following ONOS commands:
+```
+cfg set org.onosproject.proxyarp.ProxyArp ipv6NeighborDiscovery true
+cfg set org.onosproject.provider.host.impl.HostLocationProvider ipv6NeighborDiscovery true
+cfg set org.onosproject.fwd.ReactiveForwarding ipv6Forwarding true
+cfg set org.onosproject.fwd.ReactiveForwarding matchIpv6Addresses true
+cfg set org.onosproject.fwd.ReactiveForwarding matchIpv6FlowLabel true
+```
+
+User can enable matching of the VLAN, TCP/UDP ports and ICMP type and code fields in ONOS Reactive Forwarding application with following ONOS commands:
+```
+cfg set org.onosproject.fwd.ReactiveForwarding matchVlan true
+cfg set org.onosproject.fwd.ReactiveForwarding matchTcpUdpPorts true
+cfg set org.onosproject.fwd.ReactiveForwarding matchIcmpFields true
+```
+
+To disable IPFIX export of the flow statistics for Reactive Forwarding application flows use following ONOS command:
+```
+cfg set org.onosproject.ipfix.IpfixManager ReactiveForwardingExport false
+```
+
+###Export of the switch port statistics
+Export of the switch port statistics over IPFIX is disabled by default. 
+To enable it, use following ONOS command:
+```
+cfg set org.onosproject.ipfix.IpfixManager PortStatsFlowExport true
+```
+
+Export of the switch port statistics is realized over DeviceListener. When ONOS updates its internal port statistics for the OpenFlow switch, IPFIX application will export port statistics over IPFIX protocol. The export is done only by the ONOS instance that is “master” for the specific OpenFlow switch. 
+The exported values represent difference between switch port counters collected by ONOS in the current and the previous polling. Polling interval is controlled by the ONOS OpenFlow Device Provider which actually collects statistics and by default is very frequent on 5 seconds interval. IPFIX application will export port statistics for every ONOS update of the statistics. 
+It is recommended to configure ONOS port statistics polling interval to appropriate value with the following command:
+```
+cfg set org.onosproject.org.provider.of.device.impl.OpenFlowDeviceProvider PortStatsPollFrequency 30
+```
+
+The export of the switch port statistics uses two IPFIX record templates:
+
+ - **Received traffic** - Template ID 341
+ - **Transmitted traffic**-  Template ID 342
+
+These templates consist of the following information elements (IEs):
+
+- ID 130 - *exporterIPv4Address* - IPv4 address of the OpenFlow switch
+- ID 131 - *exporterIPv6Address* - OpenFlow switch DPID is embedded in the last 8 bytes of the fields
+- *ingressInterface* or *egressInterface* - switch port number:
+	- ID 10 - *ingressInterface* IE is used for received traffic statistics
+	- ID 14 - *egressInterface* IE is used for transmitted traffic statistics
+- ID 1 - *octetDeltaCount* - number of bytes received/transmitted on the port between two polling intervals
+- ID 2 - *packeDeltaCount* - number of packets received/transmitted on the port between two polling intervals
+- ID - 152 - *flowStartMilliseconds* - The absolute timestamp for the previous polling of the statistics
+- ID - 153 - *flowEndMilliseconds* - The absolute timestamp for the current polling of the statistics
+
+##Known shortcomings and issues
+The purpose of the application is demonstration of the possibility for export of the OpenFlow statistics over IPFIX protocol. For this reason, export of IPFIX records is realized in very simplified way:
+
+- For export of the Reactive Forwarding application flows, each flow (Data record) is exported with its corresponding Template record in a single UDP packet.
+- For export of switch port statistics, for each OpenFlow switch and each traffic direction single IPFIX packet is created. This packet has Template Record for corresponding traffic direction and Data records for each port of the OpenFlow switch.
+- Currently, export to only one IPFIX collector is supported.
+
+Some of the IPFIX analyzer application will use source IP address of the IPFIX packets to identify “IPFIX exporter”. Because the ONOS IPFIX application exports IPFIX records on behalf of OpenFlow switches, IPFIX packets have ONOS controller IP address. ONOS IPFIX application uses *exporterIPv4Address* and *exporterIPv6Address* to further identify OpenFlow switch that matched the flow and on which behalf statistics are exported:
+
+- The *exporterIPv4Address* IE has IPv4 address of the OpenFlow switch that is connected over OpenFlow channel to ONOS controller.
+- The *exporterIPv6Address* IE embeds the OpenFlow switch DPID in the last 8 bytes of the information element.
+
+
+
diff --git a/ipfix/pom.xml b/ipfix/pom.xml
new file mode 100644
index 0000000..20f55c3
--- /dev/null
+++ b/ipfix/pom.xml
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2014 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/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-app-samples</artifactId>
+        <version>1.3.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+                                        
+    <artifactId>onos-app-ipfix</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>OpenFlow statistics export over IPFIX</description>
+    <url>http://onosproject.org</url>
+
+    <properties>
+        <onos.app.name>org.onosproject.ipfix</onos.app.name>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onlab-osgi</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.11</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onlab-junit</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+                                                    
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-api</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+            <classifier>tests</classifier>
+        </dependency>
+
+        <dependency> 
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-of-api</artifactId>   
+            <version>${project.version}</version>
+        </dependency>
+                                                                        
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <version>5.0.0</version>
+        </dependency>
+                                                    
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+            <version>1.9.8</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.5.3</version>
+                <extensions>true</extensions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.5.1</version>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+                <version>1.20.0</version>
+                <executions>
+                    <execution>
+                        <id>generate-scr-srcdescriptor</id>
+                        <goals>
+                            <goal>scr</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <supportedProjectTypes>
+                        <supportedProjectType>bundle</supportedProjectType>
+                        <supportedProjectType>war</supportedProjectType>
+                    </supportedProjectTypes>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.onosproject</groupId>
+                <artifactId>onos-maven-plugin</artifactId>
+                <version>1.5</version>
+                <executions>
+                    <execution>
+                        <id>cfg</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>cfg</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>swagger</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>swagger</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>app</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>app</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/DataRecordPortStatsIn.java b/ipfix/src/main/java/org/onosproject/ipfix/DataRecordPortStatsIn.java
new file mode 100644
index 0000000..32341ac
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/DataRecordPortStatsIn.java
@@ -0,0 +1,116 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix;
+
+import java.util.List;
+
+import org.onlab.packet.Ip6Address;
+import org.onlab.packet.IpAddress;
+import org.onosproject.ipfix.packet.DataRecord;
+import org.onosproject.ipfix.packet.HeaderException;
+import org.onosproject.ipfix.packet.Ie;
+import org.onosproject.ipfix.packet.InformationElement;
+import org.onosproject.ipfix.packet.TemplateRecord;
+
+import com.google.common.primitives.Ints;
+import com.google.common.primitives.Longs;
+
+/**
+ * IPFIX Data record for switch port receive statistics.
+ */
+public class DataRecordPortStatsIn extends DataRecord {
+    public static final int TEMPLATE_ID = 341;
+    public static final int FIELD_COUNT = 7;
+    public static final int LENGTH = 56;
+
+    private IpAddress exporterIPv4Address;
+    private Ip6Address exporterIPv6Address;
+    private int ingressInterface;
+    private long octetDeltaCount;
+    private long packetDeltaCount;
+    private long flowStartMilliseconds;
+    private long flowEndMilliseconds;
+
+    /**
+     * IPFIX Data record for switch port receive statistics.
+     *
+     * @param exporterIpv4 IPv4 address of the IPFIX exporter
+     * @param exporterIpv6 IPv6 address of the IPFIX exporter, used for DPID
+     * @param intf Ingress/receiving interface number
+     * @param octets number of bytes received
+     * @param packets number of packets received
+     * @param start start timestamp of the flow
+     * @param end end timestamp of the flow
+     */
+    public DataRecordPortStatsIn(IpAddress exporterIpv4, Ip6Address exporterIpv6,
+            int intf, long octets, long packets, long start, long end) {
+
+        exporterIPv4Address = exporterIpv4;
+        exporterIPv6Address = exporterIpv6;
+        ingressInterface = intf;
+        octetDeltaCount = octets;
+        packetDeltaCount = packets;
+        flowStartMilliseconds = start;
+        flowEndMilliseconds = end;
+    }
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public byte[] getBytes() throws HeaderException {
+        try {
+            byte[] data = new byte[LENGTH];
+
+            System.arraycopy(exporterIPv4Address.toOctets(), 0, data, 0, 4);
+            System.arraycopy(exporterIPv6Address.toOctets(), 0, data, 4, 16);
+            System.arraycopy(Ints.toByteArray(ingressInterface), 0, data, 20, 4);
+            System.arraycopy(Longs.toByteArray(octetDeltaCount), 0, data, 24, 8);
+            System.arraycopy(Longs.toByteArray(packetDeltaCount), 0, data, 32, 8);
+            System.arraycopy(Longs.toByteArray(flowStartMilliseconds), 0, data, 40, 8);
+            System.arraycopy(Longs.toByteArray(flowEndMilliseconds), 0, data, 48, 8);
+
+            return data;
+        } catch (Exception e) {
+            throw new HeaderException("Error while generating the bytes: " + e.getMessage());
+        }
+    }
+
+    /**
+     * IPFIX Template Record for switch port receive statistics.
+     *
+     * @return TemplateRecord IPFIX Template Record
+     */
+    public static TemplateRecord portStatsInTemplateRecord() {
+
+        TemplateRecord tr = new TemplateRecord();
+        tr.setTemplateID(TEMPLATE_ID);
+        tr.setFieldCount(FIELD_COUNT);
+
+        List<InformationElement> ieTemp = tr.getInformationElements();
+
+        ieTemp.add(new InformationElement(Ie.exporterIPv4Address));
+        ieTemp.add(new InformationElement(Ie.exporterIPv6Address));
+        ieTemp.add(new InformationElement(Ie.ingressInterface));
+        ieTemp.add(new InformationElement(Ie.octetDeltaCount));
+        ieTemp.add(new InformationElement(Ie.packetDeltaCount));
+        ieTemp.add(new InformationElement(Ie.flowStartMilliseconds));
+        ieTemp.add(new InformationElement(Ie.flowEndMilliseconds));
+
+        return tr;
+    }
+}
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/DataRecordPortStatsOut.java b/ipfix/src/main/java/org/onosproject/ipfix/DataRecordPortStatsOut.java
new file mode 100644
index 0000000..74f6a78
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/DataRecordPortStatsOut.java
@@ -0,0 +1,117 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix;
+
+import java.util.List;
+
+import org.onlab.packet.Ip6Address;
+import org.onlab.packet.IpAddress;
+import org.onosproject.ipfix.packet.DataRecord;
+import org.onosproject.ipfix.packet.HeaderException;
+import org.onosproject.ipfix.packet.Ie;
+import org.onosproject.ipfix.packet.InformationElement;
+import org.onosproject.ipfix.packet.TemplateRecord;
+
+import com.google.common.primitives.Ints;
+import com.google.common.primitives.Longs;
+
+/**
+ * IPFIX Data record for switch port transmit statistics.
+ */
+public class DataRecordPortStatsOut extends DataRecord {
+    public static final int TEMPLATE_ID = 342;
+    public static final int FIELD_COUNT = 7;
+    public static final int LENGTH = 56;
+
+    private IpAddress exporterIPv4Address;
+    private Ip6Address exporterIPv6Address;
+    private int egressInterface;
+    private long octetDeltaCount;
+    private long packetDeltaCount;
+    private long flowStartMilliseconds;
+    private long flowEndMilliseconds;
+
+    /**
+     * IPFIX Data record for switch port transmit statistics.
+     *
+     * @param exporterIpv4 IPv4 address of the IPFIX exporter
+     * @param exporterIpv6 IPv6 address of the IPFIX exporter, used for DPID
+     * @param intf Egress/trasmiting interface number
+     * @param octets number of bytes trasmitted
+     * @param packets number of packets trasmitted
+     * @param start start timestamp of the flow
+     * @param end end timestamp of the flow
+     */
+    public DataRecordPortStatsOut(IpAddress exporterIpv4, Ip6Address exporterIpv6,
+            int intf, long octets, long packets, long start, long end) {
+
+        exporterIPv4Address = exporterIpv4;
+        exporterIPv6Address = exporterIpv6;
+        egressInterface = intf;
+        octetDeltaCount = octets;
+        packetDeltaCount = packets;
+        flowStartMilliseconds = start;
+        flowEndMilliseconds = end;
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public byte[] getBytes() throws HeaderException {
+        try {
+            byte[] data = new byte[LENGTH];
+
+            System.arraycopy(exporterIPv4Address.toOctets(), 0, data, 0, 4);
+            System.arraycopy(exporterIPv6Address.toOctets(), 0, data, 4, 16);
+            System.arraycopy(Ints.toByteArray(egressInterface), 0, data, 20, 4);
+            System.arraycopy(Longs.toByteArray(octetDeltaCount), 0, data, 24, 8);
+            System.arraycopy(Longs.toByteArray(packetDeltaCount), 0, data, 32, 8);
+            System.arraycopy(Longs.toByteArray(flowStartMilliseconds), 0, data, 40, 8);
+            System.arraycopy(Longs.toByteArray(flowEndMilliseconds), 0, data, 48, 8);
+
+            return data;
+        } catch (Exception e) {
+            throw new HeaderException("Error while generating the bytes: " + e.getMessage());
+        }
+    }
+
+    /**
+     * IPFIX template record for switch port transmit statistics.
+     *
+     * @return TemplateRecord IPFIX Template Record
+     */
+    public static TemplateRecord portStatsOutTemplateRecord() {
+
+        TemplateRecord tr = new TemplateRecord();
+        tr.setTemplateID(TEMPLATE_ID);
+        tr.setFieldCount(FIELD_COUNT);
+
+        List<InformationElement> ieTemp = tr.getInformationElements();
+
+        ieTemp.add(new InformationElement(Ie.exporterIPv4Address));
+        ieTemp.add(new InformationElement(Ie.exporterIPv6Address));
+        ieTemp.add(new InformationElement(Ie.egressInterface));
+        ieTemp.add(new InformationElement(Ie.octetDeltaCount));
+        ieTemp.add(new InformationElement(Ie.packetDeltaCount));
+        ieTemp.add(new InformationElement(Ie.flowStartMilliseconds));
+        ieTemp.add(new InformationElement(Ie.flowEndMilliseconds));
+
+        return tr;
+    }
+}
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/DataRecordRfwdIpv4.java b/ipfix/src/main/java/org/onosproject/ipfix/DataRecordRfwdIpv4.java
new file mode 100644
index 0000000..266bd8c
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/DataRecordRfwdIpv4.java
@@ -0,0 +1,192 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix;
+
+import java.util.List;
+
+import org.onlab.packet.Ip6Address;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.MacAddress;
+import org.onosproject.ipfix.packet.DataRecord;
+import org.onosproject.ipfix.packet.HeaderException;
+import org.onosproject.ipfix.packet.Ie;
+import org.onosproject.ipfix.packet.InformationElement;
+import org.onosproject.ipfix.packet.TemplateRecord;
+
+import com.google.common.primitives.Ints;
+import com.google.common.primitives.Longs;
+import com.google.common.primitives.Shorts;
+
+/**
+ * IPFIX Data record for Reactive Forwarding application with IPv4 fields matching.
+ */
+public class DataRecordRfwdIpv4 extends DataRecord {
+    public static final int TEMPLATE_ID = 332;
+    public static final int FIELD_COUNT = 18;
+    public static final int LENGTH = 90;
+
+    private IpAddress exporterIPv4Address;
+    private IpAddress exporterIPv6Address;
+    private long flowStartMilliseconds;
+    private long flowEndMilliseconds;
+    private long octetDeltaCount;
+    private long packetDeltaCount;
+    private int ingressInterface;
+    private int egressInterface;
+    private MacAddress sourceMacAddress;
+    private MacAddress destinationMacAddress;
+    private short ethernetType;
+    private short vlanId;
+    private IpAddress sourceIPv4Address;
+    private IpAddress destinationIPv4Address;
+    private byte protocolIdentifier;
+    private byte ipClassOfService;
+    private short sourceTransportPort;
+    private short destinationTransportPort;
+
+    //CHECKSTYLE:OFF
+    /**
+     * IPFIX Data record for Reactive Forwarding application with IPv4 fields matching.
+     *
+     * @param exporterIpv4 IPv4 address of the IPFIX exporter
+     * @param exporterIpv6 IPv6 address of the IPFIX exporter, used for DPID
+     * @param start start timestamp of the flow
+     * @param end end timestamp of the flow
+     * @param octets number of bytes matched by the flow
+     * @param packets number of packets matched by the flow
+     * @param intfIn switch input interface of the flow
+     * @param intfOut switch output interface of the flow
+     * @param srcMac source MAC address
+     * @param dstMac destination MAC address
+     * @param etherType etherType field of the flow
+     * @param vlan VLAN ID of the flow
+     * @param srcIp source IPv4 address of the flow
+     * @param dstIp destination IPv4 address of the flow
+     * @param proto IPv4 Protocol field of the flow
+     * @param tos IPv4 ToS field of the flow
+     * @param srcPort source tranport protocol port 
+     * @param dstPort destination transport protocol port
+     */
+    public DataRecordRfwdIpv4(IpAddress exporterIpv4,
+            Ip6Address exporterIpv6,
+            long start,
+            long end,
+            long octets,
+            long packets,
+            int intfIn,
+            int intfOut,
+            MacAddress srcMac,
+            MacAddress dstMac,
+            short etherType,
+            short vlan,
+            IpAddress srcIp,
+            IpAddress dstIp,
+            byte proto,
+            byte tos,
+            short srcPort,
+            short dstPort) {
+        //CHECKSTYLE:ON
+
+        exporterIPv4Address = exporterIpv4;
+        exporterIPv6Address = exporterIpv6;
+        flowStartMilliseconds = start;
+        flowEndMilliseconds = end;
+        octetDeltaCount = octets;
+        packetDeltaCount = packets;
+        ingressInterface = intfIn;
+        egressInterface = intfOut;
+        sourceMacAddress = srcMac;
+        destinationMacAddress = dstMac;
+        ethernetType = etherType;
+        vlanId = vlan;
+        sourceIPv4Address = srcIp;
+        destinationIPv4Address = dstIp;
+        protocolIdentifier = proto;
+        ipClassOfService = tos;
+        sourceTransportPort = srcPort;
+        destinationTransportPort = dstPort;
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public byte[] getBytes() throws HeaderException {
+        try {
+            byte[] data = new byte[LENGTH];
+
+            System.arraycopy(exporterIPv4Address.toOctets(), 0, data, 0, 4);
+            System.arraycopy(exporterIPv6Address.toOctets(), 0, data, 4, 16);
+            System.arraycopy(Longs.toByteArray(flowStartMilliseconds), 0, data, 20, 8);
+            System.arraycopy(Longs.toByteArray(flowEndMilliseconds), 0, data, 28, 8);
+            System.arraycopy(Longs.toByteArray(octetDeltaCount), 0, data, 36, 8);
+            System.arraycopy(Longs.toByteArray(packetDeltaCount), 0, data, 44, 8);
+            System.arraycopy(Ints.toByteArray(ingressInterface), 0, data, 52, 4);
+            System.arraycopy(Ints.toByteArray(egressInterface), 0, data, 56, 4);
+            System.arraycopy(sourceMacAddress.toBytes(), 0, data, 60, 6);
+            System.arraycopy(destinationMacAddress.toBytes(), 0, data, 66, 6);
+            System.arraycopy(Shorts.toByteArray(ethernetType), 0, data, 72, 2);
+            System.arraycopy(Shorts.toByteArray(vlanId), 0, data, 74, 2);
+            System.arraycopy(sourceIPv4Address.toOctets(), 0, data, 76, 4);
+            System.arraycopy(destinationIPv4Address.toOctets(), 0, data, 80, 4);
+            data[84] = protocolIdentifier;
+            data[85] = ipClassOfService;
+            System.arraycopy(Shorts.toByteArray(sourceTransportPort), 0, data, 86, 2);
+            System.arraycopy(Shorts.toByteArray(destinationTransportPort), 0, data, 88, 2);
+
+            return data;
+        } catch (Exception e) {
+            throw new HeaderException("Error while generating the bytes: " + e.getMessage());
+        }
+    }
+
+    /**
+     * IPFIX Template record for Reactive Forwarding application with IPv4 fields matching.
+     *
+     * @return TemplateRecord IPFIX Template Record
+     */
+    public static TemplateRecord getTemplateRecord() {
+
+        TemplateRecord tr = new TemplateRecord();
+        tr.setTemplateID(TEMPLATE_ID);
+        tr.setFieldCount(FIELD_COUNT);
+
+        List<InformationElement> ieTemp = tr.getInformationElements();
+
+        ieTemp.add(new InformationElement(Ie.exporterIPv4Address));
+        ieTemp.add(new InformationElement(Ie.exporterIPv6Address));
+        ieTemp.add(new InformationElement(Ie.flowStartMilliseconds));
+        ieTemp.add(new InformationElement(Ie.flowEndMilliseconds));
+        ieTemp.add(new InformationElement(Ie.octetDeltaCount));
+        ieTemp.add(new InformationElement(Ie.packetDeltaCount));
+        ieTemp.add(new InformationElement(Ie.ingressInterface));
+        ieTemp.add(new InformationElement(Ie.egressInterface));
+        ieTemp.add(new InformationElement(Ie.sourceMacAddress));
+        ieTemp.add(new InformationElement(Ie.destinationMacAddress));
+        ieTemp.add(new InformationElement(Ie.ethernetType));
+        ieTemp.add(new InformationElement(Ie.vlanId));
+        ieTemp.add(new InformationElement(Ie.sourceIPv4Address));
+        ieTemp.add(new InformationElement(Ie.destinationIPv4Address));
+        ieTemp.add(new InformationElement(Ie.protocolIdentifier));
+        ieTemp.add(new InformationElement(Ie.ipClassOfService));
+        ieTemp.add(new InformationElement(Ie.sourceTransportPort));
+        ieTemp.add(new InformationElement(Ie.destinationTransportPort));
+
+        return tr;
+    }
+}
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/DataRecordRfwdIpv6.java b/ipfix/src/main/java/org/onosproject/ipfix/DataRecordRfwdIpv6.java
new file mode 100644
index 0000000..a916f78
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/DataRecordRfwdIpv6.java
@@ -0,0 +1,198 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix;
+
+import java.util.List;
+
+import org.onlab.packet.Ip6Address;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.MacAddress;
+import org.onosproject.ipfix.packet.DataRecord;
+import org.onosproject.ipfix.packet.HeaderException;
+import org.onosproject.ipfix.packet.Ie;
+import org.onosproject.ipfix.packet.InformationElement;
+import org.onosproject.ipfix.packet.TemplateRecord;
+
+import com.google.common.primitives.Ints;
+import com.google.common.primitives.Longs;
+import com.google.common.primitives.Shorts;
+
+/**
+ * IPFIX Data record for Reactive Forwarding application with IPv4 fields matching.
+ */
+public class DataRecordRfwdIpv6 extends DataRecord {
+    public static final int TEMPLATE_ID = 333;
+    public static final int FIELD_COUNT = 19;
+    public static final int LENGTH = 118;
+
+    private IpAddress exporterIPv4Address;
+    private IpAddress exporterIPv6Address;
+    private long flowStartMilliseconds;
+    private long flowEndMilliseconds;
+    private long octetDeltaCount;
+    private long packetDeltaCount;
+    private int ingressInterface;
+    private int egressInterface;
+    private MacAddress sourceMacAddress;
+    private MacAddress destinationMacAddress;
+    private short ethernetType;
+    private short vlanId;
+    private Ip6Address sourceIPv6Address;
+    private Ip6Address destinationIPv6Address;
+    private int flowLabelIpv6;
+    private byte protocolIdentifier;
+    private byte ipClassOfService;
+    private short sourceTransportPort;
+    private short destinationTransportPort;
+
+    //CHECKSTYLE:OFF
+    /**
+     * IPFIX Data record for Reactive Forwarding application with IPv6 fields matching.
+     *
+     * @param exporterIpv4 IPv4 address of the IPFIX exporter
+     * @param exporterIpv6 IPv6 address of the IPFIX exporter, used for DPID
+     * @param start start timestamp of the flow
+     * @param end end timestamp of the flow
+     * @param octets number of bytes matched by the flow
+     * @param packets number of packets matched by the flow
+     * @param intfIn switch input interface of the flow
+     * @param intfOut switch output interface of the flow
+     * @param srcMac source MAC address
+     * @param dstMac destination MAC address
+     * @param etherType etherType field of the flow
+     * @param vlan VLAN ID of the flow
+     * @param srcIp6 source IPv6 address of the flow
+     * @param dstIp6 destination IPv6 address of the flow
+     * @param flowLabel IPv6 flow label of the flow
+     * @param proto IPv6 next-header of the flow
+     * @param tos IPv6 Traffic Class field
+     * @param srcPort source transport protocol port
+     * @param dstPort destination transport protocol port
+     */
+    public DataRecordRfwdIpv6(IpAddress exporterIpv4,
+            Ip6Address exporterIpv6,
+            long start,
+            long end,
+            long octets,
+            long packets,
+            int intfIn,
+            int intfOut,
+            MacAddress srcMac,
+            MacAddress dstMac,
+            short etherType,
+            short vlan,
+            Ip6Address srcIp6,
+            Ip6Address dstIp6,
+            int flowLabel,
+            byte proto,
+            byte tos,
+            short srcPort,
+            short dstPort) {
+        //CHECKSTYLE:ON
+
+        exporterIPv4Address = exporterIpv4;
+        exporterIPv6Address = exporterIpv6;
+        flowStartMilliseconds = start;
+        flowEndMilliseconds = end;
+        octetDeltaCount = octets;
+        packetDeltaCount = packets;
+        ingressInterface = intfIn;
+        egressInterface = intfOut;
+        sourceMacAddress = srcMac;
+        destinationMacAddress = dstMac;
+        ethernetType = etherType;
+        vlanId = vlan;
+        sourceIPv6Address = srcIp6;
+        destinationIPv6Address = dstIp6;
+        flowLabelIpv6 = flowLabel;
+        protocolIdentifier = proto;
+        ipClassOfService = tos;
+        sourceTransportPort = srcPort;
+        destinationTransportPort = dstPort;
+       }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public byte[] getBytes() throws HeaderException {
+        try {
+            byte[] data = new byte[LENGTH];
+
+            System.arraycopy(exporterIPv4Address.toOctets(), 0, data, 0, 4);
+            System.arraycopy(exporterIPv6Address.toOctets(), 0, data, 4, 16);
+            System.arraycopy(Longs.toByteArray(flowStartMilliseconds), 0, data, 20, 8);
+            System.arraycopy(Longs.toByteArray(flowEndMilliseconds), 0, data, 28, 8);
+            System.arraycopy(Longs.toByteArray(octetDeltaCount), 0, data, 36, 8);
+            System.arraycopy(Longs.toByteArray(packetDeltaCount), 0, data, 44, 8);
+            System.arraycopy(Ints.toByteArray(ingressInterface), 0, data, 52, 4);
+            System.arraycopy(Ints.toByteArray(egressInterface), 0, data, 56, 4);
+            System.arraycopy(sourceMacAddress.toBytes(), 0, data, 60, 6);
+            System.arraycopy(destinationMacAddress.toBytes(), 0, data, 66, 6);
+            System.arraycopy(Shorts.toByteArray(ethernetType), 0, data, 72, 2);
+            System.arraycopy(Shorts.toByteArray(vlanId), 0, data, 74, 2);
+            System.arraycopy(sourceIPv6Address.toOctets(), 0, data, 76, 16);
+            System.arraycopy(destinationIPv6Address.toOctets(), 0, data, 92, 16);
+            System.arraycopy(Ints.toByteArray(flowLabelIpv6), 0, data, 108, 4);
+            data[112] = protocolIdentifier;
+            data[113] = ipClassOfService;
+            System.arraycopy(Shorts.toByteArray(sourceTransportPort), 0, data, 114, 2);
+            System.arraycopy(Shorts.toByteArray(destinationTransportPort), 0, data, 116, 2);
+
+            return data;
+        } catch (Exception e) {
+            throw new HeaderException("Error while generating the bytes: " + e.getMessage());
+        }
+    }
+
+    /**
+     * IPFIX Template record for Reactive Forwarding application with IPv4 fields matching.
+     *
+     * @return TemplateRecord IPFIX Template Record
+     */
+    public static TemplateRecord getTemplateRecord() {
+
+        TemplateRecord tr = new TemplateRecord();
+        tr.setTemplateID(TEMPLATE_ID);
+        tr.setFieldCount(FIELD_COUNT);
+
+        List<InformationElement> ieTemp = tr.getInformationElements();
+
+        ieTemp.add(new InformationElement(Ie.exporterIPv4Address));
+        ieTemp.add(new InformationElement(Ie.exporterIPv6Address));
+        ieTemp.add(new InformationElement(Ie.flowStartMilliseconds));
+        ieTemp.add(new InformationElement(Ie.flowEndMilliseconds));
+        ieTemp.add(new InformationElement(Ie.octetDeltaCount));
+        ieTemp.add(new InformationElement(Ie.packetDeltaCount));
+        ieTemp.add(new InformationElement(Ie.ingressInterface));
+        ieTemp.add(new InformationElement(Ie.egressInterface));
+        ieTemp.add(new InformationElement(Ie.sourceMacAddress));
+        ieTemp.add(new InformationElement(Ie.destinationMacAddress));
+        ieTemp.add(new InformationElement(Ie.ethernetType));
+        ieTemp.add(new InformationElement(Ie.vlanId));
+        ieTemp.add(new InformationElement(Ie.sourceIPv6Address));
+        ieTemp.add(new InformationElement(Ie.destinationIPv6Address));
+        ieTemp.add(new InformationElement(Ie.flowLabelIPv6));
+        ieTemp.add(new InformationElement(Ie.protocolIdentifier));
+        ieTemp.add(new InformationElement(Ie.ipClassOfService));
+        ieTemp.add(new InformationElement(Ie.sourceTransportPort));
+        ieTemp.add(new InformationElement(Ie.destinationTransportPort));
+
+        return tr;
+    }
+}
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/DataRecordRfwdMac.java b/ipfix/src/main/java/org/onosproject/ipfix/DataRecordRfwdMac.java
new file mode 100644
index 0000000..9598829
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/DataRecordRfwdMac.java
@@ -0,0 +1,154 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix;
+
+import java.util.List;
+
+import org.onlab.packet.Ip6Address;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.MacAddress;
+import org.onosproject.ipfix.packet.DataRecord;
+import org.onosproject.ipfix.packet.HeaderException;
+import org.onosproject.ipfix.packet.Ie;
+import org.onosproject.ipfix.packet.InformationElement;
+import org.onosproject.ipfix.packet.TemplateRecord;
+
+import com.google.common.primitives.Ints;
+import com.google.common.primitives.Longs;
+import com.google.common.primitives.Shorts;
+
+/**
+ * IPFIX Data record for Reactive Forwarding application with L2 fields matching.
+ */
+public class DataRecordRfwdMac extends DataRecord {
+    public static final int TEMPLATE_ID = 331;
+    public static final int FIELD_COUNT = 12;
+    public static final int LENGTH = 76;
+
+    private IpAddress exporterIPv4Address;
+    private IpAddress exporterIPv6Address;
+    private long flowStartMilliseconds;
+    private long flowEndMilliseconds;
+    private long octetDeltaCount;
+    private long packetDeltaCount;
+    private int ingressInterface;
+    private int egressInterface;
+    private MacAddress sourceMacAddress;
+    private MacAddress destinationMacAddress;
+    private short ethernetType;
+    private short vlanId;
+
+    /**
+     * IPFIX Data record for Reactive Forwarding application with L2 fields matching.
+     *
+     * @param exporterIpv4 IPv4 address of the IPFIX exporter
+     * @param exporterIpv6 IPv6 address of the IPFIX exporter, used for DPID
+     * @param start start timestamp of the flow
+     * @param end end timestamp of the flow
+     * @param octets number of bytes matched by the flow
+     * @param packets number of packets matched by the flow
+     * @param intfIn switch input interface of the flow
+     * @param intfOut switch output interface of the flow
+     * @param srcMac source MAC address
+     * @param dstMac destination MAC address
+     * @param etherType etherType field of the flow
+     * @param vlan VLAN ID of the flow
+     */
+    public DataRecordRfwdMac(IpAddress exporterIpv4,
+            Ip6Address exporterIpv6,
+            long start,
+            long end,
+            long octets,
+            long packets,
+            int intfIn,
+            int intfOut,
+            MacAddress srcMac,
+            MacAddress dstMac,
+            short etherType,
+            short vlan) {
+
+        exporterIPv4Address = exporterIpv4;
+        exporterIPv6Address = exporterIpv6;
+        flowStartMilliseconds = start;
+        flowEndMilliseconds = end;
+        octetDeltaCount = octets;
+        packetDeltaCount = packets;
+        ingressInterface = intfIn;
+        egressInterface = intfOut;
+        sourceMacAddress = srcMac;
+        destinationMacAddress = dstMac;
+        ethernetType = etherType;
+        vlanId = vlan;
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public byte[] getBytes() throws HeaderException {
+        try {
+            byte[] data = new byte[LENGTH];
+
+            System.arraycopy(exporterIPv4Address.toOctets(), 0, data, 0, 4);
+            System.arraycopy(exporterIPv6Address.toOctets(), 0, data, 4, 16);
+            System.arraycopy(Longs.toByteArray(flowStartMilliseconds), 0, data, 20, 8);
+            System.arraycopy(Longs.toByteArray(flowEndMilliseconds), 0, data, 28, 8);
+            System.arraycopy(Longs.toByteArray(octetDeltaCount), 0, data, 36, 8);
+            System.arraycopy(Longs.toByteArray(packetDeltaCount), 0, data, 44, 8);
+            System.arraycopy(Ints.toByteArray(ingressInterface), 0, data, 52, 4);
+            System.arraycopy(Ints.toByteArray(egressInterface), 0, data, 56, 4);
+            System.arraycopy(sourceMacAddress.toBytes(), 0, data, 60, 6);
+            System.arraycopy(destinationMacAddress.toBytes(), 0, data, 66, 6);
+            System.arraycopy(Shorts.toByteArray(ethernetType), 0, data, 72, 2);
+            System.arraycopy(Shorts.toByteArray(vlanId), 0, data, 74, 2);
+
+            return data;
+        } catch (Exception e) {
+            throw new HeaderException("Error while generating the bytes: " + e.getMessage());
+        }
+    }
+
+    /**
+     * IPFIX Template record for Reactive Forwarding application with L2 fields matching.
+     *
+     * @return TemplateRecord IPFIX Template Record
+     */
+    public static TemplateRecord getTemplateRecord() {
+
+        TemplateRecord tr = new TemplateRecord();
+        tr.setTemplateID(TEMPLATE_ID);
+        tr.setFieldCount(FIELD_COUNT);
+
+        List<InformationElement> ieTemp = tr.getInformationElements();
+
+        ieTemp.add(new InformationElement(Ie.exporterIPv4Address));
+        ieTemp.add(new InformationElement(Ie.exporterIPv6Address));
+        ieTemp.add(new InformationElement(Ie.flowStartMilliseconds));
+        ieTemp.add(new InformationElement(Ie.flowEndMilliseconds));
+        ieTemp.add(new InformationElement(Ie.octetDeltaCount));
+        ieTemp.add(new InformationElement(Ie.packetDeltaCount));
+        ieTemp.add(new InformationElement(Ie.ingressInterface));
+        ieTemp.add(new InformationElement(Ie.egressInterface));
+        ieTemp.add(new InformationElement(Ie.sourceMacAddress));
+        ieTemp.add(new InformationElement(Ie.destinationMacAddress));
+        ieTemp.add(new InformationElement(Ie.ethernetType));
+        ieTemp.add(new InformationElement(Ie.vlanId));
+
+        return tr;
+    }
+}
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/FlowRemovedListener.java b/ipfix/src/main/java/org/onosproject/ipfix/FlowRemovedListener.java
new file mode 100644
index 0000000..3cab6a0
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/FlowRemovedListener.java
@@ -0,0 +1,244 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.onlab.packet.Ethernet;
+import org.onlab.packet.IPv4;
+import org.onlab.packet.IPv6;
+import org.onlab.packet.Ip6Address;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.MacAddress;
+import org.onosproject.ipfix.packet.DataRecord;
+import org.onosproject.net.flow.FlowEntry;
+import org.onosproject.net.flow.FlowRule;
+import org.onosproject.net.flow.FlowRuleEvent;
+import org.onosproject.net.flow.FlowRuleListener;
+import org.onosproject.net.flow.criteria.EthCriterion;
+import org.onosproject.net.flow.criteria.EthTypeCriterion;
+import org.onosproject.net.flow.criteria.IPCriterion;
+import org.onosproject.net.flow.criteria.IPDscpCriterion;
+import org.onosproject.net.flow.criteria.IPEcnCriterion;
+import org.onosproject.net.flow.criteria.IPProtocolCriterion;
+import org.onosproject.net.flow.criteria.IPv6FlowLabelCriterion;
+import org.onosproject.net.flow.criteria.IcmpCodeCriterion;
+import org.onosproject.net.flow.criteria.IcmpTypeCriterion;
+import org.onosproject.net.flow.criteria.Icmpv6CodeCriterion;
+import org.onosproject.net.flow.criteria.Icmpv6TypeCriterion;
+import org.onosproject.net.flow.criteria.PortCriterion;
+import org.onosproject.net.flow.criteria.TcpPortCriterion;
+import org.onosproject.net.flow.criteria.UdpPortCriterion;
+import org.onosproject.net.flow.criteria.VlanIdCriterion;
+import org.onosproject.net.flow.criteria.Criterion.Type;
+import org.onosproject.net.flow.instructions.Instruction;
+import org.onosproject.net.flow.instructions.Instructions.OutputInstruction;
+import org.onosproject.openflow.controller.Dpid;
+
+import com.google.common.primitives.Longs;
+
+/**
+ * Flow Rule Listener for detecting flow removal or flow statistics update by ONOS.
+ */
+public class FlowRemovedListener implements FlowRuleListener {
+
+    private IpfixManager ipfixManager;
+
+    /**
+     * Flow Event listerner for Flow removed events of Reactive Forwarding application.
+     *
+     * @param ipfixManager ipfix manager instance
+     */
+    public FlowRemovedListener(IpfixManager ipfixManager) {
+        this.ipfixManager = ipfixManager;
+    }
+
+    @Override
+    public void event(FlowRuleEvent event) {
+        switch (event.type()) {
+            case RULE_REMOVED:
+                FlowRule rule = event.subject();
+                FlowEntry entry = (FlowEntry) rule;
+                if (entry.appId() == ipfixManager.coreService.getAppId("org.onosproject.fwd").id()) {
+                    flowRemovedRfwd(entry);
+                }
+                break;
+            default:
+                break;
+        }
+    }
+
+    /**
+     * Handle ONOS Reactive forwarding application flow removal.
+     * When flow is removed, generate and send IPFIX record.
+     *
+     * @param entry flow entry removed from ONOS
+     */
+    private void flowRemovedRfwd(FlowEntry entry) {
+
+        //Log
+        ipfixManager.log.trace("Flow Removed from Reactive Forwarding, id={}, device={}, selector={}, treatment={}",
+                entry.id(), entry.deviceId(), entry.selector(), entry.treatment());
+
+        // Exporters
+        IpAddress exporterIpv4 = IpAddress.valueOf(ipfixManager.deviceService.getDevice(
+                entry.deviceId()).annotations().toString().split("=")[2].split(":")[0]);
+
+        long dpid = Dpid.dpid(entry.deviceId().uri()).value();
+        byte[] byteExporterIpv6 = new byte[16];
+        System.arraycopy(Longs.toByteArray(0), 0, byteExporterIpv6, 0, 8);
+        System.arraycopy(Longs.toByteArray(dpid), 0, byteExporterIpv6, 8, 8);
+        Ip6Address exporterIpv6 = Ip6Address.valueOf(byteExporterIpv6);
+
+        // Timestamps, octets, packets
+        long start = System.currentTimeMillis() - (1000 * entry.life());
+        long end = System.currentTimeMillis();
+        long octets = entry.bytes();
+        long packets = entry.packets();
+
+        // Input and Output ports
+        PortCriterion portCrit = (PortCriterion) entry.selector().getCriterion(Type.IN_PORT);
+        int intfIn = (portCrit == null) ? 0 : (int) portCrit.port().toLong();
+        List<Instruction> instructions = entry.treatment().allInstructions();
+        int intfOut = 0;
+        for (Instruction instruction : instructions) {
+            if (instruction.type() == Instruction.Type.OUTPUT) {
+                OutputInstruction outputInstruction = (OutputInstruction) instruction;
+                intfOut = (outputInstruction == null) ? 0 : (int) outputInstruction.port().toLong();
+            }
+        }
+
+        // Ethernet MACs, Ethertype and VLAN
+        EthCriterion ethCrit;
+        ethCrit = (EthCriterion) entry.selector().getCriterion(Type.ETH_SRC);
+        MacAddress srcMac = (ethCrit == null) ? MacAddress.valueOf("00:00:00:00:00:00") : ethCrit.mac();
+        ethCrit = (EthCriterion) entry.selector().getCriterion(Type.ETH_DST);
+        MacAddress dstMac = (ethCrit == null) ? MacAddress.valueOf("00:00:00:00:00:00") : ethCrit.mac();
+
+        EthTypeCriterion ethTypeCrit = (EthTypeCriterion) entry.selector().getCriterion(Type.ETH_TYPE);
+        Short ethType = (ethTypeCrit == null) ? 0x0000 : ethTypeCrit.ethType().toShort();
+
+        VlanIdCriterion vlanCrit = (VlanIdCriterion) entry.selector().getCriterion(Type.VLAN_VID);
+        Short vlan = (vlanCrit == null) ? 0x0000 : vlanCrit.vlanId().toShort();
+
+        // IP Criterion check
+        IPCriterion srcIpCrit = (IPCriterion) entry.selector().getCriterion(Type.IPV4_SRC);
+        IPCriterion dstIpCrit = (IPCriterion) entry.selector().getCriterion(Type.IPV4_DST);
+        IPCriterion srcIp6Crit = (IPCriterion) entry.selector().getCriterion(Type.IPV6_SRC);
+        IPCriterion dstIp6Crit = (IPCriterion) entry.selector().getCriterion(Type.IPV6_DST);
+
+        // If IP criterions are null send MAC Data Record, else send IPv4 or IPv6 Data Record
+        if (srcIpCrit == null && dstIpCrit == null && srcIp6Crit == null && dstIp6Crit == null) {
+            DataRecordRfwdMac record = new DataRecordRfwdMac(
+                    exporterIpv4, exporterIpv6,
+                    start, end,
+                    octets, packets,
+                    intfIn, intfOut,
+                    srcMac, dstMac,
+                    ethType, vlan);
+            List<DataRecord> recordList = new ArrayList<DataRecord>();
+            recordList.add(record);
+            ipfixManager.ipfixSender.sendRecords(DataRecordRfwdMac.getTemplateRecord(),
+                    recordList, dpid, IpfixManager.collectorIp, IpfixManager.collectorPort);
+        } else {
+            // Checking IPv4 and IPv6 criterions
+            IPProtocolCriterion protocolCrit = (IPProtocolCriterion) entry.selector().getCriterion(Type.IP_PROTO);
+            byte ipProtocol = (protocolCrit == null) ? (byte) 0xff : (byte) protocolCrit.protocol();
+
+            IPDscpCriterion dscpCrit = (IPDscpCriterion) entry.selector().getCriterion(Type.IP_DSCP);
+            byte dscp = (dscpCrit == null) ? 0x00 : dscpCrit.ipDscp();
+            IPEcnCriterion ecnCrit = (IPEcnCriterion) entry.selector().getCriterion(Type.IP_ECN);
+            byte ecn = (ecnCrit == null) ? 0x00 : ecnCrit.ipEcn();
+            byte tos = (byte) ((byte) (dscp << 2) | ecn);
+
+            IPv6FlowLabelCriterion flowLabelCrit =
+                    (IPv6FlowLabelCriterion) entry.selector().getCriterion(Type.IPV6_FLABEL);
+            int flowLabelIpv6 = (flowLabelCrit == null) ? 0 : flowLabelCrit.flowLabel();
+
+            int srcPort = 0;
+            int dstPort = 0;
+            if (ipProtocol == IPv4.PROTOCOL_TCP) {
+                TcpPortCriterion tcpCrit;
+                tcpCrit = (TcpPortCriterion) entry.selector().getCriterion(Type.TCP_SRC);
+                srcPort = (tcpCrit == null) ? 0 : tcpCrit.tcpPort().toInt();
+                tcpCrit = (TcpPortCriterion) entry.selector().getCriterion(Type.TCP_DST);
+                dstPort = (tcpCrit == null) ? 0 : tcpCrit.tcpPort().toInt();
+            } else if (ipProtocol == IPv4.PROTOCOL_UDP) {
+                UdpPortCriterion udpCrit;
+                udpCrit = (UdpPortCriterion) entry.selector().getCriterion(Type.UDP_SRC);
+                srcPort = (udpCrit == null) ? 0 : udpCrit.udpPort().toInt();
+                udpCrit = (UdpPortCriterion) entry.selector().getCriterion(Type.UDP_DST);
+                dstPort = (udpCrit == null) ? 0 : udpCrit.udpPort().toInt();
+            } else if (ipProtocol == IPv4.PROTOCOL_ICMP) {
+                IcmpTypeCriterion icmpTypeCrit = (IcmpTypeCriterion) entry.selector().getCriterion(Type.ICMPV4_TYPE);
+                Short icmpType = (icmpTypeCrit == null) ? 0 : icmpTypeCrit.icmpType();
+                IcmpCodeCriterion icmpCodeCrit = (IcmpCodeCriterion) entry.selector().getCriterion(Type.ICMPV4_CODE);
+                Short icmpCode = (icmpCodeCrit == null) ? 0 : icmpCodeCrit.icmpCode();
+                dstPort = 256 * icmpType + icmpCode;
+            } else if (ipProtocol == IPv6.PROTOCOL_ICMP6) {
+                Icmpv6TypeCriterion icmpv6TypeCrit =
+                        (Icmpv6TypeCriterion) entry.selector().getCriterion(Type.ICMPV6_TYPE);
+                Short icmpType = (icmpv6TypeCrit == null) ? 0 : icmpv6TypeCrit.icmpv6Type();
+                Icmpv6CodeCriterion icmpv6CodeCrit =
+                        (Icmpv6CodeCriterion) entry.selector().getCriterion(Type.ICMPV6_CODE);
+                Short icmpCode = (icmpv6CodeCrit == null) ? 0 : icmpv6CodeCrit.icmpv6Code();
+                dstPort = 256 * icmpType + icmpCode;
+            }
+            // If IPv4 than send IPv4 Data record
+            if ((srcIpCrit != null || dstIpCrit != null) && ethType == Ethernet.TYPE_IPV4) {
+                IpAddress srcIp = (srcIpCrit == null) ? IpAddress.valueOf(0) : srcIpCrit.ip().address();
+                IpAddress dstIp = (dstIpCrit == null) ? IpAddress.valueOf(0) : dstIpCrit.ip().address();
+                DataRecordRfwdIpv4 record = new DataRecordRfwdIpv4(
+                        exporterIpv4, exporterIpv6,
+                        start, end,
+                        octets, packets,
+                        intfIn, intfOut,
+                        srcMac, dstMac,
+                        ethType, vlan,
+                        srcIp, dstIp,
+                        ipProtocol, tos,
+                        (short) srcPort, (short) dstPort);
+                List<DataRecord> recordList = new ArrayList<DataRecord>();
+                recordList.add(record);
+                ipfixManager.ipfixSender.sendRecords(DataRecordRfwdIpv4.getTemplateRecord(),
+                        recordList, dpid, IpfixManager.collectorIp, IpfixManager.collectorPort);
+            }
+            // If IPv6 than send IPv6 Data record
+            if ((srcIp6Crit != null || dstIp6Crit != null) && ethType == Ethernet.TYPE_IPV6) {
+                Ip6Address srcIp6 = (srcIp6Crit == null) ?
+                        Ip6Address.valueOf("0:0:0:0:0:0:0:0") : srcIp6Crit.ip().address().getIp6Address();
+                Ip6Address dstIp6 = (dstIp6Crit == null) ?
+                        Ip6Address.valueOf("0:0:0:0:0:0:0:0") : dstIp6Crit.ip().address().getIp6Address();
+                DataRecordRfwdIpv6 record = new DataRecordRfwdIpv6(
+                    exporterIpv4, exporterIpv6,
+                    start, end,
+                    octets, packets,
+                    intfIn, intfOut,
+                    srcMac, dstMac,
+                    ethType, vlan,
+                    srcIp6, dstIp6,
+                    flowLabelIpv6,
+                    ipProtocol, tos,
+                    (short) srcPort, (short) dstPort);
+                List<DataRecord> recordList = new ArrayList<DataRecord>();
+                recordList.add(record);
+                ipfixManager.ipfixSender.sendRecords(DataRecordRfwdIpv6.getTemplateRecord(),
+                        recordList, dpid, IpfixManager.collectorIp, IpfixManager.collectorPort);
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/IpfixManager.java b/ipfix/src/main/java/org/onosproject/ipfix/IpfixManager.java
new file mode 100644
index 0000000..a1a2be0
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/IpfixManager.java
@@ -0,0 +1,199 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix;
+
+import static com.google.common.base.Strings.isNullOrEmpty;
+import static org.onlab.util.Tools.get;
+
+import java.util.Dictionary;
+
+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.Modified;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onlab.packet.IpAddress;
+import org.onosproject.app.ApplicationService;
+import org.onosproject.cfg.ComponentConfigService;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.flow.FlowRuleService;
+import org.onosproject.net.flowobjective.FlowObjectiveService;
+import org.onosproject.net.host.HostService;
+import org.onosproject.net.packet.PacketService;
+import org.onosproject.net.statistic.StatisticStore;
+import org.onosproject.net.topology.TopologyService;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Strings;
+
+/**
+ * OpenFlow to IPFIX Manager.
+ */
+@Component(immediate = true)
+public class IpfixManager {
+
+    protected final Logger log = LoggerFactory.getLogger(getClass());
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected TopologyService topologyService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected ApplicationService applicationService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected PacketService packetService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected HostService hostService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected DeviceService deviceService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected FlowRuleService flowRuleService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected StatisticStore statisticStore;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected FlowObjectiveService flowObjectiveService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CoreService coreService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected ComponentConfigService cfgService;
+
+    private ApplicationId appId;
+
+    protected FlowRemovedListener flowRemovedListener = null;
+    protected PortStatsListener portStatsListener = null;
+    protected IpfixSender ipfixSender = null;
+
+    private static final boolean R_FWD_FLOWS_EXPORT = true;
+    @Property(name = "ReactiveForwardingFlowExport", boolValue = R_FWD_FLOWS_EXPORT,
+            label = "Reactive Forwarding application flows exported over IPFIX when removed")
+    private boolean reactiveForwardingFlowExport = R_FWD_FLOWS_EXPORT;
+
+    private static final boolean PORTSTATS_FLOWS_EXPORT = false;
+    @Property(name = "PortStatsFlowExport", boolValue = PORTSTATS_FLOWS_EXPORT,
+            label = "Switch Port Statistics exported over IPFIX")
+    private boolean portStatsFlowExport = PORTSTATS_FLOWS_EXPORT;
+
+    private static final String COLLECTOR_ADDRESS = "127.0.0.1";
+    @Property(name = "CollectorAddress", value = COLLECTOR_ADDRESS,
+    label = "IPFIX Collector IP Address")
+    private String collectorAddress = COLLECTOR_ADDRESS;
+    protected static IpAddress collectorIp;
+
+    private static final int COLLECTOR_PORT = 2055;
+    @Property(name = "CollectorPort", intValue = COLLECTOR_PORT,
+    label = "IPFIX Collector UDP Port")
+    protected static int collectorPort = COLLECTOR_PORT;
+
+    @Activate
+    public void activate(ComponentContext context) {
+        appId = coreService.registerApplication("net.sdnmon.of2ipfix");
+        cfgService.registerProperties(getClass());
+        getProperties(context);
+        collectorIp = IpAddress.valueOf(collectorAddress);
+        if (reactiveForwardingFlowExport) {
+            flowRemovedListener = new FlowRemovedListener(this);
+            flowRuleService.addListener(flowRemovedListener);
+        }
+        if (portStatsFlowExport) {
+            portStatsListener = new PortStatsListener(this);
+            deviceService.addListener(portStatsListener);
+        }
+        ipfixSender = new IpfixSender(this);
+        log.info("Started. reactiveForwardingFlowExport={}, portStatsFlowExport={}, IPFIX collector: ip={}, port={}",
+                reactiveForwardingFlowExport, portStatsFlowExport, collectorAddress, collectorPort);
+    }
+
+    @Deactivate
+    public void deactivate(ComponentContext context) {
+        cfgService.unregisterProperties(getClass(), false);
+        if (flowRemovedListener != null) {
+            flowRuleService.removeListener(flowRemovedListener);
+            flowRemovedListener = null;
+        }
+        if (portStatsListener != null) {
+            deviceService.removeListener(portStatsListener);
+            portStatsListener = null;
+        }
+        ipfixSender = null;
+        log.info("Stopped");
+    }
+
+    @Modified
+    public void modified(ComponentContext context) {
+        getProperties(context);
+        if (reactiveForwardingFlowExport) {
+            if (flowRemovedListener == null) {
+                flowRemovedListener = new FlowRemovedListener(this);
+                flowRuleService.addListener(flowRemovedListener);
+            }
+        } else if (flowRemovedListener != null) {
+            // reactiveForwardingFlowExport is false
+            flowRuleService.removeListener(flowRemovedListener);
+            flowRemovedListener = null;
+        }
+        if (portStatsFlowExport) {
+            if (portStatsListener == null) {
+                portStatsListener = new PortStatsListener(this);
+                deviceService.addListener(portStatsListener);
+            }
+        } else if (portStatsListener != null) {
+            // portStatsFlowExport is false
+            deviceService.removeListener(portStatsListener);
+            portStatsListener = null;
+        }
+        log.info("Modified. reactiveForwardingFlowExport={}, portStatsFlowExport={}, IPFIX collector: ip={}, port={}",
+                reactiveForwardingFlowExport, portStatsFlowExport, collectorAddress, collectorPort);
+    }
+
+    public void getProperties(ComponentContext context) {
+        Dictionary<?, ?> properties = context.getProperties();
+
+        // parse CollectorPort Property
+        String s = get(properties, "CollectorPort");
+        try {
+            collectorPort = isNullOrEmpty(s) ? collectorPort : Integer.parseInt(s.trim());
+        } catch (NumberFormatException | ClassCastException e) {
+            log.info("CollectorPort Format Exception");
+        }
+
+        // parse CollectorAddress Property
+        s = get(properties, "CollectorAddress");
+        collectorAddress = isNullOrEmpty(s) ? collectorAddress : s;
+        collectorIp = IpAddress.valueOf(collectorAddress);
+
+        // parse reactiveForwardingFlowExport Property
+        s = get(properties, "ReactiveForwardingFlowExport");
+        reactiveForwardingFlowExport = Strings.isNullOrEmpty(s) ? R_FWD_FLOWS_EXPORT : Boolean.valueOf(s);
+
+        // parse portStatsFlowExport Property
+        s = get(properties, "PortStatsFlowExport");
+        portStatsFlowExport = Strings.isNullOrEmpty(s) ? PORTSTATS_FLOWS_EXPORT : Boolean.valueOf(s);
+    }
+
+}
\ No newline at end of file
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/IpfixSender.java b/ipfix/src/main/java/org/onosproject/ipfix/IpfixSender.java
new file mode 100644
index 0000000..3d4a05a
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/IpfixSender.java
@@ -0,0 +1,133 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix;
+
+import java.io.IOException;
+import java.net.DatagramPacket;
+import java.net.DatagramSocket;
+import java.net.InetAddress;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import java.util.Date;
+import java.util.List;
+
+import org.onlab.packet.IpAddress;
+import org.onosproject.ipfix.packet.DataRecord;
+import org.onosproject.ipfix.packet.HeaderException;
+import org.onosproject.ipfix.packet.MessageHeader;
+import org.onosproject.ipfix.packet.SetHeader;
+import org.onosproject.ipfix.packet.TemplateRecord;
+
+/**
+ * Sends IPFIX records.
+ */
+public class IpfixSender {
+
+    private static int seqNumber;
+    private static final int IPFIX_VERSION = 10;
+    private static final int TEMPLATE_SETID = 2;
+
+    private IpfixManager ipfixManager;
+
+    /**
+     * Creates instance of the IPFIX Sender.
+     *
+     * @param ipfixManager IpfixManager instance
+     */
+    public IpfixSender(IpfixManager ipfixManager) {
+        this.ipfixManager = ipfixManager;
+        seqNumber = 0;
+    }
+
+    /**
+     * Send IPFIX Template and coresponding list of data records.
+     *
+     * @param tr Template Record to send
+     * @param recordsList List of corresponding IPFIX records to send
+     * @param oid observation domain ID
+     * @param collector IPFIX collector IP address
+     * @param port IPFIX collector UDP port
+     */
+    public void sendRecords(TemplateRecord tr, List<DataRecord> recordsList,
+                             long oid, IpAddress collector, int port) {
+
+        MessageHeader mh = new MessageHeader();
+        mh.setVersionNumber(IPFIX_VERSION);
+        mh.setObservationDomainID(oid);
+        seqNumber++;
+        mh.setSequenceNumber(seqNumber);
+        mh.setExportTime(new Date());
+
+        // Set header for the template
+        SetHeader shTemplate = new SetHeader();
+        shTemplate.setSetID(TEMPLATE_SETID);
+
+        // Add template record
+        List<TemplateRecord> trTemp = shTemplate.getTemplateRecords();
+        trTemp.add(tr);
+        shTemplate.setTemplateRecords(trTemp);
+
+        // Set header for the Data Records
+        SetHeader shData = new SetHeader();
+        shData.setSetID(tr.getTemplateID());
+
+        // Add Data records from the recordsList
+        List<DataRecord> drTemp = shData.getDataRecords();
+        for (DataRecord tempRecord : recordsList) {
+            drTemp.add(tempRecord);
+        }
+        shData.setDataRecords(drTemp);
+
+        // Make Set Headers from Template and Data
+        List<SetHeader> shTemp = mh.getSetHeaders();
+        shTemp.add(shTemplate);
+        shTemp.add(shData);
+        mh.setSetHeaders(shTemp);
+
+        // socket handling and IPFIX UDP packet sending
+        InetAddress collectorAddress = null;
+        try {
+            collectorAddress = InetAddress.getByAddress(collector.toOctets());
+        } catch (UnknownHostException e) {
+            ipfixManager.log.warn("IPFIX Collector IP address format problem: " + e.getMessage());
+            return;
+        }
+        DatagramSocket dSocket = null;
+        DatagramPacket dPacket = null;
+        try {
+            dSocket = new DatagramSocket();
+        } catch (SocketException e) {
+            ipfixManager.log.warn("IPFIX datagram socket problem: " + e.getMessage());
+            return;
+        }
+        try {
+            dPacket = new DatagramPacket(mh.getBytes(), mh.getBytes().length, collectorAddress, port);
+        } catch (HeaderException e) {
+            ipfixManager.log.warn("IPFIX datagram packet problem: " + e.getMessage());
+            dSocket.close();
+            return;
+        }
+        try {
+            dSocket.send(dPacket);
+        } catch (IOException e) {
+            ipfixManager.log.warn("IPFIX packet send IO exception: " + e.getMessage());
+            dSocket.close();
+            return;
+        }
+        dSocket.close();
+    }
+
+}
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/PortStatsListener.java b/ipfix/src/main/java/org/onosproject/ipfix/PortStatsListener.java
new file mode 100644
index 0000000..87e78b2
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/PortStatsListener.java
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.onlab.packet.Ip6Address;
+import org.onlab.packet.IpAddress;
+import org.onosproject.ipfix.packet.DataRecord;
+import org.onosproject.ipfix.packet.TemplateRecord;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.Device;
+import org.onosproject.net.MastershipRole;
+import org.onosproject.net.device.DeviceEvent;
+import org.onosproject.net.device.DeviceListener;
+import org.onosproject.net.device.PortStatistics;
+import org.onosproject.openflow.controller.Dpid;
+
+import com.google.common.primitives.Longs;
+
+/**
+ * Internal PortStats Listener.
+ * Exports IPFIX statistics when PortStats are updated.
+ */
+public class PortStatsListener implements DeviceListener {
+
+    public Map<ConnectPoint, List<Long>> prevStatsMap = new HashMap<ConnectPoint, List<Long>>();
+
+    private IpfixManager ipfixManager;
+
+    /**
+     * Internal PortStats Listener.
+     * Exports IPFIX statistics when PortStats are updated.
+     *
+     * @param ipfixManager ipfix manager instance
+     */
+    public PortStatsListener(IpfixManager ipfixManager) {
+        this.ipfixManager = ipfixManager;
+    }
+
+    @Override
+    public void event(DeviceEvent event) {
+
+        Device device = event.subject();
+
+        switch (event.type()) {
+            case PORT_STATS_UPDATED:
+                if (ipfixManager.deviceService.getRole(device.id()) == MastershipRole.MASTER) {
+                    ipfixManager.log.trace("PortStats Updated: I am MASTER for deviceId={}", device.id().toString());
+
+                    List<DataRecord> recordsInList = new ArrayList<DataRecord>();
+                    List<DataRecord> recordsOutList = new ArrayList<DataRecord>();
+
+                    IpAddress exporterIpv4 =
+                            IpAddress.valueOf(device.annotations().toString().split("=")[2].split(":")[0]);
+                    long dpid = Dpid.dpid(device.id().uri()).value();
+                    byte[] byteExporterIpv6 = new byte[16];
+                    System.arraycopy(Longs.toByteArray(0), 0, byteExporterIpv6, 0, 8);
+                    System.arraycopy(Longs.toByteArray(dpid), 0, byteExporterIpv6, 8, 8);
+                    Ip6Address exporterIpv6 = Ip6Address.valueOf(byteExporterIpv6);
+
+                    for (PortStatistics stat : ipfixManager.deviceService.getPortDeltaStatistics(device.id())) {
+
+                        final String format = "PortStatsListener Delta Stats: port={}, pktRx={}, pktTx={},"
+                                + "bytesRx={}, bytesTx={}, pktRxDrp={}, pktTxDrp={}, Dur={}.{}";
+                        ipfixManager.log.trace(format, stat.port(), stat.packetsReceived(), stat.packetsSent(),
+                                stat.bytesReceived(), stat.bytesSent(),
+                                stat.packetsRxDropped(), stat.packetsTxDropped(),
+                                stat.durationSec(), (stat.durationNano() / 1000000));
+
+                        long inBytes = stat.bytesReceived();
+                        long inPackets = stat.packetsReceived();
+                        long outBytes = stat.bytesSent();
+                        long outPackets = stat.packetsSent();
+                        long endTime = System.currentTimeMillis();
+                        long startTime = endTime - (stat.durationSec() * TimeUnit.SECONDS.toMillis(1) +
+                                stat.durationNano() / TimeUnit.MILLISECONDS.toNanos(1));
+
+                        DataRecordPortStatsIn recordIn = new DataRecordPortStatsIn(exporterIpv4, exporterIpv6,
+                                stat.port(), inBytes, inPackets, startTime, endTime);
+                        DataRecordPortStatsOut recordOut = new DataRecordPortStatsOut(exporterIpv4, exporterIpv6,
+                                stat.port(), outBytes, outPackets, startTime, endTime);
+
+                        recordsInList.add(recordIn);
+                        recordsOutList.add(recordOut);
+                    }
+
+                    if (recordsInList.isEmpty() && recordsOutList.isEmpty()) {
+                        ipfixManager.log.trace("PortStats: Previous PortStats for device={} where zero,"
+                                + "not sending IPFIX flow", device.id());
+                    } else {
+                        TemplateRecord trIn = DataRecordPortStatsIn.portStatsInTemplateRecord();
+                        TemplateRecord trOut = DataRecordPortStatsOut.portStatsOutTemplateRecord();
+                        ipfixManager.ipfixSender.sendRecords(trIn, recordsInList, dpid,
+                                IpfixManager.collectorIp, IpfixManager.collectorPort);
+                        ipfixManager.ipfixSender.sendRecords(trOut, recordsOutList, dpid,
+                                IpfixManager.collectorIp, IpfixManager.collectorPort);
+                    }
+                }
+                break;
+
+            default:
+                break;
+        }
+    }
+}
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/packet/AbstractIpfixPacketEntity.java b/ipfix/src/main/java/org/onosproject/ipfix/packet/AbstractIpfixPacketEntity.java
new file mode 100644
index 0000000..8c5413f
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/packet/AbstractIpfixPacketEntity.java
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix.packet;
+
+/**
+ * Abstract entity of the IPFIX Packet entities.
+ * Used for Records and Headers of variable length.
+ */
+public abstract class AbstractIpfixPacketEntity {
+
+    protected int length;
+
+    /**
+     * Sets the length of the IPFIX entity.
+     *
+     * @param length length of the entity
+     */
+    protected void setLength(int length) {
+        this.length = length;
+    }
+
+    /**
+     * Returns the length of the IPFIX entity.
+     *
+     * @return length length of the entity
+     */
+    public int getLength() {
+        return length;
+    }
+}
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/packet/AbstractIpfixPacketInterface.java b/ipfix/src/main/java/org/onosproject/ipfix/packet/AbstractIpfixPacketInterface.java
new file mode 100644
index 0000000..cec3bbe
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/packet/AbstractIpfixPacketInterface.java
@@ -0,0 +1,39 @@
+/*
+ * 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.
+*/
+package org.onosproject.ipfix.packet;
+
+/**
+ * Abstract Interface for IPFIX entities.
+ * Used for Records, Headers and Information Elements.
+ */
+public interface AbstractIpfixPacketInterface {
+
+    /**
+     * Returns string representation of the IPFIX entity.
+     *
+     * @return String String representation of the IPFIX entity
+     */
+    public String toString();
+
+    /**
+     * Returns byte array of the IPFIX entity.
+     * Used for IPFIX packet serialization.
+     *
+     * @return byte[] byte array of the IPFIX entity
+     * @throws HeaderException header exception
+     */
+    public byte[] getBytes() throws HeaderException;
+}
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/packet/DataRecord.java b/ipfix/src/main/java/org/onosproject/ipfix/packet/DataRecord.java
new file mode 100644
index 0000000..37b65b0
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/packet/DataRecord.java
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix.packet;
+
+/**
+ * IPFIX Data Record entity.
+ */
+public abstract class DataRecord extends Record {
+}
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/packet/HeaderException.java b/ipfix/src/main/java/org/onosproject/ipfix/packet/HeaderException.java
new file mode 100644
index 0000000..504fd40
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/packet/HeaderException.java
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix.packet;
+
+/**
+ * Exception for IPFIX Header parsing or serialization.
+ */
+public class HeaderException extends Exception {
+
+    private static final long serialVersionUID = -2628460416419275548L;
+
+    public HeaderException(String msg) {
+        super(msg);
+    }
+}
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/packet/Ie.java b/ipfix/src/main/java/org/onosproject/ipfix/packet/Ie.java
new file mode 100644
index 0000000..494a810
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/packet/Ie.java
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix.packet;
+
+/**
+ * IPFIX Information Elements from IANA.
+ */
+public enum Ie {
+    octetDeltaCount(1, 8),
+    packetDeltaCount(2, 8),
+    protocolIdentifier(4, 1),
+    ipClassOfService(5, 1),
+    sourceTransportPort(7, 2),
+    sourceIPv4Address(8, 4),
+    ingressInterface(10, 4),
+    destinationTransportPort(11, 2),
+    destinationIPv4Address(12, 4),
+    egressInterface(14, 4),
+    sourceIPv6Address(27, 16),
+    destinationIPv6Address(28, 16),
+    flowLabelIPv6(31, 4),
+    sourceMacAddress(56, 6),
+    vlanId(58, 2),
+    destinationMacAddress(80, 6),
+    exporterIPv4Address(130, 4),
+    exporterIPv6Address(131, 16),
+    droppedOctetDeltaCount(132, 8),
+    droppedPacketDeltaCount(133, 8),
+    flowStartMilliseconds(152, 8),
+    flowEndMilliseconds(153, 8),
+    ethernetType(256, 2);
+
+    /**
+     * IPFIX Information Element IDs from IANA.
+     * Available at: http://www.iana.org/assignments/ipfix/ipfix.xhtml.
+     */
+    private final int id;
+
+    /**
+     * IPFIX Information Element length in bytes.
+     */
+    private final int length;
+
+    /**
+     * IPFIX Information Element constructor.
+     *
+     * @param id IPFIX Information Element id
+     * @param length IPFIX Information Element length in bytes
+     */
+    private Ie(int id, int length) {
+        this.id = id;
+        this.length = length;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public int getLength() {
+        return length;
+    }
+}
\ No newline at end of file
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/packet/InformationElement.java b/ipfix/src/main/java/org/onosproject/ipfix/packet/InformationElement.java
new file mode 100644
index 0000000..788acb3
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/packet/InformationElement.java
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix.packet;
+
+import com.google.common.primitives.Ints;
+import com.google.common.primitives.Shorts;
+
+/**
+ * IPFIX Information Element entity.
+ */
+public class InformationElement implements AbstractIpfixPacketInterface {
+    public static final int LENGTH = 4;
+
+    private int informationElementID;
+    private int fieldLength;
+
+    /**
+     * @param ie Information Element construtor from Ie Enum.
+     */
+    public InformationElement(Ie ie) {
+        this.informationElementID = ie.getId();
+        this.fieldLength = ie.getLength();
+    }
+
+    /**
+     * Information Element construtor from blank.
+     */
+    public InformationElement() {
+        this.informationElementID = 0;
+        this.fieldLength = 0;
+    }
+
+    public int getInformationElementID() {
+        return informationElementID;
+    }
+
+    public void setInformationElementID(int informationElementID) {
+        this.informationElementID = informationElementID;
+    }
+
+    public int getFieldLength() {
+        return fieldLength;
+    }
+
+    public void setFieldLength(int fieldLength) {
+        this.fieldLength = fieldLength;
+    }
+
+    public static InformationElement parse(byte[] data) throws HeaderException {
+        try {
+            if (data.length < LENGTH) {
+                throw new HeaderException("Data array too short.");
+            }
+            InformationElement ie = new InformationElement();
+            // information element ID
+            byte[] informationElementID = new byte[2];
+            System.arraycopy(data, 0, informationElementID, 0, 2);
+            ie.setInformationElementID(Ints.fromByteArray(informationElementID));
+            // field length
+            byte[] fieldLength = new byte[2];
+            System.arraycopy(data, 2, fieldLength, 0, 2);
+            ie.setFieldLength(Ints.fromByteArray(fieldLength));
+            return ie;
+        } catch (Exception e) {
+            throw new HeaderException("Parse error: " + e.getMessage());
+        }
+    }
+
+    public byte[] getBytes() throws HeaderException {
+        try {
+            byte[] data = new byte[LENGTH];
+            // information element ID
+            System.arraycopy(Shorts.toByteArray((short) getInformationElementID()), 0, data, 0, 2);
+            // field length
+            System.arraycopy(Shorts.toByteArray((short) getFieldLength()), 0, data, 2, 2);
+            return data;
+        } catch (Exception e) {
+            throw new HeaderException("Error while generating the bytes: " + e.getMessage());
+        }
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("[InformationElement]: ");
+        sb.append("ID: ");
+        sb.append(informationElementID);
+        sb.append(", ");
+        sb.append("Field length: ");
+        sb.append(fieldLength);
+        return sb.toString();
+    }
+}
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/packet/MessageHeader.java b/ipfix/src/main/java/org/onosproject/ipfix/packet/MessageHeader.java
new file mode 100644
index 0000000..78db882
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/packet/MessageHeader.java
@@ -0,0 +1,214 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix.packet;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.google.common.primitives.Ints;
+import com.google.common.primitives.Longs;
+import com.google.common.primitives.Shorts;
+
+/**
+ * IPFIX Message Header.
+ */
+public class MessageHeader extends AbstractIpfixPacketEntity implements AbstractIpfixPacketInterface {
+    private static final Logger LOGGER = Logger.getLogger(SetHeader.class.getName());
+    private static final int HEADER_LENGTH = 16;
+    private static final int IPFIX_VERSION = 10;
+
+    private int versionNumber;
+    private int length;
+    private Date exportTime;
+    private long sequenceNumber;
+    private long observationDomainID;
+    private List<SetHeader> setHeaders = new ArrayList<SetHeader>();
+
+    /**
+     * Message Header format.
+     *
+     *  0                   1                   2                   3
+     *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+     *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     *  |       Version Number          |            Length             |
+     *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     *  |                           Export Time                         |
+     *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     *  |                       Sequence Number                         |
+     *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     *  |                    Observation Domain ID                      |
+     *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     *
+     */
+
+    public int getVersionNumber() {
+        return IPFIX_VERSION;
+    }
+
+    public void setVersionNumber(int versionNumber) {
+        this.versionNumber = versionNumber;
+    }
+
+    public int getLength() {
+        return length;
+    }
+
+    public void setLength(int length) {
+        this.length = length;
+    }
+
+    public Date getExportTime() {
+        return exportTime;
+    }
+
+    public void setExportTime(Date exportTime) {
+        this.exportTime = exportTime;
+    }
+
+    public long getSequenceNumber() {
+        return sequenceNumber;
+    }
+
+    public void setSequenceNumber(long sequenceNumber) {
+        this.sequenceNumber = sequenceNumber;
+    }
+
+    public long getObservationDomainID() {
+        return observationDomainID;
+    }
+
+    public void setObservationDomainID(long observationDomainID) {
+        this.observationDomainID = observationDomainID;
+    }
+
+    public List<SetHeader> getSetHeaders() {
+        return setHeaders;
+    }
+
+    public void setSetHeaders(List<SetHeader> setHeaders) {
+        this.setHeaders = setHeaders;
+        int length = HEADER_LENGTH;
+        for (SetHeader header : setHeaders) {
+            length += header.getLength();
+        }
+        setLength(length);
+    }
+
+    public static MessageHeader parse(byte[] data) throws HeaderException {
+        try {
+            if (data.length < HEADER_LENGTH) {
+                throw new HeaderException("Data array too short.");
+            }
+            MessageHeader mh = new MessageHeader();
+            // version number
+            byte[] versionNumber = new byte[2];
+            System.arraycopy(data, 0, versionNumber, 0, 2);
+            mh.setVersionNumber(Ints.fromByteArray(versionNumber));
+            // length
+            byte[] length = new byte[2];
+            System.arraycopy(data, 2, length, 0, 2);
+            mh.setLength(Ints.fromByteArray(length));
+            // export time
+            byte[] exportTime = new byte[4];
+            System.arraycopy(data, 4, exportTime, 0, 4);
+            long secondsSinceEpoche = Longs.fromByteArray(exportTime);
+            long milliSecondsSinceEpoche = secondsSinceEpoche * 1000;
+            mh.setExportTime(new Date(milliSecondsSinceEpoche));
+            // sequence number
+            byte[] sequenceNumber = new byte[4];
+            System.arraycopy(data, 8, sequenceNumber, 0, 4);
+            mh.setSequenceNumber(Longs.fromByteArray(sequenceNumber));
+            // observation domain id
+            byte[] observationDomainID = new byte[4];
+            System.arraycopy(data, 12, observationDomainID, 0, 4);
+            mh.setObservationDomainID(Longs.fromByteArray(observationDomainID));
+            // set header
+            int offset = HEADER_LENGTH;
+
+            while ((mh.getLength() - offset) > 0) {
+                byte[] subData = new byte[mh.getLength() - offset];
+                System.arraycopy(data, offset, subData, 0, subData.length);
+                SetHeader sh = SetHeader.parse(subData);
+                mh.getSetHeaders().add(sh);
+                offset += sh.getLength();
+            }
+            if ((mh.getLength() - offset) != 0) {
+                LOGGER.log(Level.INFO, "Unused bytes: " + (mh.getLength() - offset));
+            }
+            return mh;
+        } catch (Exception e) {
+            throw new HeaderException("Parse error: " + e.getMessage());
+        }
+    }
+
+    public byte[] getBytes() throws HeaderException {
+        try {
+            byte[] data = new byte[length];
+            // version number
+            System.arraycopy(Shorts.toByteArray((short) versionNumber), 0, data, 0, 2);
+            // length
+            System.arraycopy(Shorts.toByteArray((short) length), 0, data, 2, 2);
+            // export time
+            System.arraycopy(Ints.toByteArray((int) exportTime.getTime() / 1000), 0, data, 4, 4);
+            // sequence number
+            System.arraycopy(Ints.toByteArray((int) sequenceNumber), 0, data, 8, 4);
+            // observation domain id
+            System.arraycopy(Ints.toByteArray((int) observationDomainID), 0, data, 12, 4);
+            // set header
+            int offset = HEADER_LENGTH;
+            for (SetHeader sh : setHeaders) {
+                byte[] temp = sh.getBytes();
+                System.arraycopy(temp, 0, data, offset, temp.length);
+                offset += temp.length;
+            }
+            return data;
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new HeaderException("Error while generating the bytes: " + e.getMessage());
+        }
+    }
+
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("[MessageHeader]: ");
+        sb.append("Version Number: ");
+        sb.append(versionNumber);
+        sb.append(", ");
+        sb.append("Length: ");
+        sb.append(length);
+        sb.append(", ");
+        sb.append("Export time: ");
+        sb.append(exportTime);
+        sb.append(", ");
+        sb.append("Sequence number: ");
+        sb.append(sequenceNumber);
+        sb.append(", ");
+        sb.append("Observation Domain ID: ");
+        sb.append(observationDomainID);
+        sb.append(", ");
+        sb.append("SetHeaders: ");
+        sb.append(setHeaders.size());
+        sb.append(", ");
+        for (SetHeader sh : setHeaders) {
+            sb.append(sh);
+            sb.append(", ");
+        }
+        return sb.toString();
+    }
+}
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/packet/OptionTemplateRecord.java b/ipfix/src/main/java/org/onosproject/ipfix/packet/OptionTemplateRecord.java
new file mode 100644
index 0000000..fafad48
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/packet/OptionTemplateRecord.java
@@ -0,0 +1,176 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix.packet;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.common.primitives.Ints;
+import com.google.common.primitives.Shorts;
+
+/**
+ * IPFIX Option Template Header.
+ */
+public class OptionTemplateRecord extends Record {
+    private static final int HEADER_LENGTH = 6;
+
+    private int templateID;
+    private int fieldCount;
+    private int scopeFieldCount;
+    private List<InformationElement> informationElements = new ArrayList<InformationElement>();
+    private List<InformationElement> scopeInformationElements = new ArrayList<InformationElement>();
+
+    /**
+     * Option Template Header format.
+     *
+     *   0                   1                   2                   3
+     *   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+     *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     *  | Template ID (larger than 255) |         Field Count           |
+     *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     *  |      Scope Field Count        |
+     *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     *
+     */
+
+    public int getTemplateID() {
+        return templateID;
+    }
+
+    public void setTemplateID(int templateID) {
+        this.templateID = templateID;
+    }
+
+    public int getFieldCount() {
+        return fieldCount;
+    }
+
+    public void setFieldCount(int fieldCount) {
+        this.fieldCount = fieldCount;
+    }
+
+    public int getScopeFieldCount() {
+        return scopeFieldCount;
+    }
+
+    public void setScopeFieldCount(int scopeFieldCount) {
+        this.scopeFieldCount = scopeFieldCount;
+    }
+
+    public List<InformationElement> getInformationElements() {
+        return informationElements;
+    }
+
+    public void setInformationElements(List<InformationElement> informationElements) {
+        this.informationElements = informationElements;
+    }
+
+    public List<InformationElement> getScopeInformationElements() {
+        return scopeInformationElements;
+    }
+
+    public void setScopeInformationElements(List<InformationElement> scopeInformationElements) {
+        this.scopeInformationElements = scopeInformationElements;
+    }
+
+    public static OptionTemplateRecord parse(byte[] data) throws HeaderException {
+        try {
+            if (data.length < HEADER_LENGTH) {
+                throw new HeaderException("Data array too short.");
+            }
+            OptionTemplateRecord otr = new OptionTemplateRecord();
+            // template ID
+            byte[] templateID = new byte[2];
+            System.arraycopy(data, 0, templateID, 0, 2);
+            otr.setTemplateID(Ints.fromByteArray(templateID));
+            // field count
+            byte[] fieldCount = new byte[2];
+            System.arraycopy(data, 2, fieldCount, 0, 2);
+            otr.setFieldCount(Ints.fromByteArray(fieldCount));
+            // scope field count
+            byte[] scopeFieldCount = new byte[2];
+            System.arraycopy(data, 4, scopeFieldCount, 0, 2);
+            otr.setScopeFieldCount(Ints.fromByteArray(scopeFieldCount));
+            int offset = HEADER_LENGTH;
+            for (int i = 0; i < otr.getFieldCount(); i++) {
+                byte[] subData = new byte[InformationElement.LENGTH];
+                System.arraycopy(data, offset +
+                        (i * InformationElement.LENGTH), subData, 0, InformationElement.LENGTH);
+                InformationElement ie = InformationElement.parse(subData);
+                if (i < otr.getScopeFieldCount()) {
+                    otr.getScopeInformationElements().add(ie);
+                } else {
+                    otr.getInformationElements().add(ie);
+                }
+            }
+            return otr;
+        } catch (Exception e) {
+            throw new HeaderException("Parse error: " + e.getMessage());
+        }
+    }
+
+    public byte[] getBytes() throws HeaderException {
+        try {
+            int length = HEADER_LENGTH + (scopeInformationElements.size() * InformationElement.LENGTH) +
+                    (informationElements.size() * InformationElement.LENGTH);
+            if (length % 4 != 0) {
+                length += (length % 4); // padding
+            }
+            byte[] data = new byte[length];
+            // template ID
+            System.arraycopy(Shorts.toByteArray((short) getTemplateID()), 0, data, 0, 2);
+            // field count
+            System.arraycopy(Shorts.toByteArray((short) getFieldCount()), 0, data, 2, 2);
+            // scope field count
+            System.arraycopy(Shorts.toByteArray((short) getScopeFieldCount()), 0, data, 4, 2);
+            // information elements
+            int offset = HEADER_LENGTH;
+            for (InformationElement ie : scopeInformationElements) {
+                System.arraycopy(ie.getBytes(), 0, data, offset, InformationElement.LENGTH);
+                offset += InformationElement.LENGTH;
+            }
+            for (InformationElement ie : informationElements) {
+                System.arraycopy(ie.getBytes(), 0, data, offset, InformationElement.LENGTH);
+                offset += InformationElement.LENGTH;
+            }
+            return data;
+        } catch (Exception e) {
+            throw new HeaderException("Error while generating the bytes: " + e.getMessage());
+        }
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("[OptionTemplateRecord]: ");
+        sb.append("Template ID: ");
+        sb.append(templateID);
+        sb.append(", Field count: ");
+        sb.append(fieldCount);
+        sb.append(", Scope field count: ");
+        sb.append(scopeFieldCount);
+        sb.append(", Information elements: ");
+        sb.append(informationElements);
+        sb.append(", Scope Information elements: ");
+        sb.append(scopeInformationElements.size());
+        sb.append(", ");
+        for (InformationElement ie : informationElements) {
+            sb.append(ie);
+            sb.append(", ");
+        }
+        return sb.toString();
+    }
+}
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/packet/Record.java b/ipfix/src/main/java/org/onosproject/ipfix/packet/Record.java
new file mode 100644
index 0000000..dcafcc8
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/packet/Record.java
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix.packet;
+
+/**
+ * IPFIX Record entity.
+ */
+public abstract class Record extends AbstractIpfixPacketEntity implements AbstractIpfixPacketInterface {
+}
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/packet/SamplingDataRecord.java b/ipfix/src/main/java/org/onosproject/ipfix/packet/SamplingDataRecord.java
new file mode 100644
index 0000000..df9fd11
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/packet/SamplingDataRecord.java
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix.packet;
+
+import com.google.common.primitives.Ints;
+import com.google.common.primitives.Longs;
+
+/**
+ * IPFIX Sampling Data Record.
+ */
+public class SamplingDataRecord extends DataRecord {
+    private static final int HEADER_LENGTH = 16; // 2 bytes padding
+
+    private long observationDomainId;
+    private int selectorAlgorithm;
+    private long samplingPacketInterval;
+    private long samplingPacketSpace;
+
+    public long getObservationDomainId() {
+        return observationDomainId;
+    }
+
+    public void setObservationDomainId(long observationDomainId) {
+        this.observationDomainId = observationDomainId;
+    }
+
+    public int getSelectorAlgorithm() {
+        return selectorAlgorithm;
+    }
+
+    public void setSelectorAlgorithm(int selectorAlgorithm) {
+        this.selectorAlgorithm = selectorAlgorithm;
+    }
+
+    public long getSamplingPacketInterval() {
+        return samplingPacketInterval;
+    }
+
+    public void setSamplingPacketInterval(long samplingPacketInterval) {
+        this.samplingPacketInterval = samplingPacketInterval;
+    }
+
+    public long getSamplingPacketSpace() {
+        return samplingPacketSpace;
+    }
+
+    public void setSamplingPacketSpace(long samplingPacketSpace) {
+        this.samplingPacketSpace = samplingPacketSpace;
+    }
+
+    public static SamplingDataRecord parse(byte[] data) throws HeaderException {
+        try {
+            if (data.length < HEADER_LENGTH) {
+                throw new HeaderException("Data array too short.");
+            }
+            SamplingDataRecord sdr = new SamplingDataRecord();
+            // observationDomainId
+            byte[] observationDomainId = new byte[4];
+            System.arraycopy(data, 0, observationDomainId, 0, 4);
+            sdr.setObservationDomainId(Longs.fromByteArray(observationDomainId));
+            // selectorAlgorithm
+            byte[] selectorAlgorithm = new byte[2];
+            System.arraycopy(data, 4, selectorAlgorithm, 0, 2);
+            sdr.setSelectorAlgorithm(Ints.fromByteArray(selectorAlgorithm));
+            // samplingPacketInterval
+            byte[] samplingPacketInterval = new byte[4];
+            System.arraycopy(data, 6, samplingPacketInterval, 0, 4);
+            sdr.setSamplingPacketInterval(Longs.fromByteArray(samplingPacketInterval));
+            // samplingPacketSpace
+            byte[] samplingPacketSpace = new byte[4];
+            System.arraycopy(data, 10, samplingPacketSpace, 0, 4);
+            sdr.setSamplingPacketSpace(Longs.fromByteArray(samplingPacketSpace));
+            return sdr;
+        } catch (Exception e) {
+            throw new HeaderException("Parse error: " + e.getMessage());
+        }
+    }
+
+    public byte[] getBytes() throws HeaderException {
+        try {
+            byte[] data = new byte[HEADER_LENGTH];
+            // observationDomainId
+            System.arraycopy(Ints.toByteArray((int) getObservationDomainId()), 0, data, 0, 4);
+            // selectorAlgorithm
+            System.arraycopy(Ints.toByteArray((int) getSelectorAlgorithm()), 0, data, 4, 2);
+            // samplingPacketInterval
+            System.arraycopy(Ints.toByteArray((int) getSamplingPacketInterval()), 0, data, 6, 4);
+            // samplingPacketSpace
+            System.arraycopy(Ints.toByteArray((int) getSamplingPacketSpace()), 0, data, 10, 4);
+            return data;
+        } catch (Exception e) {
+            throw new HeaderException("Error while generating the bytes: " + e.getMessage());
+        }
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("[SamplingDataRecord]: ");
+        sb.append(" Observation domain ID: ");
+        sb.append(observationDomainId);
+        sb.append(", Selector algorithm: ");
+        sb.append(selectorAlgorithm);
+        sb.append(", Sampling packet interval: ");
+        sb.append(samplingPacketInterval);
+        sb.append(", Sampling packet space: ");
+        sb.append(samplingPacketSpace);
+        return sb.toString();
+    }
+}
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/packet/SetHeader.java b/ipfix/src/main/java/org/onosproject/ipfix/packet/SetHeader.java
new file mode 100644
index 0000000..ee90d54
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/packet/SetHeader.java
@@ -0,0 +1,231 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix.packet;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.google.common.primitives.Ints;
+import com.google.common.primitives.Shorts;
+
+/**
+ * IPFIX Set Header format.
+ */
+public class SetHeader extends AbstractIpfixPacketEntity implements AbstractIpfixPacketInterface {
+    private static final Logger LOGGER = Logger.getLogger(SetHeader.class.getName());
+    private static final int HEADER_LENGTH = 4;
+    private static final int TEMPLATE_SET_ID = 2;
+    private static final int OPTION_SET_ID = 3;
+
+    private int setID;
+    private int length;
+    private List<DataRecord> dataRecords = new ArrayList<DataRecord>();
+    private List<TemplateRecord> templateRecords = new ArrayList<TemplateRecord>();
+    private List<OptionTemplateRecord> optionTemplateRecords = new ArrayList<OptionTemplateRecord>();
+
+    /**
+     * Set Header format.
+     *
+     *  0                   1                   2                   3
+     *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |          Set ID               |          Length               |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     *
+     */
+
+    /**
+     * A value of 2 is reserved for Template Sets. A value of 3 is reserved
+     * for Options Template Sets.  Values from 4 to 255 are reserved for
+     * future use.  Values 256 and above are used for Data Sets.  The Set ID
+     * values of 0 and 1 are not used, for historical reasons.
+     *
+     * @return Set ID
+     */
+    public int getSetID() {
+        return setID;
+    }
+
+    public void setSetID(int setID) {
+        this.setID = setID;
+    }
+
+    public int getLength() {
+        return length;
+    }
+
+    public void setLength(int length) {
+        this.length = length;
+    }
+
+    public List<DataRecord> getDataRecords() {
+        return dataRecords;
+    }
+
+    public void setDataRecords(List<DataRecord> dataRecords) {
+        this.dataRecords = dataRecords;
+        updateLength();
+    }
+
+    public List<TemplateRecord> getTemplateRecords() {
+        return templateRecords;
+    }
+
+    public void setTemplateRecords(List<TemplateRecord> templateRecords) {
+        this.templateRecords = templateRecords;
+        updateLength();
+    }
+
+    public List<OptionTemplateRecord> getOptionTemplateRecords() {
+        return optionTemplateRecords;
+    }
+
+    public void setOptionTemplateRecords(List<OptionTemplateRecord> optionTemplateRecords) {
+        this.optionTemplateRecords = optionTemplateRecords;
+        updateLength();
+    }
+
+    /**
+     * Updates SetHeaderlength when new records are set/added.
+     */
+    private void updateLength() {
+        int newLength = 0;
+        for (TemplateRecord template : templateRecords) {
+            newLength += template.getLength();
+        }
+        for (OptionTemplateRecord optionTemplate : optionTemplateRecords) {
+            newLength += optionTemplate.getLength();
+        }
+        for (DataRecord record : dataRecords) {
+            newLength += record.getLength();
+        }
+        this.length = newLength + HEADER_LENGTH;
+    }
+
+    public static SetHeader parse(byte[] data) throws HeaderException {
+        try {
+            if (data.length < HEADER_LENGTH) {
+                throw new HeaderException("Data array too short.");
+            }
+            SetHeader sh = new SetHeader();
+            // set id
+            byte[] setID = new byte[2];
+            System.arraycopy(data, 0, setID, 0, 2);
+            sh.setSetID(Ints.fromByteArray(setID));
+            // length
+            byte[] length = new byte[2];
+            System.arraycopy(data, 2, length, 0, 2);
+            sh.setLength(Ints.fromByteArray(length));
+            // 2 -> template sets;
+            if (sh.getSetID() == TEMPLATE_SET_ID) {
+                int offset = HEADER_LENGTH;
+                byte[] subData = new byte[sh.getLength() - offset];
+                System.arraycopy(data, offset, subData, 0, subData.length);
+                TemplateRecord tr = TemplateRecord.parse(subData);
+                sh.getTemplateRecords().add(tr);
+            } else if (sh.getSetID() == OPTION_SET_ID) {  // 3 -> template option sets
+                int offset = HEADER_LENGTH;
+                byte[] subData = new byte[sh.getLength() - offset];
+                System.arraycopy(data, offset, subData, 0, subData.length);
+                OptionTemplateRecord otr = OptionTemplateRecord.parse(subData);
+                sh.getOptionTemplateRecords().add(otr);
+            } else if (sh.getSetID() == 256) { // > 256 -> data record;
+                int offset = HEADER_LENGTH;
+                byte[] subData = new byte[sh.getLength() - offset];
+                System.arraycopy(data, offset, subData, 0, subData.length);
+                SamplingDataRecord sdr = SamplingDataRecord.parse(subData);
+                sh.getDataRecords().add(sdr);
+            } else {
+                LOGGER.log(Level.INFO, "Set ID " + sh.getSetID() + " is unknown and not handled");
+            }
+            return sh;
+        } catch (Exception e) {
+            throw new HeaderException("Parse error: " + e.getMessage());
+        }
+    }
+
+    public byte[] getBytes() throws HeaderException {
+        try {
+            int length = HEADER_LENGTH;
+            for (DataRecord dr : dataRecords) {
+                length += dr.getLength();
+            }
+            for (TemplateRecord tr : templateRecords) {
+                length += tr.getLength();
+            }
+            for (OptionTemplateRecord otr : optionTemplateRecords) {
+                length += otr.getLength();
+            }
+            byte[] data = new byte[length];
+            // set id
+            System.arraycopy(Shorts.toByteArray((short) getSetID()), 0, data, 0, 2);
+            // length
+            System.arraycopy(Shorts.toByteArray((short) getLength()), 0, data, 2, 2);
+            // data record
+            int offset = HEADER_LENGTH;
+            for (DataRecord record : dataRecords) {
+                System.arraycopy(record.getBytes(), 0, data, offset, record.getLength());
+                offset += record.getLength();
+            }
+            for (TemplateRecord record : templateRecords) {
+                byte[] recordData = record.getBytes();
+                System.arraycopy(recordData, 0, data, offset, record.getLength());
+                offset += recordData.length;
+            }
+            for (OptionTemplateRecord record : optionTemplateRecords) {
+                byte[] recordData = record.getBytes();
+                System.arraycopy(recordData, 0, data, offset, record.getLength());
+                offset += recordData.length;
+            }
+            return data;
+        } catch (Exception e) {
+            throw new HeaderException("Error while generating the bytes: " + e.getMessage());
+        }
+    }
+
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("[SetHeader]: ");
+        sb.append("Set ID: ");
+        sb.append(setID);
+        sb.append(", Length: ");
+        sb.append(length);
+        sb.append(", Data records: ");
+        sb.append(dataRecords.size());
+        sb.append(", ");
+        for (DataRecord record : dataRecords) {
+            sb.append(record);
+            sb.append(", ");
+        }
+        sb.append("Template records: ");
+        sb.append(templateRecords.size());
+        sb.append(", ");
+        for (TemplateRecord record : templateRecords) {
+            sb.append(record);
+            sb.append(", ");
+        }
+        sb.append("Option template records: ");
+        sb.append(optionTemplateRecords.size());
+        sb.append(", ");
+        for (OptionTemplateRecord record : optionTemplateRecords) {
+            sb.append(record);
+            sb.append(", ");
+        }
+        return sb.toString();
+    }
+}
\ No newline at end of file
diff --git a/ipfix/src/main/java/org/onosproject/ipfix/packet/TemplateRecord.java b/ipfix/src/main/java/org/onosproject/ipfix/packet/TemplateRecord.java
new file mode 100644
index 0000000..12ea916
--- /dev/null
+++ b/ipfix/src/main/java/org/onosproject/ipfix/packet/TemplateRecord.java
@@ -0,0 +1,139 @@
+/*
+ * 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.
+ */
+package org.onosproject.ipfix.packet;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.common.primitives.Ints;
+import com.google.common.primitives.Shorts;
+
+/**
+ * IPFIX Template Record header.
+ */
+public class TemplateRecord extends Record {
+    private static final int HEADER_LENGTH = 4;
+    private int templateID;
+    private int fieldCount;
+    private List<InformationElement> informationElements = new ArrayList<InformationElement>();
+
+    /**
+     * Template Record header.
+     *
+     *  0                   1                   2                   3
+     *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * | Template ID (larger than 255) |         Field Count           |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     *
+     */
+
+    public int getTemplateID() {
+        return templateID;
+    }
+
+    public void setTemplateID(int templateID) {
+        this.templateID = templateID;
+    }
+
+    public int getFieldCount() {
+        return fieldCount;
+    }
+
+    public void setFieldCount(int fieldCount) {
+        this.fieldCount = fieldCount;
+    }
+
+    public List<InformationElement> getInformationElements() {
+        return informationElements;
+    }
+
+    public void setInformationElements(List<InformationElement> informationElements) {
+        this.informationElements = informationElements;
+        this.fieldCount = this.informationElements.size();
+    }
+
+    public int getLength() {
+        return HEADER_LENGTH + (informationElements.size() * InformationElement.LENGTH);
+    }
+
+    public static TemplateRecord parse(byte[] data) throws HeaderException {
+        try {
+            if (data.length < HEADER_LENGTH) {
+                throw new HeaderException("Data array too short.");
+            }
+            TemplateRecord tr = new TemplateRecord();
+            // template ID
+            byte[] templateID = new byte[2];
+            System.arraycopy(data, 0, templateID, 0, 2);
+            tr.setTemplateID(Ints.fromByteArray(templateID));
+            // field count
+            byte[] fieldCount = new byte[2];
+            System.arraycopy(data, 2, fieldCount, 0, 2);
+            tr.setFieldCount(Ints.fromByteArray(fieldCount));
+            int offset = HEADER_LENGTH;
+            for (int i = 0; i < tr.getFieldCount(); i++) {
+                byte[] subData = new byte[InformationElement.LENGTH];
+                System.arraycopy(data, offset +
+                        (i * InformationElement.LENGTH), subData, 0, InformationElement.LENGTH);
+                InformationElement ie = InformationElement.parse(subData);
+                tr.getInformationElements().add(ie);
+            }
+            return tr;
+        } catch (Exception e) {
+            throw new HeaderException("Parse error: " + e.getMessage());
+        }
+    }
+
+    public byte[] getBytes() throws HeaderException {
+        try {
+            int length = HEADER_LENGTH + (informationElements.size() * InformationElement.LENGTH);
+            byte[] data = new byte[length];
+            // template ID
+            System.arraycopy(Shorts.toByteArray((short) getTemplateID()), 0, data, 0, 2);
+            // field count
+            System.arraycopy(Shorts.toByteArray((short) getFieldCount()), 0, data, 2, 2);
+            // information elements
+            int offset = HEADER_LENGTH;
+            for (InformationElement ie : informationElements) {
+                System.arraycopy(ie.getBytes(), 0, data, offset, InformationElement.LENGTH);
+                offset += InformationElement.LENGTH;
+            }
+            return data;
+        } catch (Exception e) {
+            throw new HeaderException("Error while generating the bytes: " + e.getMessage());
+        }
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("[TemplateRecord]: ");
+        sb.append("Template ID: ");
+        sb.append(templateID);
+        sb.append(", Field count: ");
+        sb.append(fieldCount);
+        sb.append(", Information elements: ");
+        sb.append(informationElements.size());
+        sb.append(", ");
+        for (InformationElement ie : informationElements) {
+            sb.append(ie);
+            sb.append(", ");
+        }
+
+        return sb.toString();
+    }
+}
\ No newline at end of file
diff --git a/ipfix/src/test/java/org/onosproject/ipfix/Of2IpfixTest.java b/ipfix/src/test/java/org/onosproject/ipfix/Of2IpfixTest.java
new file mode 100644
index 0000000..da690d5
--- /dev/null
+++ b/ipfix/src/test/java/org/onosproject/ipfix/Of2IpfixTest.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2014 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.ipfix;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onosproject.cfg.ComponentConfigAdapter;
+
+/**
+ * Set of tests for the ONOS IPFIX application.
+ */
+public class Of2IpfixTest {
+
+    private IpfixManager component;
+
+    @Before
+    public void setUp() {
+        component = new IpfixManager();
+        component.cfgService = new ComponentConfigAdapter();
+        // component.activate(null);
+
+    }
+
+    @After
+    public void tearDown() {
+        // component.deactivate(null);
+    }
+
+    @Test
+    public void basics() {
+
+    }
+
+}
diff --git a/pom.xml b/pom.xml
index 8aae095..5105151 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,6 +56,7 @@
         <module>mfwd</module>
 	<module>igmp</module>
         <module>flowtest</module>
+        <module>ipfix</module>
     </modules>
 
     <properties>
