@Test
public void testLldpToNodeConnectorRefLLDP() throws Exception {
byte[] packetLLDP = {
- 0x01, 0x23, 0x00, 0x00, 0x00, 0x01, (byte) 0x8a, (byte) 0x8e,
- (byte) 0xcc, (byte) 0x85, (byte) 0xeb, 0x27,
- /* ethernet type LLDP 0x88cc */(byte) 0x88, (byte) 0xcc,
- 0x02, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04,
- 0x02, 0x07, 0x32, 0x06, 0x02, 0x13, 0x37, 0x0a, 0x0a,
- /* openflow:2 */0x6f, 0x70, 0x65, 0x6e, 0x66, 0x6c, 0x6f, 0x77, 0x3a, 0x32,
- (byte) 0xfe, 0x10, 0x00, 0x26, (byte) 0xe1, 0x00,
- /* openflow:2:2 */0x6f, 0x70, 0x65, 0x6e, 0x66, 0x6c, 0x6f, 0x77, 0x3a, 0x32, 0x3a, 0x32,
- (byte) 0xfe, 0x14, 0x00, 0x26, (byte) 0xe1, 0x01, 0x62, (byte) 0xc8, 0x2b, 0x67, (byte) 0xce,
- (byte) 0xbe, 0x7c, 0x2b, 0x47, (byte) 0xbe, 0x2b, (byte) 0xe7, (byte) 0xbc,
- (byte) 0xe9, 0x75, 0x3d, 0x00, 0x00
+ 0x01, 0x23, 0x00, 0x00, 0x00, 0x01, (byte) 0x8a, (byte) 0x8e,
+ (byte) 0xcc, (byte) 0x85, (byte) 0xeb, 0x27,
+ /* ethernet type LLDP 0x88cc */(byte) 0x88, (byte) 0xcc,
+ 0x02, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04,
+ 0x02, 0x07, 0x32, 0x06, 0x02, 0x13, 0x37, 0x0a, 0x0a,
+ /* openflow:2 */0x6f, 0x70, 0x65, 0x6e, 0x66, 0x6c, 0x6f, 0x77, 0x3a, 0x32,
+ (byte) 0xfe, 0x10, 0x00, 0x26, (byte) 0xe1, 0x00,
+ /* openflow:2:2 */0x6f, 0x70, 0x65, 0x6e, 0x66, 0x6c, 0x6f, 0x77, 0x3a, 0x32, 0x3a, 0x32,
+ (byte) 0xfe, 0x14, 0x00, 0x26, (byte) 0xe1, 0x01, 0x62, (byte) 0xc8, 0x2b, 0x67, (byte) 0xce,
+ (byte) 0xbe, 0x7c, 0x2b, 0x47, (byte) 0xbe, 0x2b, (byte) 0xe7, (byte) 0xbc,
+ (byte) 0xe9, 0x75, 0x3d, 0x00, 0x00
};
NodeConnectorRef nodeConnectorRef = LLDPDiscoveryUtils.lldpToNodeConnectorRef(packetLLDP, false);
- NodeKey nodeKey = nodeConnectorRef.getValue().firstKeyOf(Node.class, NodeKey.class);
- NodeConnectorKey nodeConnectorKey = nodeConnectorRef.getValue().firstKeyOf(NodeConnector.class,
- NodeConnectorKey.class);
+ NodeKey nodeKey = nodeConnectorRef.getValue().firstKeyOf(Node.class);
+ NodeConnectorKey nodeConnectorKey = nodeConnectorRef.getValue().firstKeyOf(NodeConnector.class);
assertEquals(nodeKey.getId().getValue(), "openflow:2");
assertEquals(nodeConnectorKey.getId().getValue(), "openflow:2:2");
@Test
public void testLldpToNodeConnectorRefNotLLDP() throws Exception {
byte[] packetNotLLDP = {
- 0x01, 0x23, 0x00, 0x00, 0x00, 0x01, (byte) 0x8a, (byte) 0x8e,
- (byte) 0xcc, (byte) 0x85, (byte) 0xeb, 0x27,
- /* ethernet type IPv4 0x0800 */(byte) 0x08, (byte) 0x00,
- 0x02, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04,
- 0x02, 0x07, 0x32, 0x06, 0x02, 0x13, 0x37, 0x0a,
- 0x0a, 0x6f, 0x70, 0x65, 0x6e, 0x66, 0x6c, 0x6f,
- 0x77, 0x3a, 0x32, (byte) 0xfe, 0x10, 0x00, 0x26, (byte) 0xe1,
- 0x00, 0x6f, 0x70, 0x65, 0x6e, 0x66, 0x6c, 0x6f,
- 0x77, 0x3a, 0x32, 0x3a, 0x32, (byte) 0xfe, 0x14, 0x00,
- 0x26, (byte) 0xe1, 0x01, 0x62, (byte) 0xc8, 0x2b, 0x67, (byte) 0xce,
- (byte) 0xbe, 0x7c, 0x2b, 0x47, (byte) 0xbe, 0x2b, (byte) 0xe7, (byte) 0xbc,
- (byte) 0xe9, 0x75, 0x3d, 0x00, 0x00
+ 0x01, 0x23, 0x00, 0x00, 0x00, 0x01, (byte) 0x8a, (byte) 0x8e,
+ (byte) 0xcc, (byte) 0x85, (byte) 0xeb, 0x27,
+ /* ethernet type IPv4 0x0800 */(byte) 0x08, (byte) 0x00,
+ 0x02, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04,
+ 0x02, 0x07, 0x32, 0x06, 0x02, 0x13, 0x37, 0x0a,
+ 0x0a, 0x6f, 0x70, 0x65, 0x6e, 0x66, 0x6c, 0x6f,
+ 0x77, 0x3a, 0x32, (byte) 0xfe, 0x10, 0x00, 0x26, (byte) 0xe1,
+ 0x00, 0x6f, 0x70, 0x65, 0x6e, 0x66, 0x6c, 0x6f,
+ 0x77, 0x3a, 0x32, 0x3a, 0x32, (byte) 0xfe, 0x14, 0x00,
+ 0x26, (byte) 0xe1, 0x01, 0x62, (byte) 0xc8, 0x2b, 0x67, (byte) 0xce,
+ (byte) 0xbe, 0x7c, 0x2b, 0x47, (byte) 0xbe, 0x2b, (byte) 0xe7, (byte) 0xbc,
+ (byte) 0xe9, 0x75, 0x3d, 0x00, 0x00
};
NodeConnectorRef nodeConnectorRef = LLDPDiscoveryUtils.lldpToNodeConnectorRef(packetNotLLDP, false);
assertNull(nodeConnectorRef);
}
-}
\ No newline at end of file
+}