diff --git a/Detailed_Testing_Methodology.docx b/Detailed_Testing_Methodology.docx
new file mode 100644
index 0000000..bc44866
--- /dev/null
+++ b/Detailed_Testing_Methodology.docx
Binary files differ
diff --git a/Openflow_Protocol_Messages.docx b/Openflow_Protocol_Messages.docx
deleted file mode 100644
index 6de88e6..0000000
--- a/Openflow_Protocol_Messages.docx
+++ /dev/null
Binary files differ
diff --git a/tests/Detailed_Contr_Sw_Messages.py b/tests/Detailed_Contr_Sw_Messages.py
new file mode 100644
index 0000000..e5c1c57
--- /dev/null
+++ b/tests/Detailed_Contr_Sw_Messages.py
@@ -0,0 +1,837 @@
+"""These tests fall under Conformance Test-Suite (OF-SWITCH-1.0.0 TestCases).
+    Refer Documentation -- Detailed testing methodology 
+    <Some of test-cases are directly taken from oftest> """
+
+"Test Suite 3 --> Detailed Controller to switch messages"
+
+import logging
+
+import unittest
+import random
+
+import oftest.controller as controller
+import oftest.cstruct as ofp
+import oftest.message as message
+import oftest.dataplane as dataplane
+import oftest.action as action
+import oftest.parse as parse
+import basic
+
+from testutils import *
+from time import sleep
+from FuncUtils import *
+
+cs_port_map = None
+cs_logger = None
+cs_config = None
+
+def test_set_init(config):
+   
+
+    basic.test_set_init(config)
+
+    global cs_port_map
+    global cs_logger
+    global cs_config
+
+    cs_logger = logging.getLogger("Detailed controller to switch messages")
+    cs_logger.info("Initializing test set")
+    cs_port_map = config["port_map"]
+    cs_config = config
+
+
+class Overlap_Checking(basic.SimpleDataPlane):
+    
+    """Verify that if overlap check flag is set in the flow entry and an overlapping flow is inserted then an error 
+        is generated and switch refuses flow entry"""
+    
+    def runTest(self):
+        
+        cs_logger.info("Running Overlap_Checking test")
+       
+        of_ports = cs_port_map.keys()
+        of_ports.sort()
+        self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+        #Clear Switch State
+        rc = delete_all_flows(self.controller, cs_logger)
+        self.assertEqual(rc, 0, "Failed to delete all flows")
+
+        cs_logger.info("Inserting two overlapping flows")
+        cs_logger.info("Expecting switch to return an error")
+
+        #Insert a flow F with wildcarded all fields
+        (pkt,match) = Wildcard_All(self,of_ports)
+
+        #Verify flow is active  
+        Verify_TableStats(self,active_entries=1)
+        
+        # Build a overlapping flow F'-- Wildcard All except ingress with check overlap bit set
+        Pkt_MatchIngress = simple_tcp_packet()
+        match3 = parse.packet_to_flow_match(Pkt_MatchIngress)
+        self.assertTrue(match3 is not None, "Could not generate flow match from pkt")
+        match3.wildcards = ofp.OFPFW_ALL-ofp.OFPFW_IN_PORT
+        match3.in_port = of_ports[0]
+
+        msg3 = message.flow_mod()
+        msg3.command = ofp.OFPFC_ADD
+        msg3.match = match3
+        msg3.flags |= ofp.OFPFF_CHECK_OVERLAP
+        msg3.cookie = random.randint(0,9007199254740992)
+        msg3.buffer_id = 0xffffffff
+       
+        act3 = action.action_output()
+        act3.port = of_ports[1]
+        self.assertTrue(msg3.actions.add(act3), "could not add action")
+        rv = self.controller.message_send(msg3)
+        self.assertTrue(rv != -1, "Error installing flow mod")
+        self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
+
+        # Verify Flow does not get inserted 
+        Verify_TableStats(self,active_entries=1)
+
+        #Verify OFPET_FLOW_MOD_FAILED/OFPFMFC_OVERLAP error is recieved on the control plane
+        (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_ERROR,         
+                                               timeout=5)
+        self.assertTrue(response is not None, 
+                               'Switch did not reply with error message') 
+        self.assertTrue(response.type==ofp.OFPET_FLOW_MOD_FAILED, 
+                               'Error message type is not flow mod failed ') 
+        self.assertTrue(response.code==ofp.OFPFMFC_OVERLAP, 
+                               'Error Message code is not overlap')
+
+
+class No_Overlap_Checking(basic.SimpleDataPlane):
+
+    """Verify that without overlap check flag set, overlapping flows can be created."""  
+    
+    def runTest(self):
+     
+        cs_logger.info("Running No_Overlap_Checking test")
+
+        of_ports = cs_port_map.keys()
+        of_ports.sort()
+        self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+        #Clear Switch State
+        rc = delete_all_flows(self.controller, cs_logger)
+        self.assertEqual(rc, 0, "Failed to delete all flows")
+
+        cs_logger.info("Inserting two overlapping flows")
+        cs_logger.info("Expecting switch to insert the flows without generating errors")
+
+        #Build a flow F with wildcarded all fields.
+        (pkt,match) = Wildcard_All(self,of_ports)
+        
+        #Verify flow is active  
+        Verify_TableStats(self,active_entries=1)
+        
+        # Build a overlapping flow F' without check overlap bit set.
+        Wildcard_All_Except_Ingress(self,of_ports)
+
+        # Verify Flow gets inserted 
+        Verify_TableStats(self,active_entries=2)
+
+
+class Identical_Flows(basic.SimpleDataPlane):
+    
+    """Verify that adding two identical flows overwrites the existing one and clears counters"""
+
+    def runTest(self):
+        
+        cs_logger.info("Running Identical_Flows test ")
+
+        of_ports = cs_port_map.keys()
+        of_ports.sort()
+        self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+        #Clear switch state
+        rc = delete_all_flows(self.controller, cs_logger)
+        self.assertEqual(rc, 0, "Failed to delete all flows")
+
+        cs_logger.info("Inserting two identical flows one by one")
+        cs_logger.info("Expecting switch to overwrite the first flow and clear the counters associated with it ")
+        
+        # Create and add flow-1, check on dataplane it is active.
+        (pkt,match) = Wildcard_All(self,of_ports)
+
+        # Verify active_entries in table_stats_request =1 
+        Verify_TableStats(self,active_entries=1)
+        
+        # Send Packet (to increment counters like byte_count and packet_count)
+        SendPacket(self,pkt,of_ports[0],of_ports[1])
+
+        # Verify Flow counters have incremented
+        Verify_FlowStats(self,match,byte_count=len(str(pkt)),packet_count=1)
+        
+        #Send Identical flow 
+        (pkt1,match1) = Wildcard_All(self,of_ports)
+
+        # Verify active_entries in table_stats_request =1 
+        Verify_TableStats(self,active_entries=1)
+
+        # Verify Flow counters reset
+        Verify_FlowStats(self,match,byte_count=0,packet_count=0)
+
+   
+class Emer_Flow_With_Timeout(basic.SimpleProtocol): 
+
+    """Timeout values are not allowed for emergency flows"""
+
+    def runTest(self):
+
+        cs_logger.info("Running Emergency flow with timeout values test")
+        
+        of_ports = cs_port_map.keys()
+        of_ports.sort()
+        self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+        #Clear switch state
+        rc = delete_all_flows(self.controller, cs_logger)
+        self.assertEqual(rc, 0, "Failed to delete all flows")
+
+        cs_logger.info("Inserting an emergency flow with timeout values")
+        cs_logger.info("Expecting switch to generate error ")
+        
+        #Insert an emergency flow 
+        pkt = simple_tcp_packet()
+        match = parse.packet_to_flow_match(pkt)
+        match.in_port = of_ports[0]
+        
+        request = message.flow_mod()
+        request.match = match
+        request.command = ofp.OFPFC_ADD
+        request.flags = request.flags|ofp.OFPFF_EMERG
+        request.hard_timeout =9
+        request.idle_timeout =9
+        
+        act = action.action_output()
+        act.port = of_ports[1]
+        
+        request.actions.add(act)
+        cs_logger.info("Inserting flow")
+        rv = self.controller.message_send(request)
+        self.assertTrue(rv != -1, "Flow addition did not fail.")
+
+        self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
+
+        #Verify OFPET_FLOW_MOD_FAILED/OFPFMFC_OVERLAP error is recieved on the control plane
+        (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_ERROR,         
+                                               timeout=5)
+        self.assertTrue(response is not None, 
+                               'Switch did not reply with error message') 
+        self.assertTrue(response.type==ofp.OFPET_FLOW_MOD_FAILED, 
+                               'Error message type is not flow mod failed ') 
+        self.assertTrue(response.code==ofp.OFPFMFC_BAD_EMERG_TIMEOUT, 
+                               'Error Message code is not bad emergency timeout')
+
+
+class Missing_Modify_Add(basic.SimpleDataPlane):
+
+    """If a modify does not match an existing flow, the flow gets added """
+    
+    def runTest(self):
+        
+        cs_logger.info("Running Missing_Modify_Add test")
+
+        of_ports = cs_port_map.keys()
+        of_ports.sort()
+        self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+        cs_logger.info("Inserting a flow-modify that does not match an existing flow")
+        cs_logger.info("Expecting flow to get added i.e OFPFC_MODIFY command should be taken as OFPFC_ADD ")
+
+        #Clear Switch State
+        rc = delete_all_flows(self.controller, cs_logger)
+        self.assertEqual(rc, 0, "Failed to delete all flows")
+
+        #Generate a flow-mod,command OFPC_MODIFY 
+
+        request = message.flow_mod()
+        request.command = ofp.OFPFC_MODIFY
+        request.match.wildcards = ofp.OFPFW_ALL-ofp.OFPFW_IN_PORT
+        request.match.in_port = of_ports[0]
+        request.cookie = random.randint(0,9007199254740992)
+        request.buffer_id = 0xffffffff
+        act3 = action.action_output()
+        act3.port = of_ports[1]
+        self.assertTrue(request.actions.add(act3), "could not add action")
+
+        cs_logger.info("Inserting flow")
+        rv = self.controller.message_send(request)
+        self.assertTrue(rv != -1, "Error installing flow mod")
+        self.assertEqual(do_barrier(self.controller), 0, "Barrier failed") 
+
+        #Verify the flow gets added i.e. active_count= 1
+        Verify_TableStats(self,active_entries=1)
+
+
+class Modify_Action(basic.SimpleDataPlane):
+
+    """A modified flow preserves counters"""
+    
+    def runTest(self):
+        
+        cs_logger.info("Running Modify_Action test ")
+
+        of_ports = cs_port_map.keys()
+        of_ports.sort()
+        self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+        #Clear switch state
+        rc = delete_all_flows(self.controller, cs_logger)
+        self.assertEqual(rc, 0, "Failed to delete all flows")
+
+        cs_logger.info("Inserting a Flow and incrementing flow counters. Modifying the flow action")
+        cs_logger.info("Expecting the flow action to be modified , but the flow-counters should be preserved")
+           
+        #Create and add flow-1 Match on all, except one wildcarded (src adddress).Action A , output to of_port[1]
+        (pkt,match) = Match_All_Except_Source_Address(self,of_ports)
+
+        #Send Packet matching the flow thus incrementing counters like packet_count,byte_count
+        SendPacket(self,pkt,of_ports[0],of_ports[1])
+
+        #Verify flow counters
+        Verify_FlowStats(self,match,byte_count=len(str(pkt)),packet_count=1)
+
+        #Modify flow- 1 
+        Modify_Flow_Action(self,of_ports,match)
+        
+        # Send Packet matching the flow-1 i.e ingress_port=port[0] and verify it is recieved on corret dataplane port i.e port[2]
+        SendPacket(self,pkt,of_ports[0],of_ports[2])
+        
+        #Verify flow counters are preserved
+        Verify_FlowStats(self,match,byte_count=(2*len(str(pkt))),packet_count=2)
+
+
+class Strict_Modify_Action(basic.SimpleDataPlane):
+
+    """Strict Modify Flow also changes action preserves counters"""
+
+    def runTest(self):
+        
+        cs_logger.info("Running Strict_Modify_Action test")
+
+        of_ports = cs_port_map.keys()
+        of_ports.sort()
+        self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+        #Clear switch state
+        rc = delete_all_flows(self.controller, cs_logger)
+        self.assertEqual(rc, 0, "Failed to delete all flows")
+
+        cs_logger.info("Inserting Flows and incrementing flow counters. Strict Modify the flow action ")
+        cs_logger.info("Expecting the flow action to be modified , but the flow-counters should be preserved")
+        
+        #Create and add flow-1 Match on all, except one wildcarded (src adddress).Action A
+        (pkt,match) = Match_All_Except_Source_Address(self,of_ports,priority=100)
+        
+        #Create and add flow-2 , Match on ingress_port only, Action A
+        (pkt1,match1) = Wildcard_All_Except_Ingress(self,of_ports,priority=10)
+        
+        # Verify both the flows are active
+        Verify_TableStats(self,active_entries=2)
+
+        #Send a packet matching the flows, thus incrementing flow-counters (packet matches the flow F-1 with higher priority)
+        SendPacket(self,pkt,of_ports[0],of_ports[1])
+
+        # Verify flow counters of the flow-1
+        Verify_FlowStats(self,match,byte_count=len(str(pkt)),packet_count=1)
+
+        # Strict-Modify flow- 1 
+        Strict_Modify_Flow_Action(self,of_ports[2],match,priority=100)
+        
+        # Send Packet matching the flow-1 i.e ingress_port=port[0] and verify it is recieved on corret dataplane port i.e port[2]
+        SendPacket(self,pkt,of_ports[0],of_ports[2])
+        
+        # Verify flow counters are preserved
+        Verify_FlowStats(self,match,byte_count=(2*len(str(pkt))),packet_count=2)
+
+
+class Delete_NonExisting_Flow(basic.SimpleDataPlane):
+    
+    """Request deletion of non-existing flow"""
+    
+    def runTest(self):
+        
+        cs_logger.info("Delete_NonExisting_Flow test begins")
+
+        of_ports = cs_port_map.keys()
+        of_ports.sort()
+        self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+        #Clear switch state
+        rc = delete_all_flows(self.controller, cs_logger)
+        self.assertEqual(rc, 0, "Failed to delete all flows")
+
+        cs_logger.info("Deleting a non-existing flow")
+        cs_logger.info("Expecting switch to ignore the command , without generating errors")
+
+        # Issue a delete command 
+        msg = message.flow_mod()
+        msg.match.wildcards = ofp.OFPFW_ALL
+        msg.out_port = ofp.OFPP_NONE
+        msg.command = ofp.OFPFC_DELETE
+        msg.buffer_id = 0xffffffff
+
+        # Verify no message or error is generated by polling the the control plane
+        (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_ERROR,         
+                                               timeout=2)
+        self.assertTrue(response is None, 
+                        'Recieved Error for deleting non-exiting flow ')
+
+
+        
+class Send_Flow_Rem(basic.SimpleDataPlane):
+    
+    """Check deletion of flows happens and generates messages as configured.
+    If Send Flow removed message Flag is set in the flow entry, the flow deletion of that respective flow should generate the flow removed message, 
+    vice versa also exists """
+
+    def runTest(self):
+
+        cs_logger.info("Running Send Flow removed message test begins")
+
+        of_ports = cs_port_map.keys()
+        of_ports.sort()
+        self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+        #Clear swicth state
+        rc = delete_all_flows(self.controller, cs_logger)
+        self.assertEqual(rc, 0, "Failed to delete all flows")
+
+        cs_logger.info("Inserting flows F1 and F2 without and with send_flow_removed_message flag set ")
+        cs_logger.info("Deleting the flows")
+        cs_logger.info("Expecting flow removed message only for F2")
+
+        # Insert flow-1 with F without OFPFF_SEND_FLOW_REM flag set.
+        (pkt,match) = Wildcard_All_Except_Ingress(self,of_ports)
+
+        # Verify flow is inserted 
+        Verify_TableStats(self,active_entries=1)
+
+        #Delete the flow-1
+        NonStrict_Delete(self,match,priority=0)
+
+        # Verify no flow removed message is generated for the FLOW-1
+
+        (response1, pkt1) = self.controller.poll(exp_msg=ofp.OFPT_FLOW_REMOVED,
+                                               timeout=2)
+        self.assertTrue(response1 is None, 
+                        'Received flow removed message for the flow with flow_rem flag not set')
+        
+        # Insert another flow F' with OFPFF_SEND_FLOW_REM flag set.
+        msg9 = message.flow_mod()
+        msg9.match.wildcards = ofp.OFPFW_ALL
+        msg9.cookie = random.randint(0,9007199254740992)
+        msg9.buffer_id = 0xffffffff
+        msg9.idle_timeout = 1
+        msg9.flags |= ofp.OFPFF_SEND_FLOW_REM
+        rv1 = self.controller.message_send(msg9)
+        self.assertTrue(rv1 != -1, "Error installing flow mod")
+        self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
+
+        # Delete the flow-2
+        rc2 = delete_all_flows(self.controller, cs_logger)
+        self.assertEqual(rc2, 0, "Failed to delete all flows")
+
+        # Verify flow removed message is generated for the FLOW-2
+
+        (response2, pkt2) = self.controller.poll(exp_msg=ofp.OFPT_FLOW_REMOVED,
+                                               timeout=2)
+        self.assertTrue(response2 is not None, 
+                        'Did not receive flow removed message for this flow')
+
+
+class Delete_Emer_Flow(basic.SimpleProtocol):
+
+    """Delete emergency flow and verify no message is generated.An emergency flow deletion will not generate flow-removed messages even if 
+    Send Flow removed message flag was set during the emergency flow entry"""
+
+    def runTest(self):
+
+        cs_logger.info("Running Delete Emergency flow")
+
+        of_ports = cs_port_map.keys()
+        of_ports.sort()
+        
+        #Clear switch state        
+        rc = delete_all_flows(self.controller, cs_logger)
+        self.assertEqual(rc, 0, "Failed to delete all flows")
+
+        cs_logger.info("Inserting a emergency flow with send_flow_removed flag set")
+        cs_logger.info("Expecting no flow_removed_message on the deletion of the emergency flow")
+        
+        # Insert a flow with emergency bit set.
+        pkt = simple_tcp_packet()
+        match = parse.packet_to_flow_match(pkt)
+        match.in_port = of_ports[0]
+        request = message.flow_mod()
+        request.match = match
+        request.command = ofp.OFPFC_ADD
+        request.flags = request.flags|ofp.OFPFF_EMERG|ofp.OFPFF_SEND_FLOW_REM
+        act = action.action_output()
+        act.port = of_ports[1]
+        request.actions.add(act)
+
+        rv = self.controller.message_send(request)
+        self.assertTrue(rv != -1, "Flow addition failed.")
+        
+        # Delete the emergency flow
+        
+        NonStrict_Delete(self,match)
+        (response, pkt) = self.controller.poll(exp_msg=ofp.OFPFF_SEND_FLOW_REM ,
+                                               timeout=2)
+        self.assertTrue(response is None, 
+                        'Test Failed ')
+
+
+class Delete_Strict_NonStrict(basic.SimpleDataPlane):
+
+    """Delete and verify strict and non-strict behaviors
+    This test compares the behavior of delete strict and non-strict"""
+
+    def runTest(self):
+        
+        cs_logger.info("Delete_Strict_NonStrict test begins")
+        
+        of_ports = cs_port_map.keys()
+        of_ports.sort()
+        self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+        #Clear switch state
+        rc = delete_all_flows(self.controller, cs_logger)
+        self.assertEqual(rc, 0, "Failed to delete all flows")
+        
+        cs_logger.info("Inserting a flow with exact match")
+        cs_logger.info("Issue Strict Delete command , verify it gets deleted")     
+        
+        #Insert F with an exact Match 
+        (pkt,match) = Exact_Match(self,of_ports)  
+        Verify_TableStats(self,active_entries=1)
+
+        #Issue Strict Delete Command , verify F gets deleted.
+        Strict_Delete(self,match)
+        Verify_TableStats(self,active_entries=0)
+
+        cs_logger.info("Inserting two overlapping flows")
+        cs_logger.info("Issue Strict Delete command ")
+        cs_logger.info("Expecting only one flow gets deleted , because Strict Delete matches on wildcards as well")     
+        
+        #Insert Flow T with match on all , except one wildcarded ( say src adddress ). 
+        (pkt,match) = Match_All_Except_Source_Address(self,of_ports)
+
+        #Insert another flow T' with match on ingress_port , wildcarded rest.  
+        (pkt1,match1) = Wildcard_All_Except_Ingress(self,of_ports)
+        Verify_TableStats(self,active_entries=2)
+
+        #Issue Strict Delete matching on ingress_port. Verify only T' gets deleted
+        Strict_Delete(self,match1)
+        Verify_TableStats(self,active_entries=1) 
+
+        cs_logger.info("Inserting two overlapping flows")
+        cs_logger.info("Issue Non-Strict Delete command ")
+        cs_logger.info("Expecting both the flow gets deleted , because wildcards are active")    
+
+        #Insert T and T' again . 
+        (pkt,match) = Match_All_Except_Source_Address(self,of_ports)
+        (pkt1,match1) = Wildcard_All_Except_Ingress(self,of_ports)
+        Verify_TableStats(self,active_entries=2)
+
+        #Issue Non-strict Delete with match on ingress_port.Verify T+T' gets deleted . 
+        NonStrict_Delete(self,match1)
+        Verify_TableStats(self,active_entries=0)
+
+        cs_logger.info("Inserting three overlapping flows with different priorities")
+        cs_logger.info("Issue Non-Strict Delete command ")
+        cs_logger.info("Expecting all the flows to get deleted")  
+  
+        #Insert T , add Priority P (say 100 ) 
+        (pkt,match) = Match_All_Except_Source_Address(self,of_ports,priority=100)
+
+        #Insert T' add priority (200).
+        (pkt1,match1) = Wildcard_All_Except_Ingress(self,of_ports,priority=200)
+        
+        #Insert T' again add priority 300 --> T" . 
+        (pkt2,match2) = Wildcard_All_Except_Ingress(self,of_ports,priority=300)
+        Verify_TableStats(self,active_entries=3)
+
+        #Issue Non-Strict Delete and verify all getting deleted
+        NonStrict_Delete(self,match1,priority=200)
+        Verify_TableStats(self,active_entries=0)
+
+        cs_logger.info("Inserting three overlapping flows with different priorities")
+        cs_logger.info("Issue Strict Delete command ")
+        cs_logger.info("Expecting only one to get deleted because here priorities & wildcards are being matched")  
+
+        #Issue Strict-Delete and verify only T'' gets deleted. 
+        (pkt,match) = Match_All_Except_Source_Address(self,of_ports,priority=100)
+        (pkt1,match1) = Wildcard_All_Except_Ingress(self,of_ports,priority=200)
+        (pkt2,match2) = Wildcard_All_Except_Ingress(self,of_ports,priority=300)
+        Strict_Delete(self,match1,priority=200)
+        Verify_TableStats(self,active_entries=2)
+
+        
+   
+class Delete_With_Outport(basic.SimpleDataPlane):
+
+    """Delete flows filtered by action outport.If the out_port field in the delete command contains a value other than OFPP_NONE,
+    it introduces a constraint when matching. This constraint is that the rule must contain an output action directed at that port."""
+
+    def runTest(self):
+        
+        cs_logger.info("Delete_Filter_Outport test begins")
+
+        of_ports = cs_port_map.keys()
+        of_ports.sort()
+        self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+        #Clear switch state
+        rc = delete_all_flows(self.controller, cs_logger)
+        self.assertEqual(rc, 0, "Failed to delete all flows")
+
+        cs_logger.info("Inserting a flow with output action --> of_port[1]")
+        cs_logger.info("Deleting the flow but with out_port set to of_port[2]")
+        cs_logger.info("Expecting switch to filter the delete command")
+        
+        #Build and send Flow-1 with action output to of_port[1]
+        (pkt,match) = Wildcard_All_Except_Ingress(self,of_ports)
+
+        # Verify active_entries in table_stats_request = 1
+        Verify_TableStats(self,active_entries=1)
+
+        #Send delete command matching the flow-1 but with contraint out_port = of_port[2]
+        msg7 = message.flow_mod()
+        msg7.out_port = of_ports[2]
+        msg7.command = ofp.OFPFC_DELETE
+        msg7.buffer_id = 0xffffffff
+        msg7.match = match
+
+        rv = self.controller.message_send(msg7)
+        self.assertTrue(rv != -1, "Error installing flow mod")
+        self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
+
+        # Verify flow will not get deleted, active_entries in table_stats_request = 1
+        Verify_TableStats(self,active_entries=1)
+
+        cs_logger.info("Deleting the flow with out_port set to of_port[1]")
+        cs_logger.info("Expecting switch to delete the flow")
+
+        #Send Delete command with contraint out_port = of_ports[1]
+        msg7 = message.flow_mod()
+        msg7.out_port = of_ports[1]
+        msg7.command = ofp.OFPFC_DELETE
+        msg7.buffer_id = 0xffffffff
+        msg7.match = match
+
+        rv = self.controller.message_send(msg7)
+        self.assertTrue(rv != -1, "Error installing flow mod")
+        self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
+        
+        #Verify flow gets deleted.
+        Verify_TableStats(self,active_entries=0)
+
+
+class Idle_Timeout(basic.SimpleDataPlane):
+
+    """ Verify that idle timeout is implemented"""
+
+    def runTest(self):
+        
+        cs_logger.info("Running Idle_Timeout test ")
+
+        of_ports = cs_port_map.keys()
+        of_ports.sort()
+        self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+        
+        #Clear switch state
+        rc = delete_all_flows(self.controller, cs_logger)
+        self.assertEqual(rc, 0, "Failed to delete all flows")
+
+        cs_logger.info("Inserting flow entry with idle_timeout set. Also send_flow_removed_message flag set")
+        cs_logger.info("Expecting the flow entry to delete with given idle_timeout")
+
+        #Insert a flow entry with idle_timeout=1.Send_Flow_Rem flag set
+        msg9 = message.flow_mod()
+        msg9.match.wildcards = ofp.OFPFW_ALL
+        msg9.cookie = random.randint(0,9007199254740992)
+        msg9.buffer_id = 0xffffffff
+        msg9.idle_timeout = 1
+        msg9.flags |= ofp.OFPFF_SEND_FLOW_REM
+        rv1 = self.controller.message_send(msg9)
+        self.assertTrue(rv1 != -1, "Error installing flow mod")
+        self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
+
+        #Verify flow gets inserted
+        Verify_TableStats(self,active_entries=1)
+        
+        # Verify flow removed message is recieved.
+        (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_FLOW_REMOVED,
+                                               timeout=5)
+        self.assertTrue(response is not None, 
+                        'Did not receive flow removed message ')
+        self.assertEqual(ofp.OFPRR_IDLE_TIMEOUT, response.reason,
+                         'Flow table entry removal reason is not idle_timeout')
+        self.assertEqual(1, response.duration_sec,
+                         'Flow was not alive for 1 sec')
+
+
+class Add_Modify_With_Outport(basic.SimpleDataPlane):
+
+    """Add, modify flows with outport set. This field is ignored by ADD, MODIFY, and MODIFY STRICT messages."""
+
+    def runTest(self):
+        
+        cs_logger.info("Running Add_Modify_With_Outport ")
+
+        of_ports = cs_port_map.keys()
+        of_ports.sort()
+        self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+        #Clear switch state
+        rc = delete_all_flows(self.controller, cs_logger)
+        self.assertEqual(rc, 0, "Failed to delete all flows")
+
+        cs_logger.info("Adding and modifying flow with out_port fields set")
+        cs_logger.info("Expecting switch to ignore out_port")
+
+        # Create and add flow-1,Action A ,output to port of_port[1], out_port set to of_ports[2]
+        (pkt,match) = Wildcard_All_Except_Ingress(self,of_ports)
+
+        # Verify flow is active
+        Verify_TableStats(self,active_entries=1)
+        
+        # Send Packet matching the flow
+        SendPacket(self,pkt,of_ports[0],of_ports[1])
+        
+        # Insert Flow-Modify matching flow F-1 ,action A', output to port[2], out_port set to port[3]
+        Modify_Flow_Action(self,of_ports,match)
+
+        # Again verify active_entries in table_stats_request =1 
+        Verify_TableStats(self,active_entries=1)
+
+        #Verify action is modified
+        SendPacket(self,pkt,of_ports[0],of_ports[2])
+
+
+
+
+class Hard_Timeout(basic.SimpleDataPlane):
+
+    """ Verify that hard timeout is implemented """
+
+    def runTest(self):
+
+        cs_logger.info("Running Idle_Timeout test ")
+        
+        of_ports = cs_port_map.keys()
+        of_ports.sort()
+        self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+        #Clear switch state
+        rc = delete_all_flows(self.controller, cs_logger)
+        self.assertEqual(rc, 0, "Failed to delete all flows")
+
+        cs_logger.info("Inserting flow entry with hard_timeout set. Also send_flow_removed_message flag set")
+        cs_logger.info("Expecting the flow entry to delete with given hard_timeout")
+
+        # Insert a flow entry with hardtimeout=1 and send_flow_removed flag set
+        msg9 = message.flow_mod()
+        msg9.match.wildcards = ofp.OFPFW_ALL
+        msg9.cookie = random.randint(0,9007199254740992)
+        msg9.buffer_id = 0xffffffff
+        msg9.hard_timeout = 1
+        msg9.flags |= ofp.OFPFF_SEND_FLOW_REM
+        rv1 = self.controller.message_send(msg9)
+        self.assertTrue(rv1 != -1, "Error installing flow mod")
+        self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
+
+        #Verify flow gets inserted
+        Verify_TableStats(self,active_entries=1)
+
+        # Verify flow removed message is recieved.
+        (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_FLOW_REMOVED,
+                                               timeout=5)
+        self.assertTrue(response is not None, 
+                        'Did not receive flow removed message ')
+        self.assertEqual(ofp.OFPRR_HARD_TIMEOUT, response.reason,
+                         'Flow table entry removal reason is not hard_timeout')
+        self.assertEqual(1, response.duration_sec,
+                         'Flow was not alive for 1 sec')
+
+
+class Flow_Timeout(basic.SimpleDataPlane):
+  
+    """Verify that Flow removed messages are generated as expected
+    Flow removed messages being generated when flag is set, is already tested in the above tests 
+    So here, we test the vice-versa condition"""
+
+    
+    def runTest(self):
+
+        cs_logger.info("Running Flow_Timeout test ")
+        
+        of_ports = cs_port_map.keys()
+        of_ports.sort()
+        self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+        #Clear switch state
+        rc = delete_all_flows(self.controller, cs_logger)
+        self.assertEqual(rc, 0, "Failed to delete all flows")
+
+        cs_logger.info("Inserting flow entry with hard_timeout set and send_flow_removed_message flag not set")
+        cs_logger.info("Expecting the flow entry to delete, but no flow removed message")
+
+        # Insert a flow with hard_timeout = 1 but no Send_Flow_Rem flag set
+        pkt = simple_tcp_packet()
+        match3 = parse.packet_to_flow_match(pkt)
+        self.assertTrue(match3 is not None, "Could not generate flow match from pkt")
+        match3.wildcards = ofp.OFPFW_ALL-ofp.OFPFW_IN_PORT
+        match3.in_port = of_ports[0]
+        msg3 = message.flow_mod()
+        msg3.out_port = of_ports[2] # ignored by flow add,flow modify 
+        msg3.command = ofp.OFPFC_ADD
+        msg3.cookie = random.randint(0,9007199254740992)
+        msg3.buffer_id = 0xffffffff
+        msg3.hard_timeout = 1
+        msg3.buffer_id = 0xffffffff
+        msg3.match = match3
+        act3 = action.action_output()
+        act3.port = of_ports[1]
+        self.assertTrue(msg3.actions.add(act3), "could not add action")
+
+        rv = self.controller.message_send(msg3)
+        self.assertTrue(rv != -1, "Error installing flow mod")
+        self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
+
+        #Verify no flow removed message is generated
+        (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_FLOW_REMOVED,
+                                               timeout=3)
+        self.assertTrue(response is None, 
+                        'Recieved flow removed message ')
+
+        # Verify no entries in the table
+        Verify_TableStats(self,active_entries=0)
+
+
+
+        
+
+
+
+
+       
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/FuncUtils.py b/tests/FuncUtils.py
index 96fc6cf..d14ee71 100644
--- a/tests/FuncUtils.py
+++ b/tests/FuncUtils.py
@@ -14,6 +14,7 @@
 import types
 import basic
 from testutils import *
+from time import sleep
 
 #################### Functions for various types of flow_mod  ##########################################################################################
 
@@ -82,13 +83,15 @@
         match2 = parse.packet_to_flow_match(Pkt_Wildcard)
         self.assertTrue(match2 is not None, "Could not generate flow match from pkt")
         match2.wildcards=ofp.OFPFW_ALL
+        match2.in_port = of_ports[0]
+
         msg2 = message.flow_mod()
         msg2.out_port = ofp.OFPP_NONE
         msg2.command = ofp.OFPFC_ADD
         msg2.buffer_id = 0xffffffff
         msg2.match = match2
         act2 = action.action_output()
-        act2.port = of_ports[2]
+        act2.port = of_ports[1]
         self.assertTrue(msg2.actions.add(act2), "could not add action")
         if priority != 0 :
                 msg2.priority = priority
@@ -181,7 +184,7 @@
 
 ###########################   Verify Stats Functions   ###########################################################################################
 
-def Verify_TableStats(self,active_entries=0):
+def Verify_TableStats(self,active_entries=0,):
 #Verify Table_Stats
         
         #Send Table_Stats_Request        
@@ -196,27 +199,31 @@
         self.assertTrue(active_entries == active_count,"Incorrect no. of flows in Table")
 
 
-def Verify_FlowStats(self,match,stats_byte_count=0,stats_packet_count=0):
-# Verify Flow_Stats
+def Verify_FlowStats(self,match,byte_count=0,packet_count=0):
+# Verify flow counters : byte_count and packet_count
 
-        # Send Flow_Stats_Request       
-        request = message.flow_stats_request()
-        request.out_port = ofp.OFPP_NONE
-        request.table_id = 0xff
-        request.match = match
-        response, pkt = self.controller.transact(request, timeout=1)
-        self.assertTrue(response is not None, "Did not get response")
-        byte_count = 0 
-        packet_count = 0
+        stat_req = message.flow_stats_request()
+        stat_req.match = match
+        stat_req.table_id = 0xff
+        stat_req.out_port = ofp.OFPP_NONE
+        test_timeout = 10
+        all_packets_received = 0
+        for i in range(0,test_timeout):
+            
+            response, pkt = self.controller.transact(stat_req,
+                                                     timeout=test_timeout)
+            self.assertTrue(response is not None, 
+                            "No response to stats request")
+            for obj in response.stats:
+                if ( obj.packet_count == packet_count and obj.byte_count == byte_count ) :
+                    all_packets_received = 1
 
-        #Verify byte_count and packet_count in the reply
-        for stat in response.stats:
-            byte_count += stat.byte_count
-            packet_count += stat.packet_count
-            self.assertEqual(stats_byte_count,byte_count,
-                        "Byte counter is incorrect")
-            self.assertEqual(stats_packet_count,packet_count,
-                        "Packet counter is incorrect")
+            if all_packets_received:
+                break
+            sleep(1)
+
+        self.assertTrue(all_packets_received,
+                        "Flow counters are incorrect")
 
 
 ############################## Various delete commands #############################################################################################
