VOL-1393: Implement meter features reply

Change-Id: Icbc8b4ac9685baa437b635018047a6a929f633c5
diff --git a/.gitignore b/.gitignore
index ad47567..4dccc3d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -90,3 +90,6 @@
 
 # OpenOLT repo
 voltha/adapters/openolt/core
+
+# junit-coverage file
+**/junit-coverage.xml
diff --git a/ofagent/of_protocol_handler.py b/ofagent/of_protocol_handler.py
index 984802e..01f896b 100644
--- a/ofagent/of_protocol_handler.py
+++ b/ofagent/of_protocol_handler.py
@@ -29,6 +29,10 @@
 
     ofp_version = [4]  # OFAgent supported versions
 
+    MAX_METER_IDS = 4294967295
+    MAX_METER_BANDS = 255
+    MAX_METER_COLORS = 255
+
     def __init__(self, datapath_id, device_id, agent, cxn, rpc):
         """
         The upper half of the OpenFlow protocol, focusing on message
@@ -261,7 +265,13 @@
         raise NotImplementedError()
 
     def handle_meter_features_request(self, req):
-        self.cxn.send(ofp.message.bad_request_error_msg())
+        feature = ofp.meter_features(max_meter=OpenFlowProtocolHandler.MAX_METER_IDS,
+                                     band_types=ofp.OFPMBT_DROP,
+                                     capabilities=ofp.OFPMF_KBPS,
+                                     max_bands=OpenFlowProtocolHandler.MAX_METER_BANDS,
+                                     max_color=OpenFlowProtocolHandler.MAX_METER_COLORS)
+        self.cxn.send(ofp.message.meter_features_stats_reply(xid=req.xid, flags=None,
+                                                             features=feature))
 
     @inlineCallbacks
     def handle_port_stats_request(self, req):
diff --git a/tests/utests/ofagent/test_of_protocol_handler.py b/tests/utests/ofagent/test_of_protocol_handler.py
index fbcc654..d86a48b 100644
--- a/tests/utests/ofagent/test_of_protocol_handler.py
+++ b/tests/utests/ofagent/test_of_protocol_handler.py
@@ -103,5 +103,27 @@
         print context.exception
         self.assertTrue('\'function\' object has no attribute \'send\'' in str(context.exception))
 
+    def test_handle_meter_features_request_in_role_master(self):
+        generic_obj = self.gen_generic_obj()
+        device = self.gen_device()
+        of_proto_handler = OpenFlowProtocolHandler(device.datapath_id, device.id, generic_obj, generic_obj, generic_obj)
+        of_proto_handler.role = ofp.OFPCR_ROLE_MASTER
+        with self.assertRaises(Exception) as context:
+            of_proto_handler.handle_meter_features_request(generic_obj)
+        print context.exception
+        self.assertTrue('\'function\' object has no attribute \'send\'' in str(context.exception))
+
+    def test_handle_meter_features_request_in_role_slave(self):
+        generic_obj = self.gen_generic_obj()
+        device = self.gen_device()
+        of_proto_handler = OpenFlowProtocolHandler(device.datapath_id, device.id, generic_obj, generic_obj, generic_obj)
+        of_proto_handler.role = ofp.OFPCR_ROLE_SLAVE
+        with self.assertRaises(Exception) as context:
+            of_proto_handler.handle_meter_features_request(generic_obj)
+        print
+        context.exception
+        self.assertTrue('\'function\' object has no attribute \'send\'' in str(context.exception))
+
+
 if __name__ == '__main__':
     main()