Committed by
Gerrit Code Review
Use ON.Lab OUI for LLDP packets.
Change-Id: Ie285a47c5abd10a9ac37b3ca8f6ddf16ad867b2d
Showing
4 changed files
with
25 additions
and
32 deletions
... | @@ -15,15 +15,11 @@ | ... | @@ -15,15 +15,11 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.provider.lldp.impl; | 16 | package org.onosproject.provider.lldp.impl; |
17 | 17 | ||
18 | -import java.nio.ByteBuffer; | 18 | +import com.google.common.collect.ArrayListMultimap; |
19 | -import java.util.Collections; | 19 | +import com.google.common.collect.ImmutableList; |
20 | -import java.util.HashMap; | 20 | +import com.google.common.collect.ImmutableMap; |
21 | -import java.util.HashSet; | 21 | +import com.google.common.collect.ImmutableSet; |
22 | -import java.util.List; | 22 | +import com.google.common.collect.Lists; |
23 | -import java.util.Map; | ||
24 | -import java.util.Set; | ||
25 | -import java.util.concurrent.CompletableFuture; | ||
26 | - | ||
27 | import org.junit.After; | 23 | import org.junit.After; |
28 | import org.junit.Before; | 24 | import org.junit.Before; |
29 | import org.junit.Test; | 25 | import org.junit.Test; |
... | @@ -70,11 +66,14 @@ import org.onosproject.net.packet.PacketServiceAdapter; | ... | @@ -70,11 +66,14 @@ import org.onosproject.net.packet.PacketServiceAdapter; |
70 | import org.onosproject.net.provider.ProviderId; | 66 | import org.onosproject.net.provider.ProviderId; |
71 | import org.onosproject.provider.lldpcommon.LinkDiscovery; | 67 | import org.onosproject.provider.lldpcommon.LinkDiscovery; |
72 | 68 | ||
73 | -import com.google.common.collect.ArrayListMultimap; | 69 | +import java.nio.ByteBuffer; |
74 | -import com.google.common.collect.ImmutableList; | 70 | +import java.util.Collections; |
75 | -import com.google.common.collect.ImmutableMap; | 71 | +import java.util.HashMap; |
76 | -import com.google.common.collect.ImmutableSet; | 72 | +import java.util.HashSet; |
77 | -import com.google.common.collect.Lists; | 73 | +import java.util.List; |
74 | +import java.util.Map; | ||
75 | +import java.util.Set; | ||
76 | +import java.util.concurrent.CompletableFuture; | ||
78 | 77 | ||
79 | import static org.easymock.EasyMock.createMock; | 78 | import static org.easymock.EasyMock.createMock; |
80 | import static org.easymock.EasyMock.expect; | 79 | import static org.easymock.EasyMock.expect; |
... | @@ -655,7 +654,7 @@ public class LldpLinkProviderTest { | ... | @@ -655,7 +654,7 @@ public class LldpLinkProviderTest { |
655 | 654 | ||
656 | Ethernet ethPacket = new Ethernet(); | 655 | Ethernet ethPacket = new Ethernet(); |
657 | ethPacket.setEtherType(Ethernet.TYPE_LLDP); | 656 | ethPacket.setEtherType(Ethernet.TYPE_LLDP); |
658 | - ethPacket.setDestinationMACAddress(ONOSLLDP.LLDP_NICIRA); | 657 | + ethPacket.setDestinationMACAddress(ONOSLLDP.LLDP_ONLAB); |
659 | ethPacket.setPayload(lldp); | 658 | ethPacket.setPayload(lldp); |
660 | ethPacket.setPad(true); | 659 | ethPacket.setPad(true); |
661 | 660 | ... | ... |
... | @@ -81,7 +81,7 @@ public class LinkDiscovery implements TimerTask { | ... | @@ -81,7 +81,7 @@ public class LinkDiscovery implements TimerTask { |
81 | 81 | ||
82 | ethPacket = new Ethernet(); | 82 | ethPacket = new Ethernet(); |
83 | ethPacket.setEtherType(Ethernet.TYPE_LLDP); | 83 | ethPacket.setEtherType(Ethernet.TYPE_LLDP); |
84 | - ethPacket.setDestinationMACAddress(ONOSLLDP.LLDP_NICIRA); | 84 | + ethPacket.setDestinationMACAddress(ONOSLLDP.LLDP_ONLAB); |
85 | ethPacket.setPad(true); | 85 | ethPacket.setPad(true); |
86 | 86 | ||
87 | bddpEth = new Ethernet(); | 87 | bddpEth = new Ethernet(); | ... | ... |
... | @@ -15,9 +15,7 @@ | ... | @@ -15,9 +15,7 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.provider.netcfglinks; | 16 | package org.onosproject.provider.netcfglinks; |
17 | 17 | ||
18 | -import java.nio.ByteBuffer; | 18 | +import com.google.common.collect.ImmutableList; |
19 | -import java.util.List; | ||
20 | - | ||
21 | import org.junit.After; | 19 | import org.junit.After; |
22 | import org.junit.Before; | 20 | import org.junit.Before; |
23 | import org.junit.Test; | 21 | import org.junit.Test; |
... | @@ -53,7 +51,8 @@ import org.onosproject.net.packet.PacketContext; | ... | @@ -53,7 +51,8 @@ import org.onosproject.net.packet.PacketContext; |
53 | import org.onosproject.net.packet.PacketProcessor; | 51 | import org.onosproject.net.packet.PacketProcessor; |
54 | import org.onosproject.net.packet.PacketServiceAdapter; | 52 | import org.onosproject.net.packet.PacketServiceAdapter; |
55 | 53 | ||
56 | -import com.google.common.collect.ImmutableList; | 54 | +import java.nio.ByteBuffer; |
55 | +import java.util.List; | ||
57 | 56 | ||
58 | import static org.hamcrest.MatcherAssert.assertThat; | 57 | import static org.hamcrest.MatcherAssert.assertThat; |
59 | import static org.hamcrest.Matchers.empty; | 58 | import static org.hamcrest.Matchers.empty; |
... | @@ -153,7 +152,7 @@ public class NetworkConfigLinksProviderTest { | ... | @@ -153,7 +152,7 @@ public class NetworkConfigLinksProviderTest { |
153 | 152 | ||
154 | Ethernet ethPacket = new Ethernet(); | 153 | Ethernet ethPacket = new Ethernet(); |
155 | ethPacket.setEtherType(Ethernet.TYPE_LLDP); | 154 | ethPacket.setEtherType(Ethernet.TYPE_LLDP); |
156 | - ethPacket.setDestinationMACAddress(ONOSLLDP.LLDP_NICIRA); | 155 | + ethPacket.setDestinationMACAddress(ONOSLLDP.LLDP_ONLAB); |
157 | ethPacket.setPayload(lldp); | 156 | ethPacket.setPayload(lldp); |
158 | ethPacket.setPad(true); | 157 | ethPacket.setPad(true); |
159 | 158 | ... | ... |
... | @@ -15,15 +15,13 @@ | ... | @@ -15,15 +15,13 @@ |
15 | */ | 15 | */ |
16 | package org.onlab.packet; | 16 | package org.onlab.packet; |
17 | 17 | ||
18 | -import java.util.HashMap; | ||
19 | - | ||
20 | import com.google.common.collect.Lists; | 18 | import com.google.common.collect.Lists; |
21 | import com.google.common.collect.Maps; | 19 | import com.google.common.collect.Maps; |
22 | - | ||
23 | import org.apache.commons.lang.ArrayUtils; | 20 | import org.apache.commons.lang.ArrayUtils; |
24 | 21 | ||
25 | import java.nio.ByteBuffer; | 22 | import java.nio.ByteBuffer; |
26 | import java.nio.charset.StandardCharsets; | 23 | import java.nio.charset.StandardCharsets; |
24 | +import java.util.HashMap; | ||
27 | 25 | ||
28 | import static org.onlab.packet.LLDPOrganizationalTLV.OUI_LENGTH; | 26 | import static org.onlab.packet.LLDPOrganizationalTLV.OUI_LENGTH; |
29 | import static org.onlab.packet.LLDPOrganizationalTLV.SUBTYPE_LENGTH; | 27 | import static org.onlab.packet.LLDPOrganizationalTLV.SUBTYPE_LENGTH; |
... | @@ -37,10 +35,8 @@ public class ONOSLLDP extends LLDP { | ... | @@ -37,10 +35,8 @@ public class ONOSLLDP extends LLDP { |
37 | public static final String DEFAULT_DEVICE = "INVALID"; | 35 | public static final String DEFAULT_DEVICE = "INVALID"; |
38 | public static final String DEFAULT_NAME = "ONOS Discovery"; | 36 | public static final String DEFAULT_NAME = "ONOS Discovery"; |
39 | 37 | ||
40 | - public static final byte[] LLDP_NICIRA = {0x01, 0x23, 0x20, 0x00, 0x00, | 38 | + // ON.Lab OUI (a42305) with multicast bit set |
41 | - 0x01}; | 39 | + public static final byte[] LLDP_ONLAB = {(byte) 0xa5, 0x23, 0x05, 0x00, 0x00, 0x01}; |
42 | - public static final byte[] LLDP_MULTICAST = {0x01, (byte) 0x80, | ||
43 | - (byte) 0xc2, 0x00, 0x00, 0x0e}; | ||
44 | public static final byte[] BDDP_MULTICAST = {(byte) 0xff, (byte) 0xff, | 40 | public static final byte[] BDDP_MULTICAST = {(byte) 0xff, (byte) 0xff, |
45 | (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff}; | 41 | (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff}; |
46 | 42 | ||
... | @@ -52,8 +48,7 @@ public class ONOSLLDP extends LLDP { | ... | @@ -52,8 +48,7 @@ public class ONOSLLDP extends LLDP { |
52 | private static final short DEVICE_LENGTH = OUI_LENGTH + SUBTYPE_LENGTH; | 48 | private static final short DEVICE_LENGTH = OUI_LENGTH + SUBTYPE_LENGTH; |
53 | private static final short DOMAIN_LENGTH = OUI_LENGTH + SUBTYPE_LENGTH; | 49 | private static final short DOMAIN_LENGTH = OUI_LENGTH + SUBTYPE_LENGTH; |
54 | 50 | ||
55 | - private final HashMap<Byte, LLDPOrganizationalTLV> opttlvs = | 51 | + private final HashMap<Byte, LLDPOrganizationalTLV> opttlvs = Maps.newHashMap(); |
56 | - Maps.<Byte, LLDPOrganizationalTLV>newHashMap(); | ||
57 | 52 | ||
58 | // TLV constants: type, size and subtype | 53 | // TLV constants: type, size and subtype |
59 | // Organizationally specific TLV also have packet offset and contents of TLV | 54 | // Organizationally specific TLV also have packet offset and contents of TLV |
... | @@ -82,7 +77,7 @@ public class ONOSLLDP extends LLDP { | ... | @@ -82,7 +77,7 @@ public class ONOSLLDP extends LLDP { |
82 | setName(DEFAULT_NAME); | 77 | setName(DEFAULT_NAME); |
83 | setDevice(DEFAULT_DEVICE); | 78 | setDevice(DEFAULT_DEVICE); |
84 | 79 | ||
85 | - setOptionalTLVList(Lists.<LLDPTLV>newArrayList(opttlvs.values())); | 80 | + setOptionalTLVList(Lists.newArrayList(opttlvs.values())); |
86 | setTtl(new LLDPTLV().setType(TTL_TLV_TYPE) | 81 | setTtl(new LLDPTLV().setType(TTL_TLV_TYPE) |
87 | .setLength((short) ttlValue.length) | 82 | .setLength((short) ttlValue.length) |
88 | .setValue(ttlValue)); | 83 | .setValue(ttlValue)); |
... | @@ -227,7 +222,7 @@ public class ONOSLLDP extends LLDP { | ... | @@ -227,7 +222,7 @@ public class ONOSLLDP extends LLDP { |
227 | public static ONOSLLDP parseONOSLLDP(Ethernet eth) { | 222 | public static ONOSLLDP parseONOSLLDP(Ethernet eth) { |
228 | if (eth.getEtherType() == Ethernet.TYPE_LLDP || | 223 | if (eth.getEtherType() == Ethernet.TYPE_LLDP || |
229 | eth.getEtherType() == Ethernet.TYPE_BSN) { | 224 | eth.getEtherType() == Ethernet.TYPE_BSN) { |
230 | - ONOSLLDP onosLldp = new ONOSLLDP((LLDP) eth.getPayload()); //(ONOSLLDP) eth.getPayload(); | 225 | + ONOSLLDP onosLldp = new ONOSLLDP((LLDP) eth.getPayload()); |
231 | if (ONOSLLDP.DEFAULT_NAME.equals(onosLldp.getNameString())) { | 226 | if (ONOSLLDP.DEFAULT_NAME.equals(onosLldp.getNameString())) { |
232 | return onosLldp; | 227 | return onosLldp; |
233 | } | 228 | } | ... | ... |
-
Please register or login to post a comment