Add tagged packet to PacketIn.
Add PortConfigModErr testcase.
diff --git a/tests/basic.py b/tests/basic.py
index 5a286fe..feda04f 100644
--- a/tests/basic.py
+++ b/tests/basic.py
@@ -41,6 +41,8 @@
 
 test_prio = {}
 
+TEST_VID_DEFAULT = 2
+
 def test_set_init(config):
     """
     Set up function for basic test classes
@@ -253,9 +255,13 @@
         self.assertEqual(rc, 0, "Failed to delete all flows")
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
+        vid = test_param_get(self.config, 'vid', default=TEST_VID_DEFAULT)
+
         for of_port in basic_port_map.keys():
             for pkt, pt in [
                (simple_tcp_packet(), "simple TCP packet"),
+               (simple_tcp_packet(dl_vlan_enable=True,dl_vlan=vid,pktlen=108), 
+                "simple tagged TCP packet"),
                (simple_eth_packet(), "simple Ethernet packet"),
                (simple_eth_packet(pktlen=40), "tiny Ethernet packet")]:
 
@@ -557,5 +563,44 @@
                              ofp.OFPPC_NO_FLOOD, basic_logger)
         self.assertTrue(rv != -1, "Error sending port mod")
 
+class PortConfigModErr(SimpleProtocol):
+    """
+    Modify a bit in port config on an invalid port and verify
+    error message is received.
+    """
+
+    def runTest(self):
+        basic_logger.info("Running " + str(self))
+
+        # pick a random bad port number
+        bad_port = random.randint(1, ofp.OFPP_MAX)
+        count = 0
+        while (count < 50) and (bad_port in basic_port_map.keys()):
+            bad_port = random.randint(1, ofp.OFPP_MAX)
+            count = count + 1
+        self.assertTrue(count < 50, "Error selecting bad port")
+        basic_logger.info("Select " + str(bad_port) + " as invalid port")
+
+        rv = port_config_set(self.controller, bad_port,
+                             ofp.OFPPC_NO_FLOOD, ofp.OFPPC_NO_FLOOD,
+                             basic_logger)
+        self.assertTrue(rv != -1, "Error sending port mod")
+
+        # poll for error message
+        while True:
+            (response, raw) = self.controller.poll(ofp.OFPT_ERROR, 2)
+            if not response:  # Timeout
+                break
+            if response.code == ofp.OFPPMFC_BAD_PORT:
+                basic_logger.info("Received error message with OFPPMFC_BAD_PORT code")
+                break
+            if not basic_config["relax"]:  # Only one attempt to match
+                break
+            count += 1
+            if count > 10:   # Too many tries
+                break
+
+        self.assertTrue(response is not None, 'Did not receive error message')
+
 if __name__ == "__main__":
     print "Please run through oft script:  ./oft --test_spec=basic"