API for LLDP, NS, NA, ARP counter added in Packet stats app

Change-Id: If49f35d2fb302496f59e095a2ae6062ca48108ad
diff --git a/apps/packet-stats/BUILD b/apps/packet-stats/BUILD
index 4019f9b..3223454 100644
--- a/apps/packet-stats/BUILD
+++ b/apps/packet-stats/BUILD
@@ -1,15 +1,13 @@
-COMPILE_DEPS = CORE_DEPS + JACKSON + METRICS + CLI + [
-    "//core/store/serializers:onos-core-serializers",
-    "//core/store/primitives:onos-core-primitives",
+BUNDLES = [
+    "//apps/packet-stats/web:onos-apps-packet-stats-web",
+    "//apps/packet-stats/app:onos-apps-packet-stats-app",
 ]
 
-osgi_jar_with_tests(
-    deps = COMPILE_DEPS,
-)
-
 onos_app(
-    category = "Traffic Engineering",
-    description = "Application to calculate the number of packets of different types",
+    app_name = "org.onosproject.packet-stats",
+    category = "Utility",
+    description = " Application to calculate the number of packets of different types",
+    included_bundles = BUNDLES,
     title = "Packet Statistics",
     url = "http://onosproject.org",
 )
diff --git a/apps/packet-stats/app/BUILD b/apps/packet-stats/app/BUILD
new file mode 100644
index 0000000..12c0a66
--- /dev/null
+++ b/apps/packet-stats/app/BUILD
@@ -0,0 +1,7 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + CLI + METRICS + [
+    "//core/store/serializers:onos-core-serializers",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/apps/packet-stats/src/main/java/org/onosproject/packetstats/PacketStatistics.java b/apps/packet-stats/app/src/main/java/org/onosproject/packetstats/PacketStatistics.java
similarity index 81%
rename from apps/packet-stats/src/main/java/org/onosproject/packetstats/PacketStatistics.java
rename to apps/packet-stats/app/src/main/java/org/onosproject/packetstats/PacketStatistics.java
index 05800f2..ad3074e 100644
--- a/apps/packet-stats/src/main/java/org/onosproject/packetstats/PacketStatistics.java
+++ b/apps/packet-stats/app/src/main/java/org/onosproject/packetstats/PacketStatistics.java
@@ -23,6 +23,8 @@
 import org.osgi.service.component.annotations.ReferenceCardinality;
 import org.onlab.packet.Ethernet;
 import org.onlab.packet.IPv4;
+import org.onlab.packet.IPv6;
+import org.onlab.packet.ICMP6;
 import org.onlab.packet.UDP;
 import org.onosproject.cfg.ComponentConfigService;
 import org.onosproject.core.ApplicationId;
@@ -63,7 +65,7 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY)
     protected MetricsService metricService;
 
-    private ReactivePacketProcessor processor = new ReactivePacketProcessor();
+    private PacketCounter processor = new PacketCounter();
     private final Logger log = getLogger(getClass());
 
     private ApplicationId appId;
@@ -82,6 +84,12 @@
     private Counter tcpCounter;
     private MetricsFeature icmpFeature;
     private Counter icmpCounter;
+    private MetricsFeature icmp6Feature;
+    private Counter icmp6Counter;
+    private MetricsFeature nbrSolicitFeature;
+    private Counter nbrSolicitCounter;
+    private MetricsFeature nbrAdvertFeature;
+    private Counter nbrAdvertCounter;
     private MetricsFeature igmpFeature;
     private Counter igmpCounter;
     private MetricsFeature pimFeature;
@@ -95,8 +103,6 @@
     private MetricsFeature unknownFeature;
     private Counter unknownCounter;
 
-
-
     @Activate
     public void activate(ComponentContext context) {
         this.packetStatisticsComponent =
@@ -113,6 +119,12 @@
                 packetStatisticsComponent.registerFeature("tcpFeature");
         this.icmpFeature =
                 packetStatisticsComponent.registerFeature("icmpFeature");
+        this.icmp6Feature =
+                packetStatisticsComponent.registerFeature("icmp6Feature");
+        this.nbrSolicitFeature =
+                packetStatisticsComponent.registerFeature("nbrSolicitFeature");
+        this.nbrAdvertFeature =
+                packetStatisticsComponent.registerFeature("nbrAdvertFeature");
         this.igmpFeature =
                 packetStatisticsComponent.registerFeature("igmpFeature");
         this.pimFeature =
@@ -135,6 +147,12 @@
                 metricService.createCounter(packetStatisticsComponent, vlanFeature, "vlanPC");
         this.icmpCounter =
                 metricService.createCounter(packetStatisticsComponent, icmpFeature, "icmpPC");
+        this.icmp6Counter =
+                metricService.createCounter(packetStatisticsComponent, icmp6Feature, "icmp6PC");
+        this.nbrSolicitCounter =
+                metricService.createCounter(packetStatisticsComponent, nbrSolicitFeature, "nbrSolicitPC");
+        this.nbrAdvertCounter =
+                metricService.createCounter(packetStatisticsComponent, nbrAdvertFeature, "nbrAdvertPC");
         this.igmpCounter =
                 metricService.createCounter(packetStatisticsComponent, igmpFeature, "igmpPC");
         this.pimCounter =
@@ -146,13 +164,10 @@
         this.unknownCounter =
                 metricService.createCounter(packetStatisticsComponent, unknownFeature, "unknownPC");
 
-
         appId = coreService.registerApplication("org.onosproject.packet-stats");
 
         packetService.addProcessor(processor, PacketProcessor.director(0));
         log.info("Started", appId.id());
-
-
     }
 
     @Deactivate
@@ -166,9 +181,9 @@
 
 
     /**
-     * Packet processor responsible for forwarding packets along their paths.
+     * Packet processor responsible for counting various types of packets.
      */
-    private class ReactivePacketProcessor implements PacketProcessor {
+    private class PacketCounter implements PacketProcessor {
         @Override
         public void process(PacketContext context) {
             InboundPacket pkt = context.inPacket();
@@ -217,12 +232,21 @@
                             dhcpCounter.inc();
                         }
                     }
-
-                } else {
-                    log.info("Packet is unknown.");
+            } else if (ethPkt.getEtherType() == Ethernet.TYPE_IPV6) {
+                   IPv6 ipv6Pkt = (IPv6) ethPkt.getPayload();
+                   if (ipv6Pkt.getNextHeader() == IPv6.PROTOCOL_ICMP6) {
+                       icmp6Counter.inc();
+                       ICMP6 icmpv6 = (ICMP6) ipv6Pkt.getPayload();
+                       if (icmpv6.getIcmpType() == ICMP6.NEIGHBOR_SOLICITATION) {
+                          nbrSolicitCounter.inc();
+                       } else if (icmpv6.getIcmpType() == ICMP6.NEIGHBOR_ADVERTISEMENT) {
+                          nbrAdvertCounter.inc();
+                       }
+                   }
+            } else {
+                    log.debug("Packet is unknown.");
                     unknownCounter.inc();
               }
             }
-            }
-
-        }
\ No newline at end of file
+        }
+}
diff --git a/apps/packet-stats/src/main/java/org/onosproject/packetstats/PacketStatsUiComponent.java b/apps/packet-stats/app/src/main/java/org/onosproject/packetstats/PacketStatsUiComponent.java
similarity index 100%
rename from apps/packet-stats/src/main/java/org/onosproject/packetstats/PacketStatsUiComponent.java
rename to apps/packet-stats/app/src/main/java/org/onosproject/packetstats/PacketStatsUiComponent.java
diff --git a/apps/packet-stats/src/main/java/org/onosproject/packetstats/PacketStatsUiMessageHandler.java b/apps/packet-stats/app/src/main/java/org/onosproject/packetstats/PacketStatsUiMessageHandler.java
similarity index 100%
rename from apps/packet-stats/src/main/java/org/onosproject/packetstats/PacketStatsUiMessageHandler.java
rename to apps/packet-stats/app/src/main/java/org/onosproject/packetstats/PacketStatsUiMessageHandler.java
diff --git a/apps/packet-stats/app/src/main/java/org/onosproject/packetstats/cli/PacketStatisticsShowCommand.java b/apps/packet-stats/app/src/main/java/org/onosproject/packetstats/cli/PacketStatisticsShowCommand.java
new file mode 100644
index 0000000..9e44bd4
--- /dev/null
+++ b/apps/packet-stats/app/src/main/java/org/onosproject/packetstats/cli/PacketStatisticsShowCommand.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2016-present Open Networking Foundation
+ *
+ * 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.packetstats.cli;
+
+import com.codahale.metrics.Counter;
+import com.codahale.metrics.MetricFilter;
+import org.apache.karaf.shell.api.action.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onlab.metrics.MetricsService;
+import java.util.Map;
+/**
+ * Displays the entries.
+ */
+@Command(scope = "onos", name = "pkt-stats-show", description = "Displays the packet statistics values")
+public class PacketStatisticsShowCommand extends AbstractShellCommand {
+
+    private static final String METRIC_NAME = null;
+    private static final String FORMAT = "PacketType = %s, Count = %s";
+    private static final String FORMAT_LLDP = "Device = %s, Count = %s";
+    MetricFilter filter = METRIC_NAME != null ? (name, metric) -> name.equals(METRIC_NAME) : MetricFilter.ALL;
+
+
+    @Override
+    protected void doExecute() {
+            MetricsService service = get(MetricsService.class);
+            Map<String, Counter> counters = service.getCounters(filter);
+
+            Counter arpCounter = counters.get("packetStatisticsComponent.arpFeature.arpPC");
+            Counter lldpCounter = counters.get("packetStatisticsComponent.lldpFeature.lldpPC");
+            Counter nsCounter = counters.get("packetStatisticsComponent.nbrSolicitFeature.nbrSolicitPC");
+            Counter naCounter = counters.get("packetStatisticsComponent.nbrAdvertFeature.nbrAdvertPC");
+
+            print(FORMAT, "ARP ", arpCounter.getCount());
+            print(FORMAT, "LLDP ", lldpCounter.getCount());
+            print(FORMAT, "Neighbor Solicitation ", nsCounter.getCount());
+            print(FORMAT, "Neighbor Advertisement ", naCounter.getCount());
+
+    }
+
+}
diff --git a/apps/packet-stats/app/src/main/java/org/onosproject/packetstats/cli/package-info.java b/apps/packet-stats/app/src/main/java/org/onosproject/packetstats/cli/package-info.java
new file mode 100644
index 0000000..5b37086
--- /dev/null
+++ b/apps/packet-stats/app/src/main/java/org/onosproject/packetstats/cli/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2014-present Open Networking Foundation
+ *
+ * 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.
+ */
+
+/**
+ * Sample application that provides simple packet statistics.
+ */
+package org.onosproject.packetstats.cli;
diff --git a/apps/packet-stats/src/main/java/org/onosproject/packetstats/package-info.java b/apps/packet-stats/app/src/main/java/org/onosproject/packetstats/package-info.java
similarity index 100%
rename from apps/packet-stats/src/main/java/org/onosproject/packetstats/package-info.java
rename to apps/packet-stats/app/src/main/java/org/onosproject/packetstats/package-info.java
diff --git a/apps/packet-stats/app/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/apps/packet-stats/app/src/main/resources/OSGI-INF/blueprint/shell-config.xml
new file mode 100644
index 0000000..af51080
--- /dev/null
+++ b/apps/packet-stats/app/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -0,0 +1,23 @@
+<!--
+  ~ Copyright 2014-present Open Networking Foundation
+  ~
+  ~ 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.
+  -->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+        <command>
+            <action class="org.onosproject.packetstats.cli.PacketStatisticsShowCommand"/>
+        </command>
+    </command-bundle>
+</blueprint>
diff --git a/apps/packet-stats/src/main/resources/app/view/sampleCustom/sampleCustom.css b/apps/packet-stats/app/src/main/resources/app/view/sampleCustom/sampleCustom.css
similarity index 100%
rename from apps/packet-stats/src/main/resources/app/view/sampleCustom/sampleCustom.css
rename to apps/packet-stats/app/src/main/resources/app/view/sampleCustom/sampleCustom.css
diff --git a/apps/packet-stats/src/main/resources/app/view/sampleCustom/sampleCustom.html b/apps/packet-stats/app/src/main/resources/app/view/sampleCustom/sampleCustom.html
similarity index 100%
rename from apps/packet-stats/src/main/resources/app/view/sampleCustom/sampleCustom.html
rename to apps/packet-stats/app/src/main/resources/app/view/sampleCustom/sampleCustom.html
diff --git a/apps/packet-stats/src/main/resources/app/view/sampleCustom/sampleCustom.js b/apps/packet-stats/app/src/main/resources/app/view/sampleCustom/sampleCustom.js
similarity index 100%
rename from apps/packet-stats/src/main/resources/app/view/sampleCustom/sampleCustom.js
rename to apps/packet-stats/app/src/main/resources/app/view/sampleCustom/sampleCustom.js
diff --git a/apps/packet-stats/src/main/resources/sampleCustom/css.html b/apps/packet-stats/app/src/main/resources/sampleCustom/css.html
similarity index 100%
rename from apps/packet-stats/src/main/resources/sampleCustom/css.html
rename to apps/packet-stats/app/src/main/resources/sampleCustom/css.html
diff --git a/apps/packet-stats/src/main/resources/sampleCustom/js.html b/apps/packet-stats/app/src/main/resources/sampleCustom/js.html
similarity index 100%
rename from apps/packet-stats/src/main/resources/sampleCustom/js.html
rename to apps/packet-stats/app/src/main/resources/sampleCustom/js.html
diff --git a/apps/packet-stats/web/BUILD b/apps/packet-stats/web/BUILD
new file mode 100644
index 0000000..3084433
--- /dev/null
+++ b/apps/packet-stats/web/BUILD
@@ -0,0 +1,13 @@
+COMPILE_DEPS = CORE_DEPS + KRYO + JACKSON + REST + CLI + METRICS + [
+    "@jersey_server//jar",
+    "//core/store/serializers:onos-core-serializers",
+]
+
+osgi_jar(
+    api_description = "REST API for Packet Stats",
+    api_package = "org.onosproject.packetstats.rest",
+    api_title = "Packet Stats App",
+    api_version = "1.0",
+    web_context = "/onos/v1/packet-stats",
+    deps = COMPILE_DEPS,
+)
diff --git a/apps/packet-stats/web/src/main/java/org/onosproject/packetstats/rest/PacketStatsWebApplication.java b/apps/packet-stats/web/src/main/java/org/onosproject/packetstats/rest/PacketStatsWebApplication.java
new file mode 100644
index 0000000..f5d6202
--- /dev/null
+++ b/apps/packet-stats/web/src/main/java/org/onosproject/packetstats/rest/PacketStatsWebApplication.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2014-present Open Networking Foundation
+ *
+ * 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.packetstats.rest;
+
+import org.onlab.rest.AbstractWebApplication;
+
+import java.util.Set;
+
+/**
+ * Packet Stats Web application.
+ */
+public class PacketStatsWebApplication extends AbstractWebApplication {
+    @Override
+    public Set<Class<?>> getClasses() {
+        return getClasses(PacketStatsWebResource.class);
+    }
+}
diff --git a/apps/packet-stats/web/src/main/java/org/onosproject/packetstats/rest/PacketStatsWebResource.java b/apps/packet-stats/web/src/main/java/org/onosproject/packetstats/rest/PacketStatsWebResource.java
new file mode 100644
index 0000000..a6bf190
--- /dev/null
+++ b/apps/packet-stats/web/src/main/java/org/onosproject/packetstats/rest/PacketStatsWebResource.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2014-present Open Networking Foundation
+ *
+ * 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.packetstats.rest;
+import javax.ws.rs.Path;
+import javax.ws.rs.GET;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.onosproject.rest.AbstractWebResource;
+import com.codahale.metrics.MetricFilter;
+import com.codahale.metrics.Counter;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onlab.metrics.MetricsService;
+import java.util.Map;
+
+/**
+ * Packet Stats REST API.
+ */
+public class PacketStatsWebResource extends AbstractWebResource {
+    private final ObjectMapper mapper = new ObjectMapper();
+    private static final String METRIC_NAME = null;
+    MetricFilter filter = METRIC_NAME != null ? (name, metric) -> name.equals(METRIC_NAME) : MetricFilter.ALL;
+
+    @GET
+    @Path("counters")
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response packetStatsCounters() {
+        ObjectNode node = getPacketStatsCountersJson();
+        return Response.status(200).entity(node).build();
+    }
+
+    private ObjectNode getPacketStatsCountersJson() {
+        MetricsService service = get(MetricsService.class);
+        ObjectNode node = mapper.createObjectNode();
+        ObjectNode pktCounterNode = mapper.createObjectNode();
+        Map<String, Counter> counters = service.getCounters(filter);
+
+        Counter arpCounter = counters.get("packetStatisticsComponent.arpFeature.arpPC");
+        Counter lldpCounter = counters.get("packetStatisticsComponent.lldpFeature.lldpPC");
+        Counter nsCounter = counters.get("packetStatisticsComponent.nbrSolicitFeature.nbrSolicitPC");
+        Counter naCounter = counters.get("packetStatisticsComponent.nbrAdvertFeature.nbrAdvertPC");
+
+        pktCounterNode.put("arpCounter", arpCounter.getCount());
+        pktCounterNode.put("lldpCounter", lldpCounter.getCount());
+        pktCounterNode.put("nsCounter", nsCounter.getCount());
+        pktCounterNode.put("naCounter", naCounter.getCount());
+
+        node.put("packet_stats_counters", pktCounterNode);
+        return node;
+
+    }
+}
diff --git a/apps/packet-stats/web/src/main/java/org/onosproject/packetstats/rest/package-info.java b/apps/packet-stats/web/src/main/java/org/onosproject/packetstats/rest/package-info.java
new file mode 100644
index 0000000..9f5bd97
--- /dev/null
+++ b/apps/packet-stats/web/src/main/java/org/onosproject/packetstats/rest/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2014-present Open Networking Foundation
+ *
+ * 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.
+ */
+
+/**
+ * Sample application that provides simple packet statistics.
+ */
+package org.onosproject.packetstats.rest;
diff --git a/apps/packet-stats/web/src/main/webapp/WEB-INF/web.xml b/apps/packet-stats/web/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..fda12c5
--- /dev/null
+++ b/apps/packet-stats/web/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2018-present Open Networking Foundation
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         id="ONOS" version="2.5">
+    <display-name>PACKET STATS REST API v1.0</display-name>
+
+    <security-constraint>
+        <web-resource-collection>
+            <web-resource-name>Secured</web-resource-name>
+            <url-pattern>/*</url-pattern>
+        </web-resource-collection>
+        <auth-constraint>
+            <role-name>admin</role-name>
+        </auth-constraint>
+    </security-constraint>
+
+    <security-role>
+        <role-name>admin</role-name>
+    </security-role>
+
+    <login-config>
+        <auth-method>BASIC</auth-method>
+        <realm-name>karaf</realm-name>
+    </login-config>
+
+    <servlet>
+        <servlet-name>JAX-RS Service</servlet-name>
+        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
+        <init-param>
+            <param-name>javax.ws.rs.Application</param-name>
+            <param-value>org.onosproject.packetstats.rest.PacketStatsWebApplication</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>JAX-RS Service</servlet-name>
+        <url-pattern>/*</url-pattern>
+    </servlet-mapping>
+</web-app>