use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method asEid.
/**
* Tests {@link LispAddressUtil#asEid(SimpleAddress, InstanceIdType)} method.
*/
@Test
public void asEid() {
final Eid eid = LispAddressUtil.asEid(SIMPLE_ADDRESS_IPV4_TEST, INSTANCE_ID_TYPE_TEST);
assertNotNull(eid);
assertEquals(Ipv4BinaryAfi.class, eid.getAddressType());
final Ipv4Binary address = (Ipv4Binary) eid.getAddress();
assertArrayEquals(InetAddresses.forString(SIMPLE_ADDRESS_IPV4_TEST.getIpAddress().getIpv4Address().getValue()).getAddress(), address.getIpv4Binary().getValue());
assertEquals(INSTANCE_ID_TYPE_TEST, eid.getVirtualNetworkId());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType in project lispflowmapping by opendaylight.
the class LispAddressUtil method toEid.
public static Eid toEid(Ipv4Prefix prefix, InstanceIdType vni) {
EidBuilder builder = new EidBuilder();
builder.setAddressType(Ipv4PrefixAfi.class);
builder.setVirtualNetworkId(vni);
builder.setAddress((Address) new Ipv4PrefixBuilder().setIpv4Prefix(prefix).build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType in project lispflowmapping by opendaylight.
the class LispAddressUtil method asSrcDstEid.
public static Eid asSrcDstEid(String src, String dst, int smask, int dmask, long vni) {
EidBuilder builder = new EidBuilder();
builder.setAddressType(SourceDestKeyLcaf.class);
builder.setVirtualNetworkId(new InstanceIdType(Long.valueOf(vni)));
builder.setAddress(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKeyBuilder().setSourceDestKey(asSrcDst(src, dst, smask, dmask)).build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method registerAndQuery__SegmentLCAF.
public void registerAndQuery__SegmentLCAF() throws SocketTimeoutException {
cleanUP();
String ipString = "10.20.255.30";
int instanceId = 6;
EidBuilder eb = new EidBuilder();
eb.setAddressType(Ipv4PrefixAfi.class);
eb.setVirtualNetworkId(new InstanceIdType((long) instanceId));
eb.setAddress(new Ipv4PrefixBuilder().setIpv4Prefix(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix(ipString)).build());
MapReply reply = registerAddressAndQuery(eb.build());
Eid receivedAddress = reply.getMappingRecordItem().get(0).getMappingRecord().getEid();
assertEquals(Ipv4PrefixAfi.class, receivedAddress.getAddressType());
assertEquals(ipString, ((Ipv4Prefix) receivedAddress.getAddress()).getIpv4Prefix().getValue());
assertEquals(instanceId, receivedAddress.getVirtualNetworkId().getValue().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method timedOutMappingRecord.
private void timedOutMappingRecord() {
cleanUP();
mapService.setMappingMerge(true);
// mapping expires after 1 second
ConfigIni.getInstance().setRegistrationValiditySb(1000L);
final Eid eid = LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32", new InstanceIdType(10L));
final MappingRecord mappingRecord = MappingServiceIntegrationTestUtil.getDefaultMappingRecordBuilder(eid).setRecordTtl(1000).build();
mapService.addAuthenticationKey(eid, NULL_AUTH_KEY);
mapService.addMapping(MappingOrigin.Southbound, eid, MappingServiceIntegrationTestUtil.DEFAULT_SITE_ID, new MappingData(mappingRecord, System.currentTimeMillis()));
sleepForSeconds(2);
MappingRecord resultRecord = (MappingRecord) mapService.getMapping(MappingOrigin.Southbound, eid);
assertNull(resultRecord);
ConfigIni.getInstance().setRegistrationValiditySb(ConfigIni.getInstance().getDefaultRegistrationValiditySb());
}
Aggregations