733: Insert the description of the change.Need to support Error Checking for consistency – if Meter Reference made then need Meter to exist first before reference.

If Flow Table ID does not resolve to a Technology Profile in KV Store generate an error – initial approach to simplify implementation - the Technology for the Profile will not be used to qualify the lookup.

Initially just do OF agent checks which do not need knowledge available in the adapter i.e. Meter Band Reference requires Meter Band definition first. Any Forward References need error checks (OF Error messages).

OF Agent needs to pass through the Meter/Meter Band programming and the Flow Table ID used to reference the Technology Profile.

The VOLTHA core needs to be able to receive meters from the OFAgent and store them in the appropriate logical device. A new northbound API needs to be added to the core to support this.

Change-Id: Ide776dbcbc04232c1d929a85707fec09e3dedf6f
diff --git a/tests/utests/ofagent/test_of_protocol_handler.py b/tests/utests/ofagent/test_of_protocol_handler.py
index ca4392d..fbcc654 100644
--- a/tests/utests/ofagent/test_of_protocol_handler.py
+++ b/tests/utests/ofagent/test_of_protocol_handler.py
@@ -40,7 +40,7 @@
         req.role = ofp.OFPCR_ROLE_MASTER
         return req
 
-    def test_handle_flow_mod_request_role_salve(self):
+    def test_handle_flow_mod_request_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)
@@ -57,6 +57,23 @@
         of_proto_handler.role = ofp.OFPCR_ROLE_MASTER
         of_proto_handler.handle_flow_mod_request(generic_obj)
 
+    def test_handle_meter_mod_request_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_mod_request(generic_obj)
+        print context.exception
+        self.assertTrue('\'function\' object has no attribute \'send\'' in str(context.exception))
+
+    def test_handle_meter_mod_request_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
+        of_proto_handler.handle_meter_mod_request(generic_obj)
+
     def test_handle_role_request(self):
         generic_obj = self.gen_generic_obj()
         req = self.gen_role_req()