use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.AddMapping in project lispflowmapping by opendaylight.
the class DataStoreBackEndTest method addMappingTest.
/**
* Tests {@link DataStoreBackEnd#addMapping} method.
*/
@Test
public void addMappingTest() {
final Mapping mapping = new MappingBuilder().setMappingRecord(getDefaultMappingRecordBuilder().build()).setOrigin(MappingOrigin.Northbound).build();
dataStoreBackEnd.addMapping(mapping);
Mockito.verify(wTxMock).put(Mockito.eq(LogicalDatastoreType.CONFIGURATION), iidCaptorMapping.capture(), Mockito.eq(mapping), Mockito.eq(true));
// result
MappingKey result = iidCaptorMapping.getValue().firstKeyOf(Mapping.class);
assertEquals("ipv4:" + IPV4_STRING_1, result.getEidUri().getValue());
assertEquals(MappingOrigin.Northbound, result.getOrigin());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.AddMapping in project lispflowmapping by opendaylight.
the class LispMappingService method onAddMapping.
@Override
public void onAddMapping(AddMapping mapRegisterNotification) {
Pair<MapNotify, List<TransportAddress>> result = handleMapRegister(mapRegisterNotification.getMapRegister());
if (result != null && result.getLeft() != null) {
MapNotify mapNotify = result.getLeft();
List<TransportAddress> rlocs = result.getRight();
if (rlocs == null) {
TransportAddressBuilder tab = new TransportAddressBuilder();
tab.setIpAddress(mapRegisterNotification.getTransportAddress().getIpAddress());
tab.setPort(new PortNumber(LispMessage.PORT_NUM));
sendMapNotify(mapNotify, tab.build());
} else {
for (TransportAddress ta : rlocs) {
sendMapNotify(mapNotify, ta);
}
}
} else {
LOG.debug("Not sending Map-Notify");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.AddMapping in project lispflowmapping by opendaylight.
the class LispSouthboundHandlerTest method mapRegister__Ipv6Rloc.
@Test
public void mapRegister__Ipv6Rloc() throws Exception {
// P bit (Proxy-Map-Reply): Set
// M bit (Want-Map-Notify): Set
// Record Counter: 1
// Nonce: 0
// Key ID: 1
// AuthLength: 20
// Authentication Data: 5bc4d44a57e2a55d577a6f89779c004f5da713fb
// EID prefix: 2610:d0:ffff:192::1/128, TTL: 10, Authoritative,
// No-Action
// Local RLOC: 10.0.58.156, Reachable, Priority/Weight: 1/100, Multicast
// Priority/Weight: 255/0
mapRegisterPacket = extractWSUdpByteArray("0000 00 0c 29 34 3e 1b 00 0c 29 f6 d6 0d 08 00 45 00 " + "0010 00 68 00 00 40 00 40 11 ea c3 0a 00 3a 9c 0a 00 " + "0020 01 26 10 f6 10 f6 00 54 f5 9a 38 00 03 01 00 00 " + "0030 00 00 00 00 00 00 00 01 00 14 22 97 ff 61 ec d8 " + "0040 0f 91 c6 c4 01 ef 7f bb 77 58 39 5c 92 23 00 00 " + "0050 00 0a 01 80 10 00 00 00 00 02 26 10 00 d0 ff ff " + "0060 01 92 00 00 00 00 00 00 00 01 01 64 ff 00 00 05 " + "0070 00 01 0a 00 3a 9c");
ArgumentCaptor<AddMapping> captor = ArgumentCaptor.forClass(AddMapping.class);
handleMapRegisterPacket(mapRegisterPacket);
Mockito.verify(mockLispSouthboundPlugin).sendNotificationIfPossible(captor.capture());
MappingRecord eidToLocatorRecord = captor.getValue().getMapRegister().getMappingRecordItem().get(0).getMappingRecord();
assertEquals(LispAddressUtil.asIpv6PrefixBinaryEid("2610:d0:ffff:192:0:0:0:1/128"), eidToLocatorRecord.getEid());
assertEquals(Ipv6PrefixBinaryAfi.class, eidToLocatorRecord.getEid().getAddressType());
assertEquals(LispAddressUtil.asIpv4Rloc("10.0.58.156"), eidToLocatorRecord.getLocatorRecord().get(0).getRloc());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.AddMapping in project lispflowmapping by opendaylight.
the class LispSouthboundHandlerTest method mapRegister__VerifyBasicFields.
@Test
public void mapRegister__VerifyBasicFields() throws Exception {
ArgumentCaptor<AddMapping> captor = ArgumentCaptor.forClass(AddMapping.class);
handleMapRegisterPacket(mapRegisterPacket);
Mockito.verify(mockLispSouthboundPlugin).sendNotificationIfPossible(captor.capture());
MappingRecord eidToLocator = captor.getValue().getMapRegister().getMappingRecordItem().get(0).getMappingRecord();
assertEquals(LispAddressUtil.asIpv4PrefixBinaryEid("153.16.254.1/32"), eidToLocator.getEid());
assertEquals(1, eidToLocator.getLocatorRecord().size());
assertEquals(LispAddressUtil.asIpv4Rloc("192.168.136.10"), eidToLocator.getLocatorRecord().get(0).getRloc());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.AddMapping in project lispflowmapping by opendaylight.
the class SimpleMapCache method addMapping.
@Override
public void addMapping(Eid key, XtrId xtrId, Object value) {
Eid eid = MaskUtil.normalize(key);
ILispDAO table = getOrInstantiateVniTable(key);
ILispDAO xtrIdDao = getOrInstantiateXtrIdTable(eid, table);
xtrIdDao.put(xtrId, new MappingEntry<>(SubKeys.RECORD, value));
}
Aggregations