Search in sources :

Example 21 with InstanceIdType

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);
}
Also used : InstanceIdType(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType) MappingRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord) MappingData(org.opendaylight.lispflowmapping.lisp.type.MappingData)

Example 22 with InstanceIdType

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);
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) InstanceIdType(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType)

Example 23 with InstanceIdType

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() + ".");
    }
}
Also used : InstanceIdType(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType) MapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply)

Example 24 with InstanceIdType

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);
}
Also used : AuthKeyDb(org.opendaylight.lispflowmapping.mapcache.AuthKeyDb) InstanceIdType(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType) MappingAuthkeyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkeyBuilder) BeforeClass(org.junit.BeforeClass)

Example 25 with InstanceIdType

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();
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) MapRequest(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest) MapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply) GotMapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply) MappingRecordBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder) MapRequestBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequestBuilder) EidItemBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItemBuilder) InstanceIdType(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType) Subscriber(org.opendaylight.lispflowmapping.interfaces.dao.Subscriber) ItrRlocBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRlocBuilder) SourceEidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder) MappingRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord) MappingData(org.opendaylight.lispflowmapping.lisp.type.MappingData)

Aggregations

Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)21 EidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder)18 Test (org.junit.Test)17 InstanceIdType (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType)12 MappingData (org.opendaylight.lispflowmapping.lisp.type.MappingData)4 MapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply)4 MappingRecord (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord)4 GotMapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply)3 EidItemBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItemBuilder)3 SourceEidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder)3 MapRequestBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequestBuilder)3 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)2 Ipv4PrefixBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder)2 Ipv4AddressBinary (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.Ipv4AddressBinary)2 Ipv4PrefixBinaryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4PrefixBinaryBuilder)2 MapRequest (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)2 Preconditions (com.google.common.base.Preconditions)1 Inet4Address (java.net.Inet4Address)1 Inet6Address (java.net.Inet6Address)1 InetAddress (java.net.InetAddress)1