use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.IpAddressBinary in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method addressBinaryFromInet_Inet6Address.
/**
* Tests {@link LispAddressUtil#addressBinaryFromInet(InetAddress)} method with Inet6Address.
*/
@Test
public void addressBinaryFromInet_Inet6Address() throws UnknownHostException {
final InetAddress inet4Address = InetAddress.getByName(IPV6_ADDRESS_VALUE_TEST);
assertEquals(new IpAddressBinary(IPV6_ADDRESS_BINARY_TEST), LispAddressUtil.addressBinaryFromInet(inet4Address));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.IpAddressBinary in project lispflowmapping by opendaylight.
the class SimpleMapCache method addMapping.
@Override
public void addMapping(Eid key, Object value, Set<IpAddressBinary> sourceRlocs) {
Eid eid = MaskUtil.normalize(key);
ILispDAO table = getOrInstantiateVniTable(key);
table.put(eid, new MappingEntry<>(SubKeys.RECORD, value));
if (sourceRlocs != null) {
table.put(eid, new MappingEntry<>(SubKeys.SRC_RLOCS, sourceRlocs));
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.IpAddressBinary in project lispflowmapping by opendaylight.
the class MappingMergeUtil method mergeXtrIdMappings.
public static MappingData mergeXtrIdMappings(List<Object> mappingDataList, List<MappingData> expiredMappingDataList, Set<IpAddressBinary> sourceRlocs) {
MappingRecordBuilder mrb = null;
XtrId xtrId = null;
Long timestamp = Long.MAX_VALUE;
for (int i = 0; i < mappingDataList.size(); i++) {
MappingData mappingData = (MappingData) mappingDataList.get(i);
MappingRecord record = mappingData.getRecord();
// Skip expired mappings and add them to a list to be returned to the caller
if (timestampIsExpired(mappingData.getTimestamp())) {
expiredMappingDataList.add(mappingData);
continue;
}
if (mrb == null) {
mrb = new MappingRecordBuilder(record);
}
// Save the oldest valid timestamp
if (mappingData.getTimestamp().getTime() < timestamp) {
timestamp = mappingData.getTimestamp().getTime();
xtrId = mappingData.getXtrId();
}
// Merge record fields and locators
mergeCommonMappingRecordFields(mrb, record);
mergeLocatorRecords(mrb, record);
// Save source locator for use in Map-Notify
sourceRlocs.add(record.getSourceRloc());
}
if (mrb == null) {
LOG.warn("All mappings expired when merging! Unexpected!");
return null;
}
mrb.setXtrId(xtrId);
return new MappingData(mrb.build(), new Date(timestamp));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.IpAddressBinary in project lispflowmapping by opendaylight.
the class LispNotificationHelperTest method getTransportAddressFromRlocTest_withIpv6Address.
/**
* Tests {@link LispNotificationHelper#getTransportAddressFromRloc} method with Ipv6 type address.
*/
@Test
public void getTransportAddressFromRlocTest_withIpv6Address() {
final TransportAddress result = new TransportAddressBuilder().setIpAddress(new IpAddressBinary(ADDRESS_IPV6_BINARY)).setPort(new PortNumber(LispMessage.PORT_NUM)).build();
assertEquals(result, LispNotificationHelper.getTransportAddressFromRloc(RLOC_IPV6));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.IpAddressBinary in project lispflowmapping by opendaylight.
the class LispNotificationHelperTest method getTransportAddressFromRlocTest_withIpv6AddressBinary.
/**
* Tests {@link LispNotificationHelper#getTransportAddressFromRloc} method with Ipv6AddressBinary type address.
*/
@Test
public void getTransportAddressFromRlocTest_withIpv6AddressBinary() {
final TransportAddress result = new TransportAddressBuilder().setIpAddress(new IpAddressBinary(ADDRESS_IPV6_BINARY)).setPort(new PortNumber(LispMessage.PORT_NUM)).build();
assertEquals(result, LispNotificationHelper.getTransportAddressFromRloc(RLOC_IPV6_BINARY));
}
Aggregations