Search in sources :

Example 1 with MapNotify

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

the class MapNotifySerializationTest method deserialize__MultipleRecords.

@Test
public void deserialize__MultipleRecords() throws Exception {
    // LISP(Type = 4 Map-Notify, I=1
    // Record Counter: 4
    // EID prefixes: 153.16.254.1 -- 152.16.254.1 -- 151.16.254.1 --
    // 150.16.254.1
    // Local RLOCs: 192.168.136.10 -- 192.168.136.11 -- 192.168.136.12 --
    // 192.168.136.13
    // 
    MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("40 00 00 " + // Record count
    "04 " + "FF BB 00 00 00 00 00 00 00 01 00 14 87 c1 33 cd " + "d1 1e bc 80 fd 3e 71 11 81 17 40 74 26 25 44 bd " + // Record
    "00 00 00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " + // 1
    "ff 00 00 05 00 01 c0 a8 88 0a " + // contd
    "00 00 00 0a 01 20 10 00 00 00 00 01 98 10 fe 01 01 64 " + // 2
    "ff 00 00 05 00 01 c0 a8 88 0b " + // contd
    "00 00 00 0a 01 20 10 00 00 00 00 01 97 10 fe 01 01 64 " + // 3
    "ff 00 00 05 00 01 c0 a8 88 0c " + // contd
    "00 00 00 0a 01 20 10 00 00 00 00 01 96 10 fe 01 01 64 " + // 4
    "ff 00 00 05 00 01 c0 a8 88 0d "));
    assertEquals(4, mn.getMappingRecordItem().size());
    assertEquals(LispAddressUtil.asIpv4PrefixBinaryEid("153.16.254.1/32"), mn.getMappingRecordItem().get(0).getMappingRecord().getEid());
    assertEquals(LispAddressUtil.asIpv4PrefixBinaryEid("151.16.254.1/32"), mn.getMappingRecordItem().get(2).getMappingRecord().getEid());
    assertEquals(LispAddressUtil.asIpv4Rloc("192.168.136.11"), mn.getMappingRecordItem().get(1).getMappingRecord().getLocatorRecord().get(0).getRloc());
    assertEquals(LispAddressUtil.asIpv4Rloc("192.168.136.13"), mn.getMappingRecordItem().get(3).getMappingRecord().getLocatorRecord().get(0).getRloc());
}
Also used : MapNotify(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify) Test(org.junit.Test)

Example 2 with MapNotify

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

the class MapNotifySerializationTest method deserialize__IllegalAction.

@Test
public void deserialize__IllegalAction() throws Exception {
    MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("40 00 01 01 FF BB " + "00 00 00 00 00 00 00 01 00 14 ec 47 1e 53 25 91 " + "2f 68 10 75 13 dd 2c e8 6e 3c ac 94 ed e4 00 00 " + "00 0a 01 20 F0 00 00 00 00 01 99 10 fe 01 01 64 " + "ff 00 00 05 00 01 c0 a8 88 0a"));
    assertEquals(1, mn.getMappingRecordItem().size());
    assertEquals(Action.NoAction, mn.getMappingRecordItem().get(0).getMappingRecord().getAction());
}
Also used : MapNotify(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify) Test(org.junit.Test)

Example 3 with MapNotify

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

the class MapNotifySerializationTest method serialize__deserialize.

@Test
public void serialize__deserialize() throws Exception {
    MapNotifyBuilder mnBuilder = new MapNotifyBuilder();
    mnBuilder.setMappingRecordItem(new ArrayList<MappingRecordItem>());
    mnBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(new MappingRecordBuilder().setEid(LispAddressUtil.asIpv4PrefixEid("0.0.0.1/32")).build()).build());
    mnBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(new MappingRecordBuilder().setEid(LispAddressUtil.asIpv4PrefixEid("0.0.0.73/32")).build()).build());
    mnBuilder.setNonce(6161616161L);
    mnBuilder.setKeyId((short) 0x0001);
    byte[] authenticationData = new byte[] { (byte) 0x16, (byte) 0x98, (byte) 0x96, (byte) 0xeb, (byte) 0x88, (byte) 0x2d, (byte) 0x4d, (byte) 0x22, (byte) 0xe5, (byte) 0x8f, (byte) 0xe6, (byte) 0x89, (byte) 0x64, (byte) 0xb9, (byte) 0x17, (byte) 0xa4, (byte) 0xba, (byte) 0x4e, (byte) 0x8c, (byte) 0x41 };
    mnBuilder.setAuthenticationData(authenticationData);
    MapNotify mn = mnBuilder.build();
    ArrayAssert.assertEquals(MapNotifySerializer.getInstance().serialize(mn).array(), MapNotifySerializer.getInstance().serialize(MapNotifySerializer.getInstance().deserialize(MapNotifySerializer.getInstance().serialize(mn))).array());
}
Also used : MappingRecordItemBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItemBuilder) MappingRecordItem(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItem) MappingRecordBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder) MapNotify(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify) MapNotifyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapnotifymessage.MapNotifyBuilder) Test(org.junit.Test)

Example 4 with MapNotify

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

the class MapNotifySerializationTest method deserialize__SHA256.

@Test
public void deserialize__SHA256() throws Exception {
    // LISP(Type = 4 Map-Notify, I=0
    // 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
    // 
    MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("40 00 00 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"));
    assertFalse(mn.isXtrSiteIdPresent());
    assertEquals(1, mn.getMappingRecordItem().size());
    assertEquals(0xFFBB000000000000L, mn.getNonce().longValue());
    assertEquals(0x0002, mn.getKeyId().shortValue());
    byte[] expectedAuthenticationData = { (byte) 0x70, (byte) 0x30, (byte) 0xd4, (byte) 0xc6, (byte) 0x10, (byte) 0x44, (byte) 0x0d, (byte) 0x83, (byte) 0xbe, (byte) 0x4d, (byte) 0xbf, (byte) 0xfd, (byte) 0xa9, (byte) 0x8c, (byte) 0x57, (byte) 0x6d, (byte) 0x68, (byte) 0xa5, (byte) 0xbf, (byte) 0x32, (byte) 0x11, (byte) 0xc9, (byte) 0x7b, (byte) 0x58, (byte) 0xc4, (byte) 0xb9, (byte) 0x9f, (byte) 0x06, (byte) 0x11, (byte) 0x23, (byte) 0xb9, (byte) 0x38 };
    ArrayAssert.assertEquals(expectedAuthenticationData, mn.getAuthenticationData());
}
Also used : MapNotify(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify) Test(org.junit.Test)

Example 5 with MapNotify

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

the class MapNotifySerializationTest method deserialize__SomeEidToLocatorFiels.

@Test
public void deserialize__SomeEidToLocatorFiels() throws Exception {
    // LISP(Type = 4 Map-Notify, I=0
    // Record Counter: 4
    // EID prefixes: 153.16.254.1 -- 152.16.254.1 -- 151.16.254.1 --
    // 150.16.254.1
    // Local RLOCs: 192.168.136.10 -- 192.168.136.11 -- 192.168.136.12 --
    // 192.168.136.13
    // 
    MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("40 00 00 " + // 
    "04 " + // Record count
    "FF BB 00 00 00 00 00 00 00 01 00 14 b9 cd 7b 89 " + // 
    "65 c2 56 03 be dd 81 20 47 e5 c3 4f 56 02 e1 59 " + // 
    "00 00 00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " + // 0
    "ff 00 00 05 00 01 c0 a8 88 0a " + // contd
    "00 00 00 0b 01 17 50 00 01 11 00 01 98 10 fe 01 01 64 " + // 1
    "ff 00 00 05 00 01 c0 a8 88 0b " + // contd
    "00 00 00 0c 01 20 00 00 02 22 00 01 97 10 fe 01 01 64 " + // 2
    "ff 00 00 05 00 01 c0 a8 88 0c " + // contd
    "00 00 00 0d 01 20 20 00 03 33 00 01 96 10 fe 01 01 64 " + // 3
    "ff 00 00 05 00 01 c0 a8 88 0d "));
    assertEquals(4, mn.getMappingRecordItem().size());
    final MappingRecord record0 = mn.getMappingRecordItem().get(0).getMappingRecord();
    final MappingRecord record1 = mn.getMappingRecordItem().get(1).getMappingRecord();
    final MappingRecord record2 = mn.getMappingRecordItem().get(2).getMappingRecord();
    final MappingRecord record3 = mn.getMappingRecordItem().get(3).getMappingRecord();
    assertEquals(10, record0.getRecordTtl().intValue());
    assertEquals(13, record3.getRecordTtl().intValue());
    assertEquals(32, MaskUtil.getMaskForAddress(record0.getEid().getAddress()));
    assertEquals(23, MaskUtil.getMaskForAddress(record1.getEid().getAddress()));
    assertEquals(Action.NoAction, record0.getAction());
    assertEquals(Action.SendMapRequest, record1.getAction());
    assertEquals(Action.NoAction, record2.getAction());
    assertEquals(Action.NativelyForward, record3.getAction());
    assertTrue(record0.isAuthoritative());
    assertTrue(record1.isAuthoritative());
    assertFalse(record2.isAuthoritative());
    assertFalse(record3.isAuthoritative());
    assertEquals(0x000, record0.getMapVersion().shortValue());
    assertEquals(0x111, record1.getMapVersion().shortValue());
    assertEquals(0x222, record2.getMapVersion().shortValue());
    assertEquals(0x333, record3.getMapVersion().shortValue());
}
Also used : MappingRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord) MapNotify(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify) Test(org.junit.Test)

Aggregations

MapNotify (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify)19 Test (org.junit.Test)12 GotMapNotify (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapNotify)10 MappingRecordItem (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItem)7 MapNotifyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapnotifymessage.MapNotifyBuilder)6 MapRegister (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRegister)5 MappingRecordItemBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItemBuilder)5 GotMapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply)4 MapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply)4 MapRequest (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)4 MappingRecordBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder)4 TransportAddress (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress)4 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)3 LocatorRecord (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.locatorrecords.LocatorRecord)3 TransportAddressBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddressBuilder)3 ByteBuffer (java.nio.ByteBuffer)2 ArrayList (java.util.ArrayList)2 PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)2 MappingRecord (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord)2 SendMapNotifyInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapNotifyInputBuilder)2