use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method testRecievingNonProxyOnXtrPort.
public void testRecievingNonProxyOnXtrPort() throws SocketTimeoutException, SocketException, Throwable {
cleanUP();
configLispPlugin.shouldListenOnXtrPort(true);
notificationCalled = false;
final String eid = "10.10.10.10/32";
String rloc = "127.0.0.3";
int port = LispMessage.XTR_PORT_NUM;
RlocBuilder rb = new RlocBuilder();
rb.setAddressType(ApplicationDataLcaf.class);
rb.setVirtualNetworkId(null);
rb.setAddress(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ApplicationDataBuilder().setApplicationData(new ApplicationDataBuilder().setAddress(new SimpleAddress(new IpAddress(new Ipv4Address(rloc)))).setLocalPortLow(new PortNumber(port)).build()).build());
Rloc adLcaf = rb.build();
final MapRequest mapRequest = createNonProxyMapRequest(eid, adLcaf);
((LispMappingService) lms).getNotificationService().registerNotificationListener(new XtrRequestMappingListener() {
@Override
public void onXtrRequestMapping(XtrRequestMapping notification) {
assertEquals(((Ipv4Prefix) mapRequest.getEidItem().get(0).getEid().getAddress()).getIpv4Prefix().getValue(), eid);
notificationCalled = true;
LOG.warn("notification arrived");
}
});
sendMapRequest(mapRequest, port);
for (int i = 0; i < MAX_NOTIFICATION_RETRYS; i++) {
if (notificationCalled) {
return;
} else {
LOG.warn("notification hasn't arrived, sleeping...");
Thread.sleep(500);
}
}
fail("Notification hasn't arrived");
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method registerAndQuery__SrcDestLCAF.
// ------------------------------- LCAF Tests ---------------------------
public void registerAndQuery__SrcDestLCAF() throws SocketTimeoutException {
cleanUP();
String ipPrefix = "10.20.30.200/32";
String macString = "01:02:03:04:05:06";
SourceDestKeyBuilder builder = new SourceDestKeyBuilder();
builder.setSource(new SimpleAddress(new IpPrefix(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix(ipPrefix))));
builder.setDest(new SimpleAddress(new MacAddress(macString)));
EidBuilder eb = new EidBuilder();
eb.setAddressType(SourceDestKeyLcaf.class);
eb.setVirtualNetworkId(null);
eb.setAddress(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKeyBuilder().setSourceDestKey(builder.build()).build());
MapReply reply = registerAddressAndQuery(eb.build());
Eid fromNetwork = reply.getMappingRecordItem().get(0).getMappingRecord().getEid();
assertEquals(SourceDestKeyLcaf.class, fromNetwork.getAddressType());
SourceDestKey sourceDestFromNetwork = (SourceDestKey) fromNetwork.getAddress();
SimpleAddress receivedAddr1 = sourceDestFromNetwork.getSourceDestKey().getSource();
SimpleAddress receivedAddr2 = sourceDestFromNetwork.getSourceDestKey().getDest();
assertNotNull(receivedAddr1.getIpPrefix().getIpv4Prefix());
assertNotNull(receivedAddr2.getMacAddress());
IpPrefix receivedIP = receivedAddr1.getIpPrefix();
MacAddress receivedMAC = receivedAddr2.getMacAddress();
assertEquals(ipPrefix, receivedIP.getIpv4Prefix().getValue());
assertEquals(macString, receivedMAC.getValue());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix in project lispflowmapping by opendaylight.
the class MappingMergeUtil method getIpPrefix.
private static IpPrefix getIpPrefix(Address address) {
IpPrefix ipPrefix = null;
if (address instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix) {
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix lispPrefix = (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix) address;
Ipv4Prefix inetPrefix = new Ipv4Prefix(lispPrefix.getIpv4Prefix());
ipPrefix = new IpPrefix(inetPrefix);
} else if (address instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Prefix) {
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Prefix lispPrefix = (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Prefix) address;
Ipv6Prefix inetPrefix = new Ipv6Prefix(lispPrefix.getIpv6Prefix());
ipPrefix = new IpPrefix(inetPrefix);
} else {
LOG.warn("Southbound mapping address is not an IpPrefix");
}
return ipPrefix;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix in project lispflowmapping by opendaylight.
the class MappingMergeUtilTest method computeNbSbIntersectionTest_withMaskableSourceDestKeyEIDs_Ipv4SB.
/**
* Tests {@link MappingMergeUtil#computeNbSbIntersection} method with SourceDestKey Eid address type, Ipv4Prefix
* SB Eid, Nb mask less than SB mask.
*/
@Test
public void computeNbSbIntersectionTest_withMaskableSourceDestKeyEIDs_Ipv4SB() {
MappingRecord nbMappingRecord = getDefaultMappingRecordBuilder().setEid(SOURCE_DEST_KEY_EID_1).build();
MappingRecord sbMappingRecord = getDefaultMappingRecordBuilder().setEid(IPV4_PREFIX_EID_1).build();
MappingData nbMappingData = getDefaultMappingData(nbMappingRecord);
MappingData sbMappingData = getDefaultMappingData(sbMappingRecord);
// result
final MappingData result = MappingMergeUtil.computeNbSbIntersection(nbMappingData, sbMappingData);
final Eid eid = LispAddressUtil.asSrcDstEid(IPV4_STRING_3, IPV4_STRING_1, 24, 24, 1);
assertEquals(eid, result.getRecord().getEid());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix in project lispflowmapping by opendaylight.
the class MappingServiceShell method addDefaultKeyIPv4.
@Override
public void addDefaultKeyIPv4() {
Eid eid = LispAddressUtil.toEid(new Ipv4Prefix("0.0.0.0/0"), null);
MappingAuthkey key = new MappingAuthkeyBuilder().setKeyType(1).setKeyString("password").build();
mappingService.addAuthenticationKey(eid, key);
}
Aggregations