[SEBA-269] SIAB: DHCP packets not trapped to controller
[SEBA-341] Ponsim: Add secondary flows to OLT to trap c-tagged DHCP/EAPOL
[VOL-1301] Ponsim: Use innermost 802.1Q header for matching Ethernet type
[VOL-1302] Ponsim: Fix packet-out for QinQ-tagged packets

Change-Id: I1fcbcd793f477bd8d4f1df02098772465743ddd3
diff --git a/ponsim/v2/core/ponsim_device.go b/ponsim/v2/core/ponsim_device.go
index 9474432..4d2a857 100644
--- a/ponsim/v2/core/ponsim_device.go
+++ b/ponsim/v2/core/ponsim_device.go
@@ -413,7 +413,7 @@
 
 			case openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_ETH_TYPE:
 				cmpType := uint32(common.GetEthernetLayer(frame).EthernetType)
-				if dot1q := common.GetDot1QLayer(frame); dot1q != nil {
+				if dot1q := common.GetLastDot1QLayer(frame); dot1q != nil {
 					cmpType = uint32(dot1q.Type)
 				}
 				if ofbfield.GetOfbField().GetEthType() != cmpType {
@@ -421,7 +421,7 @@
 						"device":   o,
 						"flow":     flow,
 						"expected": layers.EthernetType(ofbfield.GetOfbField().GetEthType()),
-						"actual":   common.GetEthernetLayer(frame).EthernetType,
+						"actual":   cmpType,
 					}).Warn("Frame type does not match")
 					return 0, nil
 				} else {
@@ -429,7 +429,7 @@
 						"device":   o,
 						"flow":     flow,
 						"expected": layers.EthernetType(ofbfield.GetOfbField().GetEthType()),
-						"actual":   common.GetEthernetLayer(frame).EthernetType,
+						"actual":   cmpType,
 					}).Debug("Frame type matches")
 				}
 				matchedMask |= ETH_TYPE