Set VLAN ID at the OLT.

Change-Id: I399d8f10da88687fd44328c4dd2c4ad8f17d7bf2
diff --git a/apps/xos-integration/src/main/java/org/onosproject/xosintegration/OnosXOSIntegrationManager.java b/apps/xos-integration/src/main/java/org/onosproject/xosintegration/OnosXOSIntegrationManager.java
index 21e8811..1f686ae 100644
--- a/apps/xos-integration/src/main/java/org/onosproject/xosintegration/OnosXOSIntegrationManager.java
+++ b/apps/xos-integration/src/main/java/org/onosproject/xosintegration/OnosXOSIntegrationManager.java
@@ -352,7 +352,6 @@
 
 
         provisionVlanOnPort(OLT_DEVICE_ID, OLT_UPLINK_PORT, onuPort, subscriberVlan.toShort());
-        //provisionDataPlane(tenantToCreate);
 
         String retJson = postRest(json);
 
@@ -389,7 +388,7 @@
     private void provisionVlanOnPort(DeviceId deviceId, int uplinkPort, PortNumber p, short vlanId) {
 
         TrafficSelector upstream = DefaultTrafficSelector.builder()
-                .matchVlanId(VlanId.vlanId(vlanId))
+                .matchVlanId(VlanId.ANY)
                 .matchInPort(p)
                 .build();
 
@@ -399,10 +398,12 @@
                 .build();
 
         TrafficTreatment upstreamTreatment = DefaultTrafficTreatment.builder()
+                .setVlanId(VlanId.vlanId(vlanId))
                 .setOutput(PortNumber.portNumber(uplinkPort))
                 .build();
 
         TrafficTreatment downstreamTreatment = DefaultTrafficTreatment.builder()
+                .popVlan()
                 .setOutput(p)
                 .build();
 
diff --git a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java
index 4a3872c..6086d12 100644
--- a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java
+++ b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java
@@ -530,7 +530,11 @@
                         vlanId = VlanId.ANY;
                     }
                 } else {
-                    vlanId = VlanId.vlanId(match.get(MatchField.VLAN_VID).getVlan());
+                    if (!match.get(MatchField.VLAN_VID).isPresentBitSet()) {
+                        vlanId = VlanId.NONE;
+                    } else {
+                        vlanId = VlanId.vlanId(match.get(MatchField.VLAN_VID).getVlan());
+                    }
                 }
                 if (vlanId != null) {
                     builder.matchVlanId(vlanId);
diff --git a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java
index d9d02ff..e443aac 100644
--- a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java
+++ b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java
@@ -208,6 +208,8 @@
                 if (vid.vlanId().equals(VlanId.ANY)) {
                     mBuilder.setMasked(MatchField.VLAN_VID, OFVlanVidMatch.PRESENT,
                                        OFVlanVidMatch.PRESENT);
+                } else if (vid.vlanId().equals(VlanId.NONE)) {
+                    mBuilder.setExact(MatchField.VLAN_VID, OFVlanVidMatch.NONE);
                 } else {
                     mBuilder.setExact(MatchField.VLAN_VID,
                                       OFVlanVidMatch.ofVlanVid(VlanVid.ofVlan(vid.vlanId().toShort())));