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 insertSBMappings.
private void insertSBMappings(boolean negative, long iid, String... prefixes) {
LOG.debug("Adding Southbound mappings in VNI {} for prefixes: {}", iid, prefixes);
final InstanceIdType iiType = new InstanceIdType(iid);
for (String prefix : prefixes) {
MappingRecord record;
if (negative) {
record = newMappingRecordNegative(prefix, iiType);
} else {
record = newMappingRecord(prefix, iiType);
}
mapService.addMapping(MappingOrigin.Southbound, record.getEid(), null, new MappingData(record, System.currentTimeMillis()));
}
MappingServiceIntegrationTestUtil.printMapCacheState(mapService);
}
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 allowNullAuthenticationForAllIPv4.
private void allowNullAuthenticationForAllIPv4(long iid) {
final InstanceIdType iiType = new InstanceIdType(iid);
Eid allIPs = LispAddressUtil.asIpv4PrefixBinaryEid("0.0.0.0/0", iiType);
mapService.addAuthenticationKey(allIPs, NULL_AUTH_KEY);
}
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 MultiSiteScenario method assertPing.
private void assertPing(final Site srcSite, final int srcHostIndex, final Site dstSite, final int dstHostIndex, boolean expectedPingWorks, final Site... additionalSitesFromMapping) {
final MapReply mapReplyFromSrcToDst = emitMapRequestMessage(srcSite.getHost(srcHostIndex), dstSite.getHost(dstHostIndex), dstSite.getVNI());
if (checkActionAndRloc(dstSite, expectedPingWorks, mapReplyFromSrcToDst, additionalSitesFromMapping)) {
return;
}
final MapReply mapReplyFromDstToSrc = emitMapRequestMessage(dstSite.getHost(dstHostIndex), srcSite.getHost(srcHostIndex), srcSite.getVNI());
if (checkActionAndRloc(srcSite, expectedPingWorks, mapReplyFromDstToSrc)) {
return;
}
final InstanceIdType iidDst = mapReplyFromSrcToDst.getMappingRecordItem().get(0).getMappingRecord().getEid().getVirtualNetworkId();
final InstanceIdType iidSrc = mapReplyFromDstToSrc.getMappingRecordItem().get(0).getMappingRecord().getEid().getVirtualNetworkId();
final boolean isIIDEqual = iidDst.equals(iidSrc);
if (expectedPingWorks != isIIDEqual) {
fail("IID problem. Dst value " + iidDst.getValue() + ". Src value " + iidSrc.getValue() + ".");
}
}
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 LispSouthboundHandlerTest method initTests.
@SuppressWarnings("unchecked")
@BeforeClass
public static void initTests() {
akdb = Mockito.mock(AuthKeyDb.class);
Mockito.when(akdb.getAuthenticationKey(Matchers.eq(LispAddressUtil.asIpv4PrefixBinaryEid("10.10.10.10/8")))).thenReturn(new MappingAuthkeyBuilder().setKeyType(1).setKeyString("password").build());
Mockito.when(akdb.getAuthenticationKey(Matchers.eq(LispAddressUtil.asIpv6PrefixBinaryEid("2610:d0:ffff:192:0:0:0:1/128")))).thenReturn(new MappingAuthkeyBuilder().setKeyType(1).setKeyString("password").build());
Mockito.when(akdb.getAuthenticationKey(Matchers.eq(LispAddressUtil.asIpv4PrefixBinaryEid("153.16.254.1/32")))).thenReturn(new MappingAuthkeyBuilder().setKeyType(1).setKeyString("password").build());
Mockito.when(akdb.getAuthenticationKey(Matchers.eq(LispAddressUtil.asIpv4PrefixBinaryEid("125.124.123.122/8", new InstanceIdType(21L))))).thenReturn(new MappingAuthkeyBuilder().setKeyType(1).setKeyString("password").build());
Mockito.when(akdb.getAuthenticationKey(Matchers.eq(LispAddressUtil.asMacEid("0a:0b:0c:0d:0e:0f")))).thenReturn(new MappingAuthkeyBuilder().setKeyType(1).setKeyString("password").build());
Mockito.when(akdb.getAuthenticationKey(Matchers.eq(LispAddressUtil.asIpv6PrefixBinaryEid("f0f:f0f:f0f:f0f:f0f:f0f:f0f:f0f/8")))).thenReturn(new MappingAuthkeyBuilder().setKeyType(1).setKeyString("password").build());
Mockito.when(akdb.getAuthenticationKey(Matchers.eq(LispAddressUtil.asIpv4PrefixBinaryEid("172.1.1.2/32")))).thenReturn(new MappingAuthkeyBuilder().setKeyType(1).setKeyString("password").build());
akdl = Mockito.mock(AuthenticationKeyDataListener.class);
Mockito.when(akdl.authKeysForEidsUnchanged(Mockito.anyList(), Mockito.anyLong())).thenReturn(true);
}
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 testRepeatedSmr.
private void testRepeatedSmr() throws SocketTimeoutException, UnknownHostException {
cleanUP();
long timeout = ConfigIni.getInstance().getSmrTimeout();
ConfigIni.getInstance().setSmrRetryCount(5);
final InstanceIdType iid = new InstanceIdType(1L);
final Eid eid1 = LispAddressUtil.asIpv4Eid("1.1.1.1", 1L);
final Eid subscriberEid = LispAddressUtil.asIpv4Eid("2.2.2.2", 1L);
final int expectedSmrs1 = 2;
final int expectedSmrs2 = 3;
/* set auth */
final Eid eid = LispAddressUtil.asIpv4PrefixBinaryEid("0.0.0.0/0", iid);
mapService.addAuthenticationKey(eid, NULL_AUTH_KEY);
/* add subscribers */
final String subscriberSrcRloc1 = "127.0.0.3";
final String subscriberSrcRloc2 = "127.0.0.4";
final Set<Subscriber> subscriberSet1 = Sets.newHashSet(newSubscriber(subscriberEid, subscriberSrcRloc1), newSubscriber(subscriberEid, subscriberSrcRloc2));
mapService.addData(MappingOrigin.Southbound, eid1, SubKeys.SUBSCRIBERS, subscriberSet1);
final SocketReader reader1 = startSocketReader(subscriberSrcRloc1, 15000);
final SocketReader reader2 = startSocketReader(subscriberSrcRloc2, 15000);
sleepForSeconds(1);
/* add mapping */
final MappingRecord mapping1 = new MappingRecordBuilder().setEid(eid1).setTimestamp(System.currentTimeMillis()).setRecordTtl(1440).build();
mapService.addMapping(MappingOrigin.Northbound, eid1, null, new MappingData(mapping1));
sleepForMilliseconds((timeout * expectedSmrs1) - (timeout / 2));
final List<MapRequest> requests1 = processSmrPackets(reader1, subscriberSrcRloc1, expectedSmrs1);
final MapReply mapReply1 = lms.handleMapRequest(new MapRequestBuilder(requests1.get(0)).setSourceEid(new SourceEidBuilder().setEid(subscriberEid).build()).setItrRloc(Lists.newArrayList(new ItrRlocBuilder().setRloc(LispAddressUtil.asIpv4Rloc(subscriberSrcRloc1)).build())).setEidItem(Lists.newArrayList(new EidItemBuilder().setEid(eid1).build())).setSmrInvoked(true).setSmr(false).build());
// sleep to get 1 extra smr request
sleepForMilliseconds(timeout * 1);
final List<MapRequest> requests2 = processSmrPackets(reader2, subscriberSrcRloc2, expectedSmrs2);
final MapReply mapReply2 = lms.handleMapRequest(new MapRequestBuilder(requests2.get(0)).setSourceEid(new SourceEidBuilder().setEid(subscriberEid).build()).setItrRloc(Lists.newArrayList(new ItrRlocBuilder().setRloc(LispAddressUtil.asIpv4Rloc(subscriberSrcRloc2)).build())).setEidItem(Lists.newArrayList(new EidItemBuilder().setEid(eid1).build())).setSmrInvoked(true).setSmr(false).build());
sleepForSeconds(3);
assertEquals(expectedSmrs1, requests1.size());
assertEquals(expectedSmrs2, requests2.size());
assertEquals((long) mapReply1.getNonce(), (long) requests1.get(0).getNonce());
assertEquals((long) mapReply2.getNonce(), (long) requests2.get(0).getNonce());
assertNextBufferEmpty(reader1);
assertNextBufferEmpty(reader2);
reader1.stopReading();
reader2.stopReading();
}
Aggregations