CORD-349 Support VLAN cross-connect traffic

Change related to this topic:
- Support VLAN cross-connect traffic
    Utilize ports subjectClass to achieve. For non-xConnect port, set interface VLAN to -1
- Remove VLAN checking since we have multiple VLANs per port
- Hash the L2 interface group key generation to include VLAN as well
- Update the network-cfg.json sample

Other refactoring changes:
- Read next objective stores from srManager directly
- Use constant for flow priority
- CORD-267 Javadoc fix

Change-Id: I4ca8c2d9c8b3633a4a0101c5070d19343f7e5b90
diff --git a/drivers/src/main/java/org/onosproject/driver/pipeline/SpringOpenTTP.java b/drivers/src/main/java/org/onosproject/driver/pipeline/SpringOpenTTP.java
index 31fa0ef..1277c75 100644
--- a/drivers/src/main/java/org/onosproject/driver/pipeline/SpringOpenTTP.java
+++ b/drivers/src/main/java/org/onosproject/driver/pipeline/SpringOpenTTP.java
@@ -837,7 +837,6 @@
         if (vlanIdCriterion.vlanId() != VlanId.NONE) {
             selector.matchVlanId(vlanIdCriterion.vlanId());
             selector.matchInPort(p.port());
-            treatment.deferred().popVlan();
         } else {
             selector.matchInPort(p.port());
             treatment.immediate().pushVlan().setVlanId(assignedVlan);
@@ -887,25 +886,31 @@
         }
 
         VlanId assignedVlan = null;
-        if (vlanIdCriterion != null && vlanIdCriterion.vlanId() == VlanId.NONE) {
-            // Assign a VLAN ID to untagged packets
-            if (filt.meta() == null) {
-                log.error("Missing metadata in filtering objective required "
-                                  + "for vlan assignment in dev {}", deviceId);
-                fail(filt, ObjectiveError.BADPARAMS);
-                return;
-            }
-            for (Instruction i : filt.meta().allInstructions()) {
-                if (i instanceof ModVlanIdInstruction) {
-                    assignedVlan = ((ModVlanIdInstruction) i).vlanId();
+        if (vlanIdCriterion != null) {
+            // For VLAN cross-connect packets, use the configured VLAN
+            if (vlanIdCriterion.vlanId() != VlanId.NONE) {
+                assignedVlan = vlanIdCriterion.vlanId();
+
+            // For untagged packets, assign a VLAN ID
+            } else {
+                if (filt.meta() == null) {
+                    log.error("Missing metadata in filtering objective required " +
+                            "for vlan assignment in dev {}", deviceId);
+                    fail(filt, ObjectiveError.BADPARAMS);
+                    return;
                 }
-            }
-            if (assignedVlan == null) {
-                log.error("Driver requires an assigned vlan-id to tag incoming "
-                                  + "untagged packets. Not processing vlan filters on "
-                                  + "device {}", deviceId);
-                fail(filt, ObjectiveError.BADPARAMS);
-                return;
+                for (Instruction i : filt.meta().allInstructions()) {
+                    if (i instanceof ModVlanIdInstruction) {
+                        assignedVlan = ((ModVlanIdInstruction) i).vlanId();
+                    }
+                }
+                if (assignedVlan == null) {
+                    log.error("Driver requires an assigned vlan-id to tag incoming "
+                            + "untagged packets. Not processing vlan filters on "
+                            + "device {}", deviceId);
+                    fail(filt, ObjectiveError.BADPARAMS);
+                    return;
+                }
             }
         }
 
@@ -923,9 +928,9 @@
             }
         }
 
-        if (ethCriterion == null || vlanIdCriterion == null) {
-            log.debug("filtering objective missing dstMac or vlan, cannot program"
-                              + "Vlan Table");
+        if (vlanIdCriterion == null) {
+            log.debug("filtering objective missing VLAN ID criterion, "
+                    + "cannot program VLAN Table");
         } else {
             for (FlowRule vlanRule : processVlanIdFilter(vlanIdCriterion,
                                                          filt,