Search in sources :

Example 31 with MapReply

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

the class MappingServiceIntegrationTest method registerAndQuery__ApplicationData.

public void registerAndQuery__ApplicationData() throws SocketTimeoutException {
    cleanUP();
    String ipString = "1.2.3.4";
    short protocol = 1;
    int ipTOs = 2;
    int localPortLow = 3;
    int localPortHigh = 4;
    int remotePortLow = 4;
    int remotePortHigh = 5;
    ApplicationDataBuilder builder = new ApplicationDataBuilder();
    builder.setIpTos(ipTOs);
    builder.setProtocol(protocol);
    builder.setLocalPortLow(new PortNumber(localPortLow));
    builder.setLocalPortHigh(new PortNumber(localPortHigh));
    builder.setRemotePortLow(new PortNumber(remotePortLow));
    builder.setRemotePortHigh(new PortNumber(remotePortHigh));
    builder.setAddress(new SimpleAddress(new IpAddress(new Ipv4Address(ipString))));
    EidBuilder eb = new EidBuilder();
    eb.setAddressType(ApplicationDataLcaf.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.ApplicationDataBuilder().setApplicationData(builder.build()).build());
    Eid addressToSend = eb.build();
    MapReply reply = registerAddressAndQuery(addressToSend);
    Eid receivedAddress = reply.getMappingRecordItem().get(0).getMappingRecord().getEid();
    assertEquals(ApplicationDataLcaf.class, receivedAddress.getAddressType());
    ApplicationData receivedApplicationDataAddress = (ApplicationData) receivedAddress.getAddress();
    assertEquals(protocol, receivedApplicationDataAddress.getApplicationData().getProtocol().intValue());
    assertEquals(ipTOs, receivedApplicationDataAddress.getApplicationData().getIpTos().intValue());
    assertEquals(localPortLow, receivedApplicationDataAddress.getApplicationData().getLocalPortLow().getValue().intValue());
    assertEquals(localPortHigh, receivedApplicationDataAddress.getApplicationData().getLocalPortHigh().getValue().intValue());
    assertEquals(remotePortLow, receivedApplicationDataAddress.getApplicationData().getRemotePortLow().getValue().intValue());
    assertEquals(remotePortHigh, receivedApplicationDataAddress.getApplicationData().getRemotePortHigh().getValue().intValue());
    SimpleAddress ipAddressReceived = receivedApplicationDataAddress.getApplicationData().getAddress();
    assertEquals(ipString, ipAddressReceived.getIpAddress().getIpv4Address().getValue());
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) ApplicationDataBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.application.data.ApplicationDataBuilder) 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) ApplicationData(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ApplicationData) SourceEidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 32 with MapReply

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

the class MappingServiceIntegrationTest method registerAddressAndQuery.

// takes an address, packs it in a MapRegister, sends it, returns the
// MapReply
private MapReply registerAddressAndQuery(Eid eid) throws SocketTimeoutException {
    mapService.addAuthenticationKey(eid, NULL_AUTH_KEY);
    sleepForSeconds(1);
    MapRegister mapRegister = MappingServiceIntegrationTestUtil.getDefaultMapRegisterBuilder(eid).build();
    LOG.trace("Sending Map-Register via socket: {}", mapRegister);
    sendMapRegister(mapRegister);
    MapNotify mapNotify = receiveMapNotify();
    LOG.trace("Received Map-Notify via socket: {}", mapNotify);
    assertEquals(8, mapNotify.getNonce().longValue());
    // wait for the notifications to propagate
    sleepForSeconds(1);
    MapRequest mapRequest = MappingServiceIntegrationTestUtil.getDefaultMapRequestBuilder(eid).build();
    sendMapRequest(mapRequest);
    return receiveMapReply();
}
Also used : MapRequest(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest) 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 33 with MapReply

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

the class MappingServiceIntegrationTest method test21SBnegativeToSBmoreSpecific.

/*
     * Mapping change: adding a more specific southbound mapping overlapping a less specific negative mapping
     * Support status: SUPPORTED
     * Description: When a more specific SB mapping is added, the subscribers of the overlapping less specific existing
     *              negative SB mapping are notified, the negative is deleted, and then more specific negatives are
     *              created when requested.
     */
private void test21SBnegativeToSBmoreSpecific() {
    cleanUP();
    allowNullAuthenticationForAllIPv4(1L);
    // First we add two negative mappings to NB with a hole between them
    insertNBMappings(1L, "192.167.0.0/16", "192.169.0.0/16");
    // We query for the hole, adding a negative SB mapping for 192.168.0.0/16 with a subscriber in the process
    MapReply mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.0.1/32"));
    Eid expectedNegativePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.0.0/16");
    MappingRecord mr = mapReply.getMappingRecordItem().get(0).getMappingRecord();
    assertEquals(expectedNegativePrefix, mr.getEid());
    assertTrue(MappingRecordUtil.isNegativeMapping(mr));
    // Add the more specific new overlapping SB mapping
    registerSBMapping(1L, "192.168.254.0/24", "10.10.10.10");
    // Notification is sent for the original prefix
    MappingServiceIntegrationTestUtil.checkSmr(socket, lms, mapService, 1L, "192.168.0.0");
    mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.0.1/32"));
    expectedNegativePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.0.0/17");
    mr = mapReply.getMappingRecordItem().get(0).getMappingRecord();
    assertEquals(expectedNegativePrefix, mr.getEid());
    assertTrue(MappingRecordUtil.isNegativeMapping(mr));
    mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.254.1/32"));
    Eid expectedPositivePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.254.0/24");
    mr = mapReply.getMappingRecordItem().get(0).getMappingRecord();
    assertEquals(expectedPositivePrefix, mr.getEid());
    assertTrue(MappingRecordUtil.isPositiveMapping(mr));
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) 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) MappingRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord)

Example 34 with MapReply

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

the class MappingServiceIntegrationTest method testGapIntersection.

/**
 * Tests a negative mapping from an intersection of gaps in northbound and southbound.
 */
private void testGapIntersection() throws UnknownHostException {
    // request an Eid from a gap between mappings
    final MapReply mapReply = lms.handleMapRequest(newMapRequest(1L, "1.1.127.10/32"));
    // expected negative mapping
    final Address resultNegMapping = new Ipv4PrefixBinaryBuilder().setIpv4AddressBinary(new Ipv4AddressBinary(InetAddress.getByName("1.1.64.0").getAddress())).setIpv4MaskLength((short) 18).build();
    assertEquals(resultNegMapping, mapReply.getMappingRecordItem().get(0).getMappingRecord().getEid().getAddress());
}
Also used : 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)

Example 35 with MapReply

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

the class MappingServiceIntegrationTest method test8NBtoSBexactMatch.

/*
     * Mapping change: adding a southbound mapping matching a northbound mapping
     * Support status: SUPPORTED
     * Description: When a SB mapping is added that has an existing exact match NB counterpart the subscribers of the
     *              prefix are notified. This is not strictly necessary for the NB_FIRST policy, but it is still useful
     *              for the NB_AND_SB policy.
     */
private void test8NBtoSBexactMatch() {
    cleanUP();
    allowNullAuthenticationForAllIPv4(1L);
    mapService.setLookupPolicy(IMappingService.LookupPolicy.NB_AND_SB);
    // Original NB mapping
    insertNBMapping(1L, "192.168.0.0/16", "172.16.0.1", "10.10.10.10");
    // Subscribe, by sending a Map-Request
    MapReply mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.0.1/32"));
    // Add a mapping with the same EID but different locator set in SB
    registerSBMapping(1L, "192.168.0.0/16", "10.10.10.10");
    // Notification is sent for the prefix
    MappingServiceIntegrationTestUtil.checkSmr(socket, lms, mapService, 1L, "192.168.0.0");
}
Also used : 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)

Aggregations

MapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply)44 GotMapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply)38 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)25 MappingRecord (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord)12 SimpleAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)9 SourceEidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder)9 Test (org.junit.Test)8 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)8 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)8 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)6 MapRequest (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)6 ItrRloc (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc)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 EidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder)5 EidItemBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItemBuilder)5 InstanceIdType (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType)4 MapRegister (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRegister)4 MappingRecordItem (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItem)4 MapRequestBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequestBuilder)4