Search in sources :

Example 31 with MapRequest

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTest method mapRequestMapRegisterAndMapRequestTestTimeout.

// ------------------- TimeOut Tests -----------
public void mapRequestMapRegisterAndMapRequestTestTimeout() throws SocketTimeoutException {
    cleanUP();
    ConfigIni.getInstance().setSmrRetryCount(0);
    Eid eid = LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32");
    mapService.addAuthenticationKey(eid, NULL_AUTH_KEY);
    sleepForSeconds(1);
    MapRequest mapRequest = MappingServiceIntegrationTestUtil.getDefaultMapRequestBuilder(eid).build();
    sendMapRequest(mapRequest);
    MapReply mapReply = receiveMapReply();
    assertEquals(4, mapReply.getNonce().longValue());
    assertEquals(0, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().size());
    MapRegister mapRegister = MappingServiceIntegrationTestUtil.getDefaultMapRegisterBuilder(eid).build();
    sendMapRegister(mapRegister);
    MapNotify mapNotify = receiveMapNotify();
    assertEquals(8, mapNotify.getNonce().longValue());
    sleepForSeconds(1);
    sendMapRequest(mapRequest);
    mapReply = receiveMapReply();
    assertEquals(4, mapReply.getNonce().longValue());
    assertEquals(MappingServiceIntegrationTestUtil.DEFAULT_IPV4_RLOC, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc());
    causeEntryToBeCleaned();
    sendMapRequest(mapRequest);
    mapReply = receiveMapReply();
    assertEquals(0, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().size());
}
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) GotMapNotify(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapNotify) MapNotify(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify) MapRegister(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRegister)

Example 32 with MapRequest

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTest method testMultipleMappings.

private void testMultipleMappings() throws UnknownHostException {
    final InstanceIdType iid = new InstanceIdType(1L);
    // prefix from the intersection of NB and SB gaps
    final String prefix1 = "1.1.127.10/32";
    // prefix with existing mapping in NB
    final String prefix2 = "1.1.200.255/32";
    final String prefix3 = "1.3.255.255/32";
    final MapRequest mapRequest = new MapRequestBuilder().setSmrInvoked(false).setEidItem(Lists.newArrayList(new EidItemBuilder().setEid(LispAddressUtil.asIpv4PrefixBinaryEid(prefix1, iid)).build(), new EidItemBuilder().setEid(LispAddressUtil.asIpv4PrefixBinaryEid(prefix2, iid)).build(), new EidItemBuilder().setEid(LispAddressUtil.asIpv4PrefixBinaryEid(prefix3, iid)).build())).build();
    final MapReply mapReply = lms.handleMapRequest(mapRequest);
    // expected result
    final String resultPrefix1 = "1.1.64.0";
    final Address resultNegMapping1 = new Ipv4PrefixBinaryBuilder().setIpv4AddressBinary(new Ipv4AddressBinary(InetAddress.getByName(resultPrefix1).getAddress())).setIpv4MaskLength((short) 18).build();
    final String resultPrefix2 = "1.1.128.0";
    final Address resultMapping2 = new Ipv4PrefixBinaryBuilder().setIpv4AddressBinary(new Ipv4AddressBinary(InetAddress.getByName(resultPrefix2).getAddress())).setIpv4MaskLength((short) 17).build();
    final String resultPrefix3 = "1.3.0.0";
    final Address resultNegMapping3 = new Ipv4PrefixBinaryBuilder().setIpv4AddressBinary(new Ipv4AddressBinary(InetAddress.getByName(resultPrefix3).getAddress())).setIpv4MaskLength((short) 16).build();
    assertEquals(resultNegMapping1, mapReply.getMappingRecordItem().get(0).getMappingRecord().getEid().getAddress());
    assertEquals(resultMapping2, mapReply.getMappingRecordItem().get(1).getMappingRecord().getEid().getAddress());
    assertEquals(resultNegMapping3, mapReply.getMappingRecordItem().get(2).getMappingRecord().getEid().getAddress());
}
Also used : InstanceIdType(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType) MapRequest(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest) Ipv4AddressBinary(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.Ipv4AddressBinary) InetAddress(java.net.InetAddress) Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) KeyValueAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) InetSocketAddress(java.net.InetSocketAddress) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) 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) Ipv4PrefixBinaryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4PrefixBinaryBuilder) 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)

Example 33 with MapRequest

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTest method mapRequestMapRegisterAndMapRequestTestNativelyForwardTimeoutResponse.

public void mapRequestMapRegisterAndMapRequestTestNativelyForwardTimeoutResponse() throws Exception {
    cleanUP();
    Eid eid = LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32");
    MapRequest mapRequest = createMapRequest(eid);
    testTTLBeforeRegister(mapRequest);
    registerForTTL(eid);
    testTTLAfterRegister(mapRequest);
    causeEntryToBeCleaned();
    testTTLAfterClean(mapRequest);
// northboundAddKey();
// testTTLAfterAutherize(mapRequest);
}
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)

Example 34 with MapRequest

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTest method createNonProxyMapRequest.

private MapRequest createNonProxyMapRequest(String eid, Rloc adLcaf) throws SocketTimeoutException {
    MapRegister mr = createMapRegister(LispAddressUtil.asIpv4PrefixBinaryEid(eid));
    LocatorRecord record = new LocatorRecordBuilder(mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0)).setRloc(adLcaf).build();
    mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().set(0, record);
    sendMapRegister(mr);
    assertMapNotifyReceived();
    MapRequest mapRequest = createMapRequest(LispAddressUtil.asIpv4PrefixBinaryEid(eid));
    MapRequestBuilder builder = new MapRequestBuilder(mapRequest);
    builder.setPitr(true);
    mapRequest = builder.build();
    return mapRequest;
}
Also used : LocatorRecordBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.locatorrecords.LocatorRecordBuilder) MapRequest(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest) MapRegister(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRegister) MapRequestBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequestBuilder) LocatorRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.locatorrecords.LocatorRecord)

Example 35 with MapRequest

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTestUtil method checkSmr.

/**
 * Read packets from the given socket until a Map-Request is found. Assert that the request is an SMR, and the
 * Source EID field contains the given IPv4 EID. Note that the source EID does not have a mask length. If a
 * reference to the LISP Mapping Service is passed, send an SMR-invoked Map-Request, to simulate what would happen
 * in the real world. If a reference to the Mapping Service is passed, the internal state of the map caches and
 * subscribers is logged.
 *
 * @param socket the receive socket
 * @param lms reference to the LISP Mapping Service, if present, an SMR-invoked Map-Request is sent in reply to the
 *            SMR
 * @param ms reference to the Mapping System, if present, the internal state of map-caches and subscribers is logged
 * @param vni the VNI for the expected EID
 * @param eids the expected EIDs, as an IPv4 string, without mask length
 */
static void checkSmr(DatagramSocket socket, IFlowMapping lms, IMappingService ms, long vni, String... eids) {
    LOG.debug("checkSmr: expecting {} SMRs: {}", eids.length, eids);
    List<MapRequest> mapRequests = receiveExpectedSmrs(socket, eids.length);
    assertNoMoreSMRs(socket, ms);
    HashMap<Eid, Integer> eidSet = prepareExpectedEids(vni, eids);
    for (MapRequest mapRequest : mapRequests) {
        LOG.trace("Solicit Map-Request: {}", mapRequest);
        Eid originalSourceEid = mapRequest.getEidItem().get(0).getEid();
        assertEquals(DEFAULT_IPV4_EID_PREFIX, originalSourceEid);
        Eid smrEid = mapRequest.getSourceEid().getEid();
        int counterDecremented = eidSet.get(smrEid) - 1;
        if (counterDecremented < 0) {
            fail("checkSmr: SMR contains EID " + LispAddressStringifier.getString(smrEid) + ", which is not in the list of expected EIDs: " + eidSet);
        } else {
            LOG.debug("checkSmr: successfully received expected SMR for {}", LispAddressStringifier.getString(smrEid));
        }
        if (lms != null) {
            sendSMRInvokedMapRequestMessage(mapRequest, lms);
        // TODO Capture the reply to the SMR-invoked Map-Request and assert on the expected result
        }
    }
    if (ms != null) {
        printMapCacheState(ms);
    }
}
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)

Aggregations

MapRequest (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)33 Test (org.junit.Test)24 GotMapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply)11 MapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply)11 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)10 MapRequestBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder)10 ItrRlocBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRlocBuilder)9 InetAddress (java.net.InetAddress)8 EidItem (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItem)6 ItrRloc (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc)6 MapRequestBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequestBuilder)6 RlocBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder)6 GotMapNotify (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapNotify)5 MapNotify (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify)5 MapRegister (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRegister)5 EidItemBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItemBuilder)5 SourceEidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder)5 MapRequest (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequest)5 Ipv4Binary (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4Binary)4 XtrRequestMapping (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrRequestMapping)4