private MapReply sendMapRegisterTwiceWithDiffrentValues(Eid eid, Rloc rloc1, Rloc rloc2)
throws SocketTimeoutException {
MapRegister mb = createMapRegister(eid, rloc1);
- MapNotify mapNotify = lms.handleMapRegister(mb);
+ MapNotify mapNotify = lms.handleMapRegister(mb).getLeft();
MapRequest mr = createMapRequest(eid);
MapReply mapReply = lms.handleMapRequest(mr);
assertEquals(mb.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc(), mapReply.getMappingRecordItem().get(0).getMappingRecord()
.getLocatorRecord().get(0).getRloc());
mb = createMapRegister(eid, rloc2);
- mapNotify = lms.handleMapRegister(mb);
+ mapNotify = lms.handleMapRegister(mb).getLeft();
assertEquals(8, mapNotify.getNonce().longValue());
mr = createMapRequest(eid);
sendMapRequest(mr);
String RECORD = "address";
String XTRID_RECORDS = "xtrid";
String SUBSCRIBERS = "subscribers";
+ String SRC_RLOCS = "src_rlocs";
String REGDATE = "date";
String VNI = "vni";
String LCAF_SRCDST = "lcaf_srcdst";
*/
package org.opendaylight.lispflowmapping.interfaces.lisp;
+import java.util.List;
+
+import org.apache.commons.lang3.tuple.Pair;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRegister;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress;
/**
* The LISP Mapping Service interface
* The map-register message
* @return a map-notify message, if requested in the map-register or null otherwise
*/
- MapNotify handleMapRegister(MapRegister mapRegister);
+ Pair<MapNotify, List<TransportAddress>> handleMapRegister(MapRegister mapRegister);
/**
* Handle southbound map-request
*/
package org.opendaylight.lispflowmapping.interfaces.lisp;
+import java.util.List;
+
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress;
/**
* An interface for dealing with a map notify message.
*
* @param mapNotify
* The map-notify message
+ *
+ * @param rlocs
+ * A list of RLOCs which need to be notified
*/
- void handleMapNotify(MapNotify mapNotify);
+ void handleMapNotify(MapNotify mapNotify, List<TransportAddress> rlocs);
/**
* Handle Solicit Map Request message
package org.opendaylight.lispflowmapping.implementation;
+import java.util.List;
+
import org.apache.commons.lang3.tuple.MutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.opendaylight.controller.md.sal.binding.api.NotificationService;
private volatile String elpPolicy = ConfigIni.getInstance().getElpPolicy();
private ThreadLocal<MapReply> tlsMapReply = new ThreadLocal<MapReply>();
- private ThreadLocal<MapNotify> tlsMapNotify = new ThreadLocal<MapNotify>();
+ private ThreadLocal<Pair<MapNotify, List<TransportAddress>>> tlsMapNotify = new ThreadLocal<Pair<MapNotify, List<TransportAddress>>>();
private ThreadLocal<Pair<MapRequest, TransportAddress>> tlsMapRequest = new ThreadLocal<Pair<MapRequest, TransportAddress>>();
private OdlLispSbService lispSB = null;
}
}
- public MapNotify handleMapRegister(MapRegister mapRegister) {
+ public Pair<MapNotify, List<TransportAddress>> handleMapRegister(MapRegister mapRegister) {
LOG.debug("DAO: Adding mapping for {}",
LispAddressStringifier.getString(mapRegister.getMappingRecordItem().get(0)
.getMappingRecord().getEid()));
return tlsMapNotify.get();
}
- public MapNotify handleMapRegister(MapRegister mapRegister, boolean smr) {
+ public Pair<MapNotify, List<TransportAddress>> handleMapRegister(MapRegister mapRegister, boolean smr) {
LOG.debug("DAO: Adding mapping for {}",
LispAddressStringifier.getString(mapRegister.getMappingRecordItem().get(0)
.getMappingRecord().getEid()));
return shouldAuthenticate;
}
+ private void sendMapNotify(MapNotify mapNotify, TransportAddress address) {
+ SendMapNotifyInputBuilder smnib = new SendMapNotifyInputBuilder();
+ smnib.setMapNotify(new MapNotifyBuilder(mapNotify).build());
+ smnib.setTransportAddress(address);
+ getLispSB().sendMapNotify(smnib.build());
+ }
+
@Override
public void onAddMapping(AddMapping mapRegisterNotification) {
- MapNotify mapNotify = handleMapRegister(mapRegisterNotification.getMapRegister());
+ Pair<MapNotify, List<TransportAddress>> result = handleMapRegister(mapRegisterNotification.getMapRegister());
+ MapNotify mapNotify = result.getLeft();
+ List<TransportAddress> rlocs = result.getRight();
if (mapNotify != null) {
- TransportAddressBuilder tab = new TransportAddressBuilder();
- tab.setIpAddress(mapRegisterNotification.getTransportAddress().getIpAddress());
- tab.setPort(new PortNumber(LispMessage.PORT_NUM));
- SendMapNotifyInputBuilder smnib = new SendMapNotifyInputBuilder();
- smnib.setMapNotify(new MapNotifyBuilder(mapNotify).build());
- smnib.setTransportAddress(tab.build());
- getLispSB().sendMapNotify(smnib.build());
+ 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.warn("got null map notify");
}
}
@Override
- public void handleMapNotify(MapNotify notify) {
- tlsMapNotify.set(notify);
+ public void handleMapNotify(MapNotify notify, List<TransportAddress> rlocs) {
+ tlsMapNotify.set(new MutablePair<MapNotify, List<TransportAddress>>(notify, rlocs));
}
@Override
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.opendaylight.lispflowmapping.interfaces.lisp.IMapNotifyHandler;
import org.opendaylight.lispflowmapping.interfaces.lisp.IMapServerAsync;
import org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingService;
+import org.opendaylight.lispflowmapping.lisp.type.LispMessage;
import org.opendaylight.lispflowmapping.lisp.util.LispAddressStringifier;
import org.opendaylight.lispflowmapping.lisp.util.LispAddressUtil;
import org.opendaylight.lispflowmapping.lisp.util.MapNotifyBuilderHelper;
import org.opendaylight.lispflowmapping.lisp.util.MapRequestUtil;
import org.opendaylight.lispflowmapping.lisp.util.SourceDestKeyHelper;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRegister;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItem;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItemBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequestBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingChange;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingChanged;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin;
authenticate = shouldAuthenticate;
}
+ @SuppressWarnings("unchecked")
public void handleMapRegister(MapRegister mapRegister) {
boolean failed = false;
boolean updated = false;
if (!failed && BooleanUtils.isTrue(mapRegister.isWantMapNotify())) {
LOG.trace("MapRegister wants MapNotify");
MapNotifyBuilder builder = new MapNotifyBuilder();
+ List<TransportAddress> rlocs = null;
if (ConfigIni.getInstance().mappingMergeIsSet()) {
- List<MappingRecordItem> mappings = new ArrayList<MappingRecordItem>();
+ Set<IpAddress> notifyRlocs = new HashSet<IpAddress>();
+ List<MappingRecordItem> mergedMappings = new ArrayList<MappingRecordItem>();
for (MappingRecordItem record : mapRegister.getMappingRecordItem()) {
MappingRecord mapping = record.getMappingRecord();
MappingRecord currentRecord = (MappingRecord) mapService.getMapping(MappingOrigin.Southbound,
mapping.getEid());
- mappings.add(new MappingRecordItemBuilder().setMappingRecord(currentRecord).build());
+ mergedMappings.add(new MappingRecordItemBuilder().setMappingRecord(currentRecord).build());
+ Set<IpAddress> sourceRlocs = (Set<IpAddress>) mapService.getData(MappingOrigin.Southbound,
+ mapping.getEid(), SubKeys.SRC_RLOCS);
+ notifyRlocs.addAll(sourceRlocs);
}
- MapNotifyBuilderHelper.setFromMapRegisterAndMappingRecordItems(builder, mapRegister, mappings);
+ MapNotifyBuilderHelper.setFromMapRegisterAndMappingRecordItems(builder, mapRegister, mergedMappings);
+ rlocs = getTransportAddresses(notifyRlocs);
} else {
MapNotifyBuilderHelper.setFromMapRegister(builder, mapRegister);
}
builder.setAuthenticationData(LispAuthenticationUtil.createAuthenticationData(builder.build(),
password));
}
- notifyHandler.handleMapNotify(builder.build());
+ notifyHandler.handleMapNotify(builder.build(), rlocs);
+ }
+ }
+
+ private static List<TransportAddress> getTransportAddresses(Set<IpAddress> addresses) {
+ List<TransportAddress> rlocs = new ArrayList<TransportAddress>();
+ for (IpAddress address : addresses) {
+ TransportAddressBuilder tab = new TransportAddressBuilder();
+ tab.setIpAddress(address);
+ tab.setPort(new PortNumber(LispMessage.PORT_NUM));
+ rlocs.add(tab.build());
}
+ return rlocs;
}
private SiteId getSiteId(MapRegister mapRegister) {
import java.util.AbstractMap.SimpleImmutableEntry;
import java.util.ArrayList;
import java.util.Date;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.opendaylight.lispflowmapping.implementation.config.ConfigIni;
import org.opendaylight.lispflowmapping.implementation.util.MappingMergeUtil;
import org.opendaylight.lispflowmapping.interfaces.dao.SubKeys;
import org.opendaylight.lispflowmapping.interfaces.mapcache.IMapCache;
import org.opendaylight.lispflowmapping.lisp.util.MaskUtil;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.authkey.container.MappingAuthkey;
}
if (ConfigIni.getInstance().mappingMergeIsSet()) {
- SimpleImmutableEntry<MappingRecord, List<byte[]>> mergedEntry =
- MappingMergeUtil.mergeXtrIdMappings(getXtrIdMappingList(xtrIdDao));
- removeExpiredXtrIdTableEntries(xtrIdDao, mergedEntry.getValue());
- regdate = new Date(mergedEntry.getKey().getTimestamp());
+ List<byte[]> expiredMappings = new ArrayList<byte[]>();
+ Set<IpAddress> sourceRlocs = new HashSet<IpAddress>();
+ MappingRecord mergedEntry = MappingMergeUtil.mergeXtrIdMappings(getXtrIdMappingList(xtrIdDao),
+ expiredMappings, sourceRlocs);
+ removeExpiredXtrIdTableEntries(xtrIdDao, expiredMappings);
+ regdate = new Date(mergedEntry.getTimestamp());
table.put(eid, new MappingEntry<>(SubKeys.REGDATE, regdate));
- table.put(eid, new MappingEntry<>(SubKeys.RECORD, mergedEntry.getKey()));
+ table.put(eid, new MappingEntry<>(SubKeys.RECORD, mergedEntry));
+ table.put(eid, new MappingEntry<>(SubKeys.SRC_RLOCS, sourceRlocs));
} else {
table.put(eid, new MappingEntry<>(SubKeys.REGDATE, regdate));
table.put(eid, new MappingEntry<>(SubKeys.RECORD, value));
*/
package org.opendaylight.lispflowmapping.implementation.util;
-import java.util.AbstractMap.SimpleImmutableEntry;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.locatorrecords.LocatorRecord;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder;
return mrb.build();
}
- public static SimpleImmutableEntry<MappingRecord, List<byte[]>> mergeXtrIdMappings(List<Object> records) {
- List<byte[]> expiredMappings = new ArrayList<byte[]>();
+ public static MappingRecord mergeXtrIdMappings(List<Object> records, List<byte[]> expiredMappings,
+ Set<IpAddress> sourceRlocs) {
MappingRecordBuilder mrb = new MappingRecordBuilder((MappingRecord) records.get(0));
byte[] xtrId = mrb.getXtrId();
Long timestamp = mrb.getTimestamp();
// Merge record fields and locators
mergeCommonMappingRecordFields(mrb, record);
mergeLocatorRecords(mrb, record);
+
+ // Save source locator for use in Map-Notify
+ sourceRlocs.add(record.getSourceRloc());
}
mrb.setXtrId(xtrId);
mrb.setTimestamp(timestamp);
- return new SimpleImmutableEntry<MappingRecord, List<byte[]>>(mrb.build(), expiredMappings);
+ return mrb.build();
}
public static boolean timestampIsExpired(Date timestamp) {
addDefaultPutAndGetExpectations(new EidBuilder().setAddressType(NoAddressAfi.class).setAddress(
(Address) new NoAddressBuilder().setNoAddress(true).build()).build());
MapRegister mr = mapRegisterBuilder.build();
- MapNotify mapNotify = testedMapServer.handleMapRegister(mr);
+ MapNotify mapNotify = testedMapServer.handleMapRegister(mr).getLeft();
assertEquals(mr.getMappingRecordItem(), mapNotify.getMappingRecordItem());
ArrayAssert.assertEquals(mr.getAuthenticationData(), mapNotify.getAuthenticationData());
assertEquals(mr.getKeyId(), mapNotify.getKeyId());
addDefaultPutAndGetExpectations(eid);
- MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegisterBuilder.build());
+ MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegisterBuilder.build()).getLeft();
MappingRecord actualEidToLocator = mapNotify.getMappingRecordItem().get(0).getMappingRecord();
assertEquals(eid, actualEidToLocator.getEid());
addDefaultPutAndGetExpectations(newEid);
- MapNotify mapNotify = testedMapServer.handleMapRegister(mr);
+ MapNotify mapNotify = testedMapServer.handleMapRegister(mr).getLeft();
assertEquals(newEid, mapNotify.getMappingRecordItem().get(0).getMappingRecord().getEid());
ArrayAssert.assertEquals(mr.getAuthenticationData(), mapNotify.getAuthenticationData());
assertEquals(mr.getMappingRecordItem(), mapNotify.getMappingRecordItem());
MapRegister mapRegister = mapRegisterBuilder.build();
- MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegister);
+ MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegister).getLeft();
assertEquals(addr, mapNotify.getMappingRecordItem().get(0).getMappingRecord().getEid());
ArrayAssert.assertEquals(mapRegister.getAuthenticationData(), mapNotify.getAuthenticationData());
assertEquals(mapRegister.getMappingRecordItem(), mapNotify.getMappingRecordItem());
MapRegister mapRegister = mapRegisterBuilder.build();
- MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegister);
+ MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegister).getLeft();
assertEquals(addr, mapNotify.getMappingRecordItem().get(0).getMappingRecord().getEid());
ArrayAssert.assertEquals(mapRegister.getAuthenticationData(), mapNotify.getAuthenticationData());
assertEquals(mapRegister.getMappingRecordItem(), mapNotify.getMappingRecordItem());
addDefaultPutAndGetExpectations(newEid);
- MapNotify mapNotify = testedMapServer.handleMapRegister(mr);
+ MapNotify mapNotify = testedMapServer.handleMapRegister(mr).getLeft();
assertEquals(newEid, mapNotify.getMappingRecordItem().get(0).getMappingRecord().getEid());
ArrayAssert.assertEquals(mr.getAuthenticationData(), mapNotify.getAuthenticationData());
assertEquals(mr.getMappingRecordItem(), mapNotify.getMappingRecordItem());
addDefaultPutAndGetExpectations(eid);
- MapNotify mapNotify = testedMapServer.handleMapRegister(mr);
+ MapNotify mapNotify = testedMapServer.handleMapRegister(mr).getLeft();
assertEquals(eid, mapNotify.getMappingRecordItem().get(0).getMappingRecord().getEid());
ArrayAssert.assertEquals(mr.getAuthenticationData(), mapNotify.getAuthenticationData());
assertEquals(mr.getMappingRecordItem(), mapNotify.getMappingRecordItem());
MapRegister mapRegister = mapRegisterBuilder.build();
- MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegister);
+ MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegister).getLeft();
assertEquals(addr, mapNotify.getMappingRecordItem().get(0).getMappingRecord().getEid());
ArrayAssert.assertEquals(mapRegister.getAuthenticationData(), mapNotify.getAuthenticationData());
assertEquals(mapRegister.getMappingRecordItem(), mapNotify.getMappingRecordItem());
MapRegister mapRegister = mapRegisterBuilder.build();
- MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegister);
+ MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegister).getLeft();
assertEquals(addr, mapNotify.getMappingRecordItem().get(0).getMappingRecord().getEid());
ArrayAssert.assertEquals(mapRegister.getAuthenticationData(), mapNotify.getAuthenticationData());
assertEquals(mapRegister.getMappingRecordItem(), mapNotify.getMappingRecordItem());
MapRegister mapRegister = mapRegisterBuilder.build();
- MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegister);
+ MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegister).getLeft();
assertEquals(addr, mapNotify.getMappingRecordItem().get(0).getMappingRecord().getEid());
ArrayAssert.assertEquals(mapRegister.getAuthenticationData(), mapNotify.getAuthenticationData());
assertEquals(mapRegister.getMappingRecordItem(), mapNotify.getMappingRecordItem());
MapRegister mapRegister = mapRegisterBuilder.build();
- MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegister);
+ MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegister).getLeft();
assertEquals(addr, mapNotify.getMappingRecordItem().get(0).getMappingRecord().getEid());
ArrayAssert.assertEquals(mapRegister.getAuthenticationData(), mapNotify.getAuthenticationData());
assertEquals(mapRegister.getMappingRecordItem(), mapNotify.getMappingRecordItem());
MapRegister mapRegister = mapRegisterBuilder.build();
- MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegister);
+ MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegister).getLeft();
assertEquals(eid, mapNotify.getMappingRecordItem().get(0).getMappingRecord().getEid());
assertEquals(addr, mapNotify.getMappingRecordItem().get(1).getMappingRecord().getEid());
ArrayAssert.assertEquals(mapRegister.getAuthenticationData(), mapNotify.getAuthenticationData());
mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(etlrBuilder.build()).build());
mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(etlr2Builder.build()).build());
addDefaultPutAndGetExpectations(address);
- MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegisterBuilder.build());
+ MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegisterBuilder.build()).getLeft();
assertEquals(rloc1, mapNotify.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0)
.getRloc());
public void handleMapRegisterIpv4__CheckWrongPassword() throws Exception {
addGetExpectations(LispAddressUtil.asIpv4PrefixEid("153.16.254.1"), 0, 31, "bla");
- MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegisterWithAuthentication);
+ MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegisterWithAuthentication).getLeft();
assertEquals(null, mapNotify);
}
addGetExpectations(LispAddressUtil.asIpv4PrefixEid("153.16.254.1"), 0, 25, "password");
addPutExpectations(LispAddressUtil.asIpv4PrefixEid("153.16.254.1"));
- MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegisterWithAuthentication);
+ MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegisterWithAuthentication).getLeft();
assertEquals(mapRegisterWithAuthentication.getMappingRecordItem(), mapNotify.getMappingRecordItem());
assertEquals(mapRegisterWithAuthentication.getKeyId(), mapNotify.getKeyId());
assertEquals(mapRegisterWithAuthentication.getNonce(), mapNotify.getNonce());
public void handleMapRegisterIpv4__CheckNoPassword() throws Exception {
addGetExpectations(LispAddressUtil.asIpv4PrefixEid("153.16.254.1/32"), 30, 0, "password");
- MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegisterWithAuthentication);
+ MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegisterWithAuthentication).getLeft();
assertEquals(null, mapNotify);
}
public void handleMapRegisterIpv4__CheckNoreturn() throws Exception {
addGetExpectations(LispAddressUtil.asIpv4PrefixEid("153.16.254.1/32"));
- MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegisterWithAuthentication);
+ MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegisterWithAuthentication).getLeft();
assertEquals(mapNotify, null);
}
*/
package org.opendaylight.lispflowmapping.lisp.serializer;
+import java.net.Inet4Address;
import java.net.InetAddress;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import org.opendaylight.lispflowmapping.lisp.serializer.exception.LispSerializationException;
import org.opendaylight.lispflowmapping.lisp.util.ByteUtil;
import org.opendaylight.lispflowmapping.lisp.util.NumberUtil;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.IpAddressBinary;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.IpAddressBinaryBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRegister;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MessageType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder;
}
- private static IpAddressBinary getSourceRloc(InetAddress sourceRloc) {
- byte[] srcRloc;
+ private static IpAddress getSourceRloc(InetAddress sourceRloc) {
if (sourceRloc == null) {
- srcRloc = InetAddress.getLoopbackAddress().getAddress();
- } else {
- srcRloc = sourceRloc.getAddress();
+ sourceRloc = InetAddress.getLoopbackAddress();
}
- return IpAddressBinaryBuilder.getDefaultInstance(srcRloc);
+ if (sourceRloc instanceof Inet4Address) {
+ return new IpAddress(new Ipv4Address(sourceRloc.getHostAddress()));
+ } else {
+ return new IpAddress(new Ipv6Address(sourceRloc.getHostAddress()));
+ }
}
private interface Flags {
"64 bit site identifier.";
}
leaf source-rloc {
- type ip-address-binary;
+ type inet:ip-address;
description
"The Source IP address used for sending the enclosing control
packet in RLOC space.";