Search in sources :

Example 61 with Rloc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc in project lispflowmapping by opendaylight.

the class AfiListSerializerTest method deserialize__Simple.

@Test
public void deserialize__Simple() throws Exception {
    Rloc address = LispAddressSerializer.getInstance().deserializeRloc(hexToByteBuffer(// 
    "40 03 00 00 " + // 
    "01 00 00 18 " + // IPv4
    "00 01 AA BB CC DD " + // IPv6
    "00 02 11 22 33 44 11 22 33 44 11 22 33 44 11 22 33 44"));
    assertEquals(AfiListLcaf.class, address.getAddressType());
    AfiList afiList = (AfiList) address.getAddress();
    List<SimpleAddress> addressList = afiList.getAfiList().getAddressList();
    assertEquals(2, addressList.size());
    assertEquals("170.187.204.221", String.valueOf(addressList.get(0).getValue()));
    assertEquals("1122:3344:1122:3344:1122:3344:1122:3344", String.valueOf(addressList.get(1).getValue()));
}
Also used : Rloc(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc) AfiList(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiList) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) Test(org.junit.Test)

Example 62 with Rloc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc in project lispflowmapping by opendaylight.

the class AfiListSerializerTest method deserialize__NoAddresses.

@Test
public void deserialize__NoAddresses() throws Exception {
    Rloc address = LispAddressSerializer.getInstance().deserializeRloc(hexToByteBuffer(// 
    "40 03 00 00 " + "01 00 00 00 "));
    assertEquals(AfiListLcaf.class, address.getAddressType());
    AfiList afiList = (AfiList) address.getAddress();
    List<SimpleAddress> addressList = afiList.getAfiList().getAddressList();
    assertEquals(0, addressList.size());
}
Also used : Rloc(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc) AfiList(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiList) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) Test(org.junit.Test)

Example 63 with Rloc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc in project lispflowmapping by opendaylight.

the class LispAuthenticationTest method validate__SHA256.

@Test
public void validate__SHA256() throws Exception {
    // LISP(Type = 3 Map-Register, P=1, M=1
    // Record Counter: 1
    // Nonce: (something)
    // Key ID: 0x0002
    // AuthDataLength: 32 Data:
    // 70 30 d4 c6 10 44 0d 83 be 4d bf fd a9 8c 57 6d 68 a5 bf 32 11 c9 7b
    // 58 c4 b9 9f 06 11 23 b9 38
    // EID prefix: 153.16.254.1/32 (EID=0x9910FE01), TTL: 10, Authoritative,
    // No-Action
    // Local RLOC: 192.168.136.10 (RLOC=0xC0A8880A), Reachable,
    // Priority/Weight: 1/100, Multicast Priority/Weight: 255/0
    // 
    final ByteBuffer byteBuffer = hexToByteBuffer("38 00 01 01 FF BB " + "00 00 00 00 00 00 00 02 00 20 " + "70 30 d4 c6 10 44 0d 83 be 4d bf fd a9 8c 57 6d " + "68 a5 bf 32 11 c9 7b 58 c4 b9 9f 06 11 23 b9 38 " + "00 00 " + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " + "ff 00 00 05 00 01 c0 a8 88 0a");
    MapRegister mapRegister = MapRegisterSerializer.getInstance().deserialize(byteBuffer, null);
    assertTrue(validate(mapRegister, byteBuffer, EID, 2, PASSWORD));
    assertFalse(validate(mapRegister, byteBuffer, EID, 2, WRONG_PASSWORD));
}
Also used : MapRegister(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRegister) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test)

Example 64 with Rloc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc in project lispflowmapping by opendaylight.

the class LispAuthenticationTest method validate__SHA1.

@Test
public void validate__SHA1() throws Exception {
    // LISP(Type = 3 Map-Register, P=1, M=1
    // Record Counter: 1
    // Nonce: (something)
    // Key ID: 0x0001
    // AuthDataLength: 20 Data:
    // b2:dd:1a:25:c0:60:b1:46:e8:dc:6d:a6:ae:2e:92:92:a6:ca:b7:9d
    // EID prefix: 153.16.254.1/32 (EID=0x9910FE01), TTL: 10, Authoritative,
    // No-Action
    // Local RLOC: 192.168.136.10 (RLOC=0xC0A8880A), Reachable,
    // Priority/Weight: 1/100, Multicast Priority/Weight: 255/0
    // 
    final ByteBuffer byteBuffer = hexToByteBuffer("38 00 01 01 FF BB " + "00 00 00 00 00 00 00 01 00 14 2c 61 b9 c9 9a 20 ba d8 f5 40 d3 55 6f 5f 6e 5a b2 0a bf b5 00 00 " + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " + "ff 00 00 05 00 01 c0 a8 88 0a");
    MapRegister mapRegister = MapRegisterSerializer.getInstance().deserialize(byteBuffer, null);
    assertTrue(validate(mapRegister, byteBuffer, EID, 1, PASSWORD));
    assertFalse(validate(mapRegister, byteBuffer, EID, 1, WRONG_PASSWORD));
}
Also used : MapRegister(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRegister) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test)

Example 65 with Rloc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc in project lispflowmapping by opendaylight.

the class LispAuthenticationTest method validate_WrongAuthentication.

@Test
public void validate_WrongAuthentication() throws Exception {
    // LISP(Type = 3 Map-Register, P=1, M=1
    // Record Counter: 1
    // Nonce: (something)
    // Key ID: 0x0001
    // AuthDataLength: 20 Data:
    // e8:f5:0b:c5:c5:f2:b0:21:27:a8:21:41:04:f3:46:5a:5a:5b:5c:5d
    // EID prefix: 153.16.254.1/32 (EID=0x9910FE01), TTL: 10, Authoritative,
    // No-Action
    // Local RLOC: 192.168.136.10 (RLOC=0xC0A8880A), Reachable,
    // Priority/Weight: 1/100, Multicast Priority/Weight: 255/0
    final ByteBuffer byteBuffer = hexToByteBuffer("38 00 01 01 FF BB " + "00 00 00 00 00 00 00 01 00 14 e8 f5 0b c5 c5 f2 " + "b0 21 27 a8 21 41 04 f3 46 5a 5a 5b 5c 5d 00 00 " + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " + "ff 00 00 05 00 01 c0 a8 88 0a");
    MapRegister mapRegister = MapRegisterSerializer.getInstance().deserialize(byteBuffer, null);
    assertFalse(validate(mapRegister, byteBuffer, EID, 1, PASSWORD));
}
Also used : MapRegister(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRegister) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test)

Aggregations

Rloc (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc)40 Test (org.junit.Test)35 RlocBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder)24 ItrRloc (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc)19 SimpleAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)12 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)11 ArrayList (java.util.ArrayList)10 MapRegister (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRegister)10 LocatorRecord (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.locatorrecords.LocatorRecord)10 LocatorRecordBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.locatorrecords.LocatorRecordBuilder)10 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)9 MappingData (org.opendaylight.lispflowmapping.lisp.type.MappingData)8 MapRequest (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)8 MappingRecord (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord)8 InetAddress (java.net.InetAddress)6 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)6 MappingRecordBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder)6 ItrRlocBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRlocBuilder)6 PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)5 GotMapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply)5