Committed by
Gerrit Code Review
ONOS-4561: Exclude non standard VLAN IDs
Change-Id: I3f7542521d0867e71f11263e46d6116cd6120428
Showing
2 changed files
with
8 additions
and
0 deletions
... | @@ -18,6 +18,7 @@ package org.onosproject.driver.query; | ... | @@ -18,6 +18,7 @@ package org.onosproject.driver.query; |
18 | import java.util.Set; | 18 | import java.util.Set; |
19 | import java.util.stream.IntStream; | 19 | import java.util.stream.IntStream; |
20 | 20 | ||
21 | +import com.google.common.collect.ImmutableSet; | ||
21 | import org.onlab.packet.VlanId; | 22 | import org.onlab.packet.VlanId; |
22 | import org.onlab.util.GuavaCollectors; | 23 | import org.onlab.util.GuavaCollectors; |
23 | import org.onosproject.net.PortNumber; | 24 | import org.onosproject.net.PortNumber; |
... | @@ -36,6 +37,9 @@ public class FullVlanAvailable | ... | @@ -36,6 +37,9 @@ public class FullVlanAvailable |
36 | 37 | ||
37 | private static final int MAX_VLAN_ID = VlanId.MAX_VLAN; | 38 | private static final int MAX_VLAN_ID = VlanId.MAX_VLAN; |
38 | private static final Set<VlanId> ENTIRE_VLAN = getEntireVlans(); | 39 | private static final Set<VlanId> ENTIRE_VLAN = getEntireVlans(); |
40 | + private static final Set<Integer> EXCLUDED = ImmutableSet.of( | ||
41 | + (int) VlanId.NO_VID, | ||
42 | + (int) VlanId.RESERVED); | ||
39 | 43 | ||
40 | @Override | 44 | @Override |
41 | public Set<VlanId> queryVlanIds(PortNumber port) { | 45 | public Set<VlanId> queryVlanIds(PortNumber port) { |
... | @@ -44,6 +48,7 @@ public class FullVlanAvailable | ... | @@ -44,6 +48,7 @@ public class FullVlanAvailable |
44 | 48 | ||
45 | private static Set<VlanId> getEntireVlans() { | 49 | private static Set<VlanId> getEntireVlans() { |
46 | return IntStream.range(0, MAX_VLAN_ID) | 50 | return IntStream.range(0, MAX_VLAN_ID) |
51 | + .filter(x -> !EXCLUDED.contains(x)) | ||
47 | .mapToObj(x -> VlanId.vlanId((short) x)) | 52 | .mapToObj(x -> VlanId.vlanId((short) x)) |
48 | .collect(GuavaCollectors.toImmutableSet()); | 53 | .collect(GuavaCollectors.toImmutableSet()); |
49 | } | 54 | } | ... | ... |
... | @@ -29,6 +29,9 @@ public final class VlanId extends Identifier<Short> { | ... | @@ -29,6 +29,9 @@ public final class VlanId extends Identifier<Short> { |
29 | // required. | 29 | // required. |
30 | public static final short ANY_VALUE = (short) 0x1000; | 30 | public static final short ANY_VALUE = (short) 0x1000; |
31 | 31 | ||
32 | + public static final short NO_VID = 0; // 0 is not used for VLAN ID | ||
33 | + public static final short RESERVED = 4095; // represents all tagged traffic | ||
34 | + | ||
32 | public static final VlanId NONE = VlanId.vlanId(UNTAGGED); | 35 | public static final VlanId NONE = VlanId.vlanId(UNTAGGED); |
33 | public static final VlanId ANY = VlanId.vlanId(ANY_VALUE); | 36 | public static final VlanId ANY = VlanId.vlanId(ANY_VALUE); |
34 | 37 | ... | ... |
-
Please register or login to post a comment