Organizing branch
diff --git a/ofdpa/all.py b/ofdpa/all.py
deleted file mode 100644
index c8b00b1..0000000
--- a/ofdpa/all.py
+++ /dev/null
@@ -1,598 +0,0 @@
-# Distributed under the OpenFlow Software License (see LICENSE)
-# Copyright (c) 2010 The Board of Trustees of The Leland Stanford Junior University
-# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
-# Copyright (c) 2012, 2013 CPqD
-# Copyright (c) 2012, 2013 Ericsson
-"""
-Basic test cases
-
-Test cases in other modules depend on this functionality.
-"""
-
-import logging
-
-from oftest import config
-import oftest.base_tests as base_tests
-import ofp
-import ofdpa_utils
-
-from oftest.testutils import *
-
-@group('smoke')
-class Echo(base_tests.SimpleProtocol):
-    """
-    Test echo response with no data
-    """
-    def runTest(self):
-        request = ofp.message.echo_request()
-        response, pkt = self.controller.transact(request)
-        self.assertTrue(response is not None,
-                        "Did not get echo reply")
-        self.assertEqual(response.type, ofp.OFPT_ECHO_REPLY,
-                         'response is not echo_reply')
-        self.assertEqual(request.xid, response.xid,
-                         'response xid != request xid')
-        self.assertEqual(len(response.data), 0, 'response data non-empty')
-
-class EchoWithData(base_tests.SimpleProtocol):
-    """
-    Test echo response with short string data
-    """
-    def runTest(self):
-        data = 'OpenFlow Will Rule The World'
-        request = ofp.message.echo_request(data=data)
-        response, _ = self.controller.transact(request)
-        self.assertTrue(response is not None,
-                        "Did not get echo reply")
-        self.assertEqual(response.type, ofp.OFPT_ECHO_REPLY,
-                         'response is not echo_reply')
-        self.assertEqual(request.xid, response.xid,
-                         'response xid != request xid')
-        self.assertEqual(request.data, response.data,
-                         'response data != request data')
-
-class FeaturesRequest(base_tests.SimpleProtocol):
-    """
-    Test features_request to make sure we get a response
-
-    Does NOT test the contents; just that we get a response
-    """
-    def runTest(self):
-        request = ofp.message.features_request()
-        response,_ = self.controller.transact(request)
-        self.assertTrue(response is not None,
-                        'Did not get features reply')
-
-class DefaultDrop(base_tests.SimpleDataPlane):
-    """
-    Check that an empty flowtable results in drops
-    """
-    def runTest(self):
-        in_port, = openflow_ports(1)
-        delete_all_flows(self.controller)
-
-        pkt = str(simple_tcp_packet())
-        self.dataplane.send(in_port, pkt)
-        verify_no_packet_in(self, pkt, None)
-        verify_packets(self, pkt, [])
-
-class OutputExact(base_tests.SimpleDataPlane):
-    """
-    Test output function for an exact-match flow
-
-    For each port A, adds a flow directing matching packets to that port.
-    Then, for all other ports B != A, verifies that sending a matching packet
-    to B results in an output to A.
-    """
-    def runTest(self):
-        ports = sorted(config["port_map"].keys())
-
-        delete_all_flows(self.controller)
-
-        parsed_pkt = simple_tcp_packet()
-        pkt = str(parsed_pkt)
-        match = packet_to_flow_match(self, parsed_pkt)
-
-        for out_port in ports:
-            request = ofp.message.flow_add(
-                    table_id=test_param_get("table", 0),
-                    cookie=42,
-                    match=match,
-                    instructions=[
-                        ofp.instruction.apply_actions(
-                            actions=[
-                                ofp.action.output(
-                                    port=out_port,
-                                    max_len=ofp.OFPCML_NO_BUFFER)])],
-                    buffer_id=ofp.OFP_NO_BUFFER,
-                    priority=1000)
-
-            logging.info("Inserting flow sending matching packets to port %d", out_port)
-            self.controller.message_send(request)
-            do_barrier(self.controller)
-
-            for in_port in ports:
-                if in_port == out_port:
-                    continue
-                logging.info("OutputExact test, ports %d to %d", in_port, out_port)
-                self.dataplane.send(in_port, pkt)
-                verify_packets(self, pkt, [out_port])
-
-class OutputWildcard(base_tests.SimpleDataPlane):
-    """
-    Test output function for a match-all (but not table-miss) flow
-
-    For each port A, adds a flow directing all packets to that port.
-    Then, for all other ports B != A, verifies that sending a packet
-    to B results in an output to A.
-    """
-    def runTest(self):
-        ports = sorted(config["port_map"].keys())
-
-        delete_all_flows(self.controller)
-
-        pkt = str(simple_tcp_packet())
-
-        for out_port in ports:
-            request = ofp.message.flow_add(
-                    table_id=test_param_get("table", 0),
-                    cookie=42,
-                    instructions=[
-                        ofp.instruction.apply_actions(
-                            actions=[
-                                ofp.action.output(
-                                    port=out_port,
-                                    max_len=ofp.OFPCML_NO_BUFFER)])],
-                    buffer_id=ofp.OFP_NO_BUFFER,
-                    priority=1000)
-
-            logging.info("Inserting flow sending all packets to port %d", out_port)
-            self.controller.message_send(request)
-            do_barrier(self.controller)
-
-            for in_port in ports:
-                if in_port == out_port:
-                    continue
-                logging.info("OutputWildcard test, ports %d to %d", in_port, out_port)
-                self.dataplane.send(in_port, pkt)
-                verify_packets(self, pkt, [out_port])
-
-class PacketInExact(base_tests.SimpleDataPlane):
-    """
-    Test packet in function for an exact-match flow
-
-    Send a packet to each dataplane port and verify that a packet
-    in message is received from the controller for each
-    """
-    def runTest(self):
-        delete_all_flows(self.controller)
-
-        # required for OF-DPA to not drop packets
-        ofdpa_utils.installDefaultVlan(self.controller)
-
-        parsed_pkt = simple_tcp_packet()
-        pkt = str(parsed_pkt)
-
-        #  NOTE: interally the switch adds a VLAN so the match needs to be with an explicit VLAN
-        parsed_vlan_pkt = simple_tcp_packet(dl_vlan_enable=True, 
-                            vlan_vid=ofdpa_utils.DEFAULT_VLAN, 
-                            vlan_pcp=0,
-                            pktlen=104) # 4 less than we started with, because the way simple_tcp calc's length
-        match = packet_to_flow_match(self, parsed_vlan_pkt)
-        vlan_pkt = str(parsed_vlan_pkt)
-
-        request = ofp.message.flow_add(
-            table_id=ofdpa_utils.ACL_TABLE.table_id,
-            cookie=42,
-            match=match,
-            instructions=[
-                ofp.instruction.apply_actions(
-                    actions=[
-                        ofp.action.output(
-                            port=ofp.OFPP_CONTROLLER,
-                            max_len=ofp.OFPCML_NO_BUFFER)])],
-            buffer_id=ofp.OFP_NO_BUFFER,
-            priority=1000)
-
-        logging.info("Inserting flow sending matching packets to controller")
-        self.controller.message_send(request)
-        do_barrier(self.controller)
-
-        for of_port in config["port_map"].keys():
-            logging.info("PacketInExact test, port %d", of_port)
-            self.dataplane.send(of_port, pkt)
-            verify_packet_in(self, vlan_pkt, of_port, ofp.OFPR_ACTION)
-            verify_packets(self, pkt, [])
-
-class PacketInWildcard(base_tests.SimpleDataPlane):
-        #  NOTE: interally the switch adds a VLAN so the match needs to be with an explicit VLAN
-    """
-    Test packet in function for a match-all flow
-
-    Send a packet to each dataplane port and verify that a packet
-    in message is received from the controller for each
-    """
-    def runTest(self):
-        delete_all_flows(self.controller)
-
-        # required for OF-DPA to not drop packets
-        ofdpa_utils.installDefaultVlan(self.controller)
-
-        pkt = str(simple_tcp_packet())
-
-        #  NOTE: interally the switch adds a VLAN so the match needs to be with an explicit VLAN
-        parsed_vlan_pkt = simple_tcp_packet(dl_vlan_enable=True, 
-                            vlan_vid=ofdpa_utils.DEFAULT_VLAN, 
-                            vlan_pcp=0,
-                            pktlen=104) # 4 less than we started with, because the way simple_tcp calc's length
-        vlan_pkt = str(parsed_vlan_pkt)
-
-
-        request = ofp.message.flow_add(
-            table_id=ofdpa_utils.ACL_TABLE.table_id,
-            cookie=42,
-            instructions=[
-                ofp.instruction.apply_actions(
-                    actions=[
-                        ofp.action.output(
-                            port=ofp.OFPP_CONTROLLER,
-                            max_len=ofp.OFPCML_NO_BUFFER)])],
-            buffer_id=ofp.OFP_NO_BUFFER,
-            priority=1000)
-
-        logging.info("Inserting flow sending all packets to controller")
-        self.controller.message_send(request)
-        do_barrier(self.controller)
-
-        for of_port in config["port_map"].keys():
-            logging.info("PacketInWildcard test, port %d", of_port)
-            self.dataplane.send(of_port, pkt)
-            verify_packet_in(self, vlan_pkt, of_port, ofp.OFPR_ACTION)
-            verify_packets(self, pkt, [])
-
-class PacketInMiss(base_tests.SimpleDataPlane):
-    """
-    Test packet in function for a table-miss flow
-
-    Send a packet to each dataplane port and verify that a packet
-    in message is received from the controller for each
-    """
-    def runTest(self):
-        delete_all_flows(self.controller)
-
-        # required for OF-DPA to not drop packets
-        ofdpa_utils.installDefaultVlan(self.controller)
-
-        parsed_pkt = simple_tcp_packet()
-        pkt = str(parsed_pkt)
-
-        #  NOTE: interally the switch adds a VLAN so the match needs to be with an explicit VLAN
-        parsed_vlan_pkt = simple_tcp_packet(dl_vlan_enable=True, 
-                            vlan_vid=ofdpa_utils.DEFAULT_VLAN, 
-                            vlan_pcp=0,
-                            pktlen=104) # 4 less than we started with, because the way simple_tcp calc's length
-        vlan_pkt = str(parsed_vlan_pkt)
-
-        request = ofp.message.flow_add(
-            table_id=ofdpa_utils.ACL_TABLE.table_id,
-            cookie=42,
-            instructions=[
-                ofp.instruction.apply_actions(
-                    actions=[
-                        ofp.action.output(
-                            port=ofp.OFPP_CONTROLLER,
-                            max_len=ofp.OFPCML_NO_BUFFER)])],
-            buffer_id=ofp.OFP_NO_BUFFER,
-            priority=0)
-
-        logging.info("Inserting table-miss flow sending all packets to controller")
-        self.controller.message_send(request)
-        do_barrier(self.controller)
-
-        for of_port in config["port_map"].keys():
-            logging.info("PacketInMiss test, port %d", of_port)
-            self.dataplane.send(of_port, pkt)
-            verify_packet_in(self, vlan_pkt, of_port, ofp.OFPR_NO_MATCH)
-            verify_packets(self, pkt, [])
-
-class PacketOut(base_tests.SimpleDataPlane):
-    """
-    Test packet out function
-
-    Send packet out message to controller for each dataplane port and
-    verify the packet appears on the appropriate dataplane port
-    """
-    def runTest(self):
-        pkt = str(simple_tcp_packet())
-
-        for of_port in config["port_map"].keys():
-            msg = ofp.message.packet_out(
-                in_port=ofp.OFPP_CONTROLLER,
-                actions=[ofp.action.output(port=of_port)],
-                buffer_id=ofp.OFP_NO_BUFFER,
-                data=pkt)
-
-            logging.info("PacketOut test, port %d", of_port)
-            self.controller.message_send(msg)
-            verify_packets(self, pkt, [of_port])
-
-class FlowRemoveAll(base_tests.SimpleProtocol):
-    """
-    Remove all flows; required for almost all tests
-
-    Add a bunch of flows, remove them, and then make sure there are no flows left
-    This is an intentionally naive test to see if the baseline functionality works
-    and should be a precondition to any more complicated deletion test (e.g.,
-    delete_strict vs. delete)
-    """
-    def runTest(self):
-        for i in range(1,5):
-            logging.debug("Adding flow %d", i)
-            request = ofp.message.flow_add(
-                buffer_id=ofp.OFP_NO_BUFFER,
-                priority=i*1000)
-            self.controller.message_send(request)
-        do_barrier(self.controller)
-
-        delete_all_flows(self.controller)
-
-        logging.info("Sending flow stats request")
-        stats = get_flow_stats(self, ofp.match())
-        self.assertEqual(len(stats), 0, "Expected empty flow stats reply")
-
-
-## Multipart messages
-
-class DescStats(base_tests.SimpleProtocol):
-    """
-    Switch description multipart transaction
-
-    Only verifies we get a single reply.
-    """
-    def runTest(self):
-        request = ofp.message.desc_stats_request()
-        logging.info("Sending desc stats request")
-        response, _ = self.controller.transact(request)
-        self.assertTrue(response != None, "No response to desc stats request")
-        logging.info(response.show())
-        self.assertEquals(response.flags, 0, "Unexpected bit set in desc stats reply flags")
-
-class FlowStats(base_tests.SimpleProtocol):
-    """
-    Flow stats multipart transaction
-
-    Only verifies we get a reply.
-    """
-    def runTest(self):
-        logging.info("Sending flow stats request")
-        stats = get_flow_stats(self, ofp.match())
-        logging.info("Received %d flow stats entries", len(stats))
-        for entry in stats:
-            logging.info(entry.show())
-
-class AggregateStats(base_tests.SimpleProtocol):
-    """
-    Aggregate flow stats multipart transaction
-
-    Only verifies we get a single reply.
-    """
-    def runTest(self):
-        request = ofp.message.aggregate_stats_request(
-            table_id=ofp.OFPTT_ALL,
-            out_port=ofp.OFPP_ANY,
-            out_group=ofp.OFPG_ANY,
-            cookie=0,
-            cookie_mask=0)
-        logging.info("Sending aggregate flow stats request")
-        response, _ = self.controller.transact(request)
-        self.assertTrue(response != None, "No response to aggregate stats request")
-        logging.info(response.show())
-        self.assertEquals(response.flags, 0, "Unexpected bit set in aggregate stats reply flags")
-
-class TableStats(base_tests.SimpleProtocol):
-    """
-    Table stats multipart transaction
-
-    Only verifies we get a reply.
-    """
-    def runTest(self):
-        logging.info("Sending table stats request")
-        stats = get_stats(self, ofp.message.table_stats_request())
-        logging.info("Received %d table stats entries", len(stats))
-        for entry in stats:
-            logging.info(entry.show())
-
-class PortStats(base_tests.SimpleProtocol):
-    """
-    Port stats multipart transaction
-
-    Only verifies we get a reply.
-    """
-    def runTest(self):
-        request = ofp.message.port_stats_request(port_no=ofp.OFPP_ANY)
-        logging.info("Sending port stats request")
-        stats = get_stats(self, request)
-        logging.info("Received %d port stats entries", len(stats))
-        for entry in stats:
-            logging.info(entry.show())
-
-class QueueStats(base_tests.SimpleProtocol):
-    """
-    Queue stats multipart transaction
-
-    Only verifies we get a reply.
-    """
-    def runTest(self):
-        request = ofp.message.queue_stats_request(port_no=ofp.OFPP_ANY,
-                                                  queue_id=ofp.OFPQ_ALL)
-        logging.info("Sending queue stats request")
-        stats = get_stats(self, request)
-        logging.info("Received %d queue stats entries", len(stats))
-        for entry in stats:
-            logging.info(entry.show())
-
-class GroupStats(base_tests.SimpleProtocol):
-    """
-    Group stats multipart transaction
-
-    Only verifies we get a reply.
-    """
-    def runTest(self):
-        request = ofp.message.group_stats_request(group_id=ofp.OFPG_ALL)
-        logging.info("Sending group stats request")
-        stats = get_stats(self, request)
-        logging.info("Received %d group stats entries", len(stats))
-        for entry in stats:
-            logging.info(entry.show())
-
-class GroupDescStats(base_tests.SimpleProtocol):
-    """
-    Group description multipart transaction
-
-    Only verifies we get a reply.
-    """
-    def runTest(self):
-        request = ofp.message.group_desc_stats_request()
-        logging.info("Sending group desc stats request")
-        stats = get_stats(self, request)
-        logging.info("Received %d group desc stats entries", len(stats))
-        for entry in stats:
-            logging.info(entry.show())
-
-class GroupFeaturesStats(base_tests.SimpleProtocol):
-    """
-    Group features multipart transaction
-
-    Only verifies we get a single reply.
-    """
-    def runTest(self):
-        request = ofp.message.group_features_stats_request()
-        logging.info("Sending group features stats request")
-        response, _ = self.controller.transact(request)
-        self.assertTrue(response != None, "No response to group features stats request")
-        logging.info(response.show())
-        self.assertEquals(response.flags, 0, "Unexpected bit set in group features stats reply flags")
-
-class MeterStats(base_tests.SimpleProtocol):
-    """
-    Meter stats multipart transaction
-
-    Only verifies we get a reply.
-    """
-    def runTest(self):
-        request = ofp.message.meter_stats_request(meter_id=ofp.OFPM_ALL)
-        logging.info("Sending meter stats request")
-        stats = get_stats(self, request)
-        logging.info("Received %d meter stats entries", len(stats))
-        for entry in stats:
-            logging.info(entry.show())
-
-class MeterConfigStats(base_tests.SimpleProtocol):
-    """
-    Meter config multipart transaction
-
-    Only verifies we get a reply.
-    """
-    def runTest(self):
-        request = ofp.message.meter_config_stats_request(meter_id=ofp.OFPM_ALL)
-        logging.info("Sending meter config stats request")
-        stats = get_stats(self, request)
-        logging.info("Received %d meter config stats entries", len(stats))
-        for entry in stats:
-            logging.info(entry.show())
-
-class MeterFeaturesStats(base_tests.SimpleProtocol):
-    """
-    Meter features multipart transaction
-
-    Only verifies we get a single reply.
-    """
-    def runTest(self):
-        request = ofp.message.meter_features_stats_request()
-        logging.info("Sending meter features stats request")
-        response, _ = self.controller.transact(request)
-        self.assertTrue(response != None, "No response to meter features stats request")
-        logging.info(response.show())
-        self.assertEquals(response.flags, 0, "Unexpected bit set in meter features stats reply flags")
-
-@disabled # pyloxi does not yet support table features
-class TableFeaturesStats(base_tests.SimpleProtocol):
-    """
-    Table features multipart transaction
-
-    Only verifies we get a reply.
-    """
-    def runTest(self):
-        logging.info("Sending table features stats request")
-        stats = get_stats(self, ofp.message.table_features_stats_request())
-        logging.info("Received %d table features stats entries", len(stats))
-        for entry in stats:
-            logging.info(entry.show())
-
-class PortDescStats(base_tests.SimpleProtocol):
-    """
-    Port description multipart transaction
-
-    Only verifies we get a reply.
-    """
-    def runTest(self):
-        logging.info("Sending port desc stats request")
-        stats = get_stats(self, ofp.message.port_desc_stats_request())
-        logging.info("Received %d port desc stats entries", len(stats))
-        for entry in stats:
-            logging.info(entry.show())
-
-class PortConfigMod(base_tests.SimpleProtocol):
-    """
-    Modify a bit in port config and verify changed
-
-    Get the switch configuration, modify the port configuration
-    and write it back; get the config again and verify changed.
-    Then set it back to the way it was.
-    """
-
-    def runTest(self):
-        logging.info("Running " + str(self))
-        for of_port, _ in config["port_map"].items(): # Grab first port
-            break
-
-        (_, config1, _) = \
-            port_config_get(self.controller, of_port)
-        self.assertTrue(config is not None, "Did not get port config")
-
-        logging.debug("OFPPC_NO_PACKET_IN bit port " + str(of_port) + " is now " +
-                      str(config1 & ofp.OFPPC_NO_PACKET_IN))
-
-        rv = port_config_set(self.controller, of_port,
-                             config1 ^ ofp.OFPPC_NO_PACKET_IN,
-                             ofp.OFPPC_NO_PACKET_IN)
-        self.assertTrue(rv != -1, "Error sending port mod")
-
-        # Verify change took place with same feature request
-        (_, config2, _) = port_config_get(self.controller, of_port)
-        self.assertTrue(config2 is not None, "Did not get port config2")
-        logging.debug("OFPPC_NO_PACKET_IN bit port " + str(of_port) + " is now " +
-                      str(config2 & ofp.OFPPC_NO_PACKET_IN))
-        self.assertTrue(config2 & ofp.OFPPC_NO_PACKET_IN !=
-                        config1 & ofp.OFPPC_NO_PACKET_IN,
-                        "Bit change did not take")
-        # Set it back
-        rv = port_config_set(self.controller, of_port, config1,
-                             ofp.OFPPC_NO_PACKET_IN)
-        self.assertTrue(rv != -1, "Error sending port mod")
-
-class AsyncConfigGet(base_tests.SimpleProtocol):
-    """
-    Verify initial async config
-
-    Other tests rely on connections starting with these values.
-    """
-
-    def runTest(self):
-        logging.info("Sending get async config request")
-        response, _ = self.controller.transact(ofp.message.async_get_request())
-        self.assertTrue(response != None, "No response to get async config request")
-        logging.info(response.show())
-        self.assertEquals(response.packet_in_mask_equal_master & 0x07, 0x07)
-        self.assertEquals(response.port_status_mask_equal_master & 0x07, 0x07)
-        self.assertEquals(response.flow_removed_mask_equal_master & 0x0f, 0x0f)
diff --git a/ofdpa/flows.py b/ofdpa/flows.py
index 2c0f4e2..31dfd04 100755
--- a/ofdpa/flows.py
+++ b/ofdpa/flows.py
@@ -732,7 +732,7 @@
 
 
 
-class MplsTermination(base_tests.SimpleDataPlane):
+class _MplsTermination(base_tests.SimpleDataPlane):
     """
         Insert IP packet
         Receive MPLS packet
diff --git a/ofdpa/manual.py b/ofdpa/manual.py
deleted file mode 100644
index e3f0108..0000000
--- a/ofdpa/manual.py
+++ /dev/null
@@ -1,246 +0,0 @@
-
-from oftest import config
-import logging
-import oftest.base_tests as base_tests
-import ofp
-from oftest.testutils import *
-from accton_util import *
-
-class McastLeaf1(base_tests.SimpleDataPlane):
-    def runTest(self):
-        """
-        port1 (vlan 300)-> All Ports (vlan 300)
-        """
-        if len(config["port_map"]) <2:
-            logging.info("Port count less than 2, can't run this case")
-            return
-
-        vlan_id =300
-        intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
-        intf_src_mac_str=':'.join(['%02X' % x for x in intf_src_mac])
-        dst_mac=[0x01, 0x00, 0x5e, 0x01, 0x01, 0x01]
-        dst_mac_str=':'.join(['%02X' % x for x in dst_mac])
-        port1_mac=[0x00, 0x11, 0x11, 0x11, 0x11, 0x11]
-        port1_mac_str=':'.join(['%02X' % x for x in port1_mac])
-        src_ip=0xc0a80101
-        src_ip_str="192.168.1.1"
-        dst_ip=0xe0010101
-        dst_ip_str="224.1.1.1"
-
-        port1=32
-        port2=33
-
-        switch_mac = [0x01, 0x00, 0x5e, 0x00, 0x00, 0x00]
-
-        portlist=[32, 33, 34, 36]
-
-        #add l2 interface group
-        l2_intf_group_list=[]
-        for port in portlist:
-            add_one_vlan_table_flow(self.controller, port, vlan_id, flag=4)
-            #if port == port2:
-            #    continue
-            l2_intf_gid, msg=add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
-            l2_intf_group_list.append(l2_intf_gid)
-
-        #add termination flow
-        add_termination_flow(self.controller, port1, 0x0800, switch_mac, vlan_id)
-
-        #add l3 interface group
-        mcat_group_msg=add_l3_mcast_group(self.controller, vlan_id,  2, l2_intf_group_list)
-        add_mcast4_routing_flow(self.controller, vlan_id, src_ip, 0, dst_ip, mcat_group_msg.group_id)
-        parsed_pkt = simple_udp_packet(pktlen=100,
-                                       dl_vlan_enable=True,
-                                       vlan_vid=vlan_id,
-                                       eth_dst=dst_mac_str,
-                                       eth_src=port1_mac_str,
-                                       ip_ttl=64,
-                                       ip_src=src_ip_str,
-                                       ip_dst=dst_ip_str)
-        pkt=str(parsed_pkt)
-        self.dataplane.send(port1, pkt)
-        for port in config["port_map"].keys():
-            if port == port1:
-                 verify_no_packet(self, pkt, port)
-                 continue
-            verify_packet(self, pkt, port)
-        verify_no_other_packets(self)
-        
-
-class Leaf1(base_tests.SimpleDataPlane):
-
-    def runTest(self):
-     #Add flows correspondent to Leaf1
-     switch_mac=[0x00, 0x00, 0x00, 0x01, 0xea, 0xf1]
-     dst_mac= [0x00, 0x00, 0x00, 0x12, 0x34, 0x01]
-     id=0x1eaf
-     #Add L3Unicast to Host
-     port, vlan_id = 33, 4093
-     ##add L2 Interface Group
-     add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
-     ##add L3 Unicast Group
-     l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=id, src_mac=switch_mac, 
-                                dst_mac=dst_mac)
-     add_one_vlan_table_flow(self.controller, of_port=port, vlan_id=vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
-     ##add Termination Flow
-     add_termination_flow(self.controller, port, 0x0800, switch_mac, vlan_id)
-     ##add unicast routing flow
-     dst_ip=0x0a000001
-     mask=0xffffff00
-     add_unicast_routing_flow(self.controller, 0x0800, dst_ip, mask, l3_msg.group_id)
-
-     port = 32
-     l2_gid, l2_msg = add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
-     add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
-     add_termination_flow(self.controller, port, 0x0800, switch_mac, vlan_id)
-
-     #Add L3VPN initiation
-     dst_mac = [0x00, 0x00, 0x00, 0x55, 0x55, 0x55]
-     #add MPLS interface group
-     mpls_gid, mpls_msg = add_mpls_intf_group(self.controller, l2_gid, dst_mac, switch_mac, vlan_id, port)
-     ##add L3VPN interface
-     mpls_label_gid, mpls_label_msg = add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_L3_VPN_LABEL,
-	 index=id, ref_gid= mpls_gid, push_mpls_header=True, set_mpls_label=20, set_bos=1, cpy_ttl_outward=True)
-     ecmp_msg=add_l3_ecmp_group(self.controller, port, [mpls_label_gid])
-     ##add unicast routing flow
-     dst_ip=0x14000001
-     add_unicast_routing_flow(self.controller, 0x0800, dst_ip, mask, ecmp_msg.group_id)
-   
-     do_barrier(self.controller)
-
-class Leaf2(base_tests.SimpleDataPlane):
-
-    def runTest(self):
-     #Add flows correspondent to Leaf1
-     switch_mac=[0x00, 0x00, 0x00, 0x01, 0xea, 0xf2]
-     dst_mac= [0x00, 0x00, 0x00, 0x12, 0x34, 0x02]
-     id=0x2eaf
-     #Add L3Unicast to Host
-     port, vlan_id = 33, 4093
-     ##add L2 Interface Group
-     add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
-     ##add L3 Unicast Group
-     l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=id, src_mac=switch_mac,
-                                dst_mac=dst_mac)
-     add_one_vlan_table_flow(self.controller, of_port=port, vlan_id=vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
-     ##add Termination Flow
-     add_termination_flow(self.controller, port, 0x0800, switch_mac, vlan_id)
-     ##add unicast routing flow
-     dst_ip=0x14000001
-     mask=0xffffff00
-     add_unicast_routing_flow(self.controller, 0x0800, dst_ip, mask, l3_msg.group_id)
-
-     port = 32
-     l2_gid, l2_msg = add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
-     add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
-     add_termination_flow(self.controller, port, 0x0800, switch_mac, vlan_id)
-
-     #Add L3VPN initiation
-     dst_mac = [0x00, 0x00, 0x00, 0x55, 0x55, 0x55]
-     #add MPLS interface group
-     mpls_gid, mpls_msg = add_mpls_intf_group(self.controller, l2_gid, dst_mac, switch_mac, vlan_id, port)
-     ##add L3VPN interface
-     mpls_label_gid, mpls_label_msg = add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_L3_VPN_LABEL,
-         index=id, ref_gid= mpls_gid, push_mpls_header=True, set_mpls_label=20, set_bos=1, cpy_ttl_outward=True)
-     ecmp_msg=add_l3_ecmp_group(self.controller, id, [mpls_label_gid])
-     ##add unicast routing flow
-     dst_ip=0x0a000001
-     add_unicast_routing_flow(self.controller, 0x0800, dst_ip, mask, ecmp_msg.group_id)
-
-     do_barrier(self.controller)
-
-class Spine(base_tests.SimpleDataPlane):
-
-  def runTest(self):  
-     #add Spine Flows
-     switch_mac = [0x00, 0x00, 0x00, 0x55, 0x55, 0x55]
-     dst_mac = [0x00, 0x00, 0x00, 0x01, 0xea, 0xf1]
-     id = 0x55
-     #Add MPLS termination 
-     port, vlan_id=31, 4093 
-     ##add L2 Interface Group
-     add_one_l2_interface_group(self.controller, port,  vlan_id=vlan_id, is_tagged=False, send_barrier=False)
-     ##add L3 Unicast Group
-     l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=id, src_mac=switch_mac,
-                                dst_mac=dst_mac)
-     ecmp_msg = add_l3_ecmp_group(self.controller, port, [l3_msg.group_id])
-     add_one_vlan_table_flow(self.controller, of_port=port, vlan_id=vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
-     add_termination_flow(self.controller, port, 0x8847, switch_mac, vlan_id, goto_table=24)
-     add_mpls_flow(self.controller, ecmp_msg.group_id, 10)
-     
-     dst_mac = [0x00, 0x00, 0x00, 0x01, 0xea, 0xf2]
-     #Add MPLS termination
-     port=32
-     ##add L2 Interface Group
-     add_one_l2_interface_group(self.controller, port,  vlan_id=vlan_id, is_tagged=False, send_barrier=False)
-     ##add L3 Unicast Group
-     id=id+1
-     l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=id, src_mac=switch_mac,
-                                dst_mac=dst_mac)
-     ecmp_msg = add_l3_ecmp_group(self.controller, port, [l3_msg.group_id])
-     add_one_vlan_table_flow(self.controller, of_port=port, vlan_id=vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
-     add_termination_flow(self.controller, port, 0x8847, switch_mac, vlan_id, goto_table=24)
-     add_mpls_flow(self.controller, ecmp_msg.group_id, 20)
-
-class TestLeaf1(base_tests.SimpleDataPlane):
-
-  def runTest(self): 
-        host_mac='00:00:00:12:34:01'
-        ip_src='10.0.0.1'
-        ip_dst='20.0.0.2'
-        switch_mac='00:00:00:01:ea:f1'
-        parsed_pkt = simple_tcp_packet(pktlen=100, ip_src=ip_src,
-                      ip_dst=ip_dst, eth_dst=switch_mac, eth_src=host_mac, ip_ttl=33)
-        pkt=str(parsed_pkt)
-        self.dataplane.send(33, pkt)
-
-        #build expect packet
-        next_hop_mac='00:00:00:55:55:55' 
-        switch_mac='00:00:00:01:ea:f1'
-        label = (20, 0, 1, 32)
-        exp_pkt = mpls_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=100, label=[label], 
-               eth_dst=next_hop_mac, eth_src=switch_mac, ip_ttl=32, ip_src=ip_src, ip_dst=ip_dst)
-        pkt=str(exp_pkt)
-        verify_packet(self, pkt, 37)
-
-class TestSpine(base_tests.SimpleDataPlane):
-
-  def runTest(self):
-        ip_src='10.0.0.1'
-        ip_dst='20.0.0.2'
-
-        #build outgoing packet
-        spine_mac='00:00:00:55:55:55'
-        switch_mac='00:00:00:01:ea:f2'
-        leaf1= '00:00:00:01:ea:f1' 
-        label = (20, 0, 1, 32)
-        parsed_pkt = mpls_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=100, label=[label],
-               eth_dst=spine_mac, eth_src=leaf1, ip_ttl=32, ip_src=ip_src, ip_dst=ip_dst)
-        pkt=str(parsed_pkt)
-        self.dataplane.send(33, pkt)
-
-        exp_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=20, ip_src=ip_src,
-                        ip_dst=ip_dst, eth_dst=switch_mac, eth_src=spine_mac, ip_ttl=31)
-        pkt=str(exp_pkt)
-        verify_packet(self, pkt, 37)
-
-class TestLeaf2(base_tests.SimpleDataPlane):
-
-  def runTest(self):
-        host_mac='00:00:00:55:55:55'
-        ip_src='10.0.0.1'
-        ip_dst='20.0.0.3'
-        switch_mac='00:00:00:01:ea:f1'
-        parsed_pkt = simple_tcp_packet(pktlen=100, ip_src=ip_src,
-                      ip_dst=ip_dst, eth_dst=switch_mac, eth_src=host_mac, ip_ttl=33)
-        pkt=str(parsed_pkt)
-        self.dataplane.send(33, pkt)
-        switch_mac='00:00:00:01:ea:f2'
-        host_mac='00:00:00:12:34:02'
-        exp_pkt = simple_tcp_packet(pktlen=100, ip_src=ip_src,
-                        ip_dst=ip_dst, eth_dst=host_mac, eth_src=switch_mac, ip_ttl=30)
-        pkt=str(exp_pkt)
-        verify_packet(self, pkt, 37)
-
-
-