Completed 2nd complex testcase with 2 ONUs

For details of the two completed scenarios, please read the Python
file (see class doc strings).

Change-Id: I84edc5c26be3816e9b670a5c97feb072286f0070

Use flow_delete_strict and fake dataplane mode

Two changes in this request:

1. I noticed that the installEapolRule() method in install=False mode
   uses the flow_delete message instead of the flow_delete_strict.
   However, the way the message is constructed, this should never have
   the intended effect, because the out_port is left to 0. Per the
   OpenFlow spec, this will match only flows that has the output
   action pointing to port 0. The flow_delete would work only if
   out_port is set to OFPP_ANY (4294967295). Alternatively, the
   flow_delete_strict should be used, in which case the out_port
   attribute is ignored. I decided that the latter makes more sense
   in this use-case.

2. Introduced a "fake-dataplane" mode in which mode all verify_packet
   and verify_packet_in calls automatically pass. This allows the
   tests to manage flows and groups on an OF agent, without actually
   testing packet forwarding, which is useful if the goal is to
   review what flow command the OLT use-case rely on.

Change-Id: I3d39953c39d39a386802c44c5a84aac7560f9c09

Create a pair of isolated Eapol tests

These are extracts from the complex usecase. They differ from the
olt.py Eapol out/in tests in that they really target the ONU port
and not all ports, hence they are more realistic. The main reason
I created them is that on the Tibit OLT Eapol forwarding is not
setup on the OLT port, only on the ONU ports. This is correct behavior
but the original tests would fail with it.

Change-Id: I340c5798c806277ce51b758b6a35f5c9b560a91e
diff --git a/oltconstants.py b/oltconstants.py
index b97ab5a..29a6db5 100644
--- a/oltconstants.py
+++ b/oltconstants.py
@@ -1,4 +1,5 @@
-from oftest.testutils import *
+import logging
+from oftest.testutils import test_param_get, MINSIZE
 import oftest.packet as scapy
 from oftest import config
 
@@ -11,7 +12,7 @@
 onu_port2 = test_param_get("onu_port2", 131)
 olt_port = test_param_get("olt_port", 258)
 device_type = test_param_get("device_type", "normal")  # options: "normal", "pmc", "cpqd"
-
+fake_dataplane = test_param_get("fake_dataplane", False)
 
 def createAllGroupAdd(group_id, ports=[]):
     buckets = []
@@ -101,3 +102,28 @@
     pkt = pkt / ("D" * (pktlen - len(pkt)))
 
     return pkt
+
+# Monkey-patch the oftest library to allow faking the data-plane
+# This mode allows oftest to glide through the OF programming steps while
+# passing all packet receiving tests. This is useful when you want to
+# verify that your agent's OF interface handles all OF protocol messages
+# from the controller, but in the absence of actual data-plane tests.
+# In order to achieve this, in this mode the following chnages are made:
+# - All verify_packet_in() tests pass
+if fake_dataplane:
+    logging.info('Monkey-patching for fake-dataplane operations')
+
+    from oftest import testutils
+
+    def patched_verify_packet_in(test, data, in_port, reason, controller=None):
+        logging.debug('Faking verify_packet_in')
+        msg = ofp.message.packet_in(reason=reason, data=data)
+        return msg
+
+    testutils.verify_packet_in = patched_verify_packet_in
+
+    def patched_verify_packet(test, pkt, of_port):
+        logging.debug('Faking verify_packet')
+        return
+
+    testutils.verify_packet = patched_verify_packet