Search in sources :

Example 31 with Sent

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Sent in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTest method test22SBnegativeToSBexactMatch.

/*
     * Mapping change: updating a negative southbound mapping with a positive one
     * Support status: SUPPORTED
     * Description: Simple case of updating an exact match SB prefix.
     */
private void test22SBnegativeToSBexactMatch() {
    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));
    // Updated SB mapping with different locator set for the same exact prefix
    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");
    mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.0.1/32"));
    Eid expectedPositivePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.0.0/16");
    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 32 with Sent

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Sent 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 33 with Sent

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Sent 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)

Example 34 with Sent

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Sent in project lispflowmapping by opendaylight.

the class MappingServiceIntegrationTest method test18SBnegativeToNBmoreSpecific.

/*
     * Mapping change: adding a more specific northbound mapping overlapping a less specific negative southbound mapping
     * Support status: SUPPORTED
     * Description: When a more specific NB mapping is added, the overlapping negative prefix is deleted, its
     *              subscribers notified, and then more specific negatives are created when requested.
     */
private void test18SBnegativeToNBmoreSpecific() {
    cleanUP();
    // 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 NB mapping
    insertNBMappings(1L, "192.168.1.0/24");
    // Notification is sent for the original prefix
    MappingServiceIntegrationTestUtil.checkSmr(socket, lms, mapService, 1L, "192.168.0.0");
    // The original negative should now be broken up
    mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.0.1/32"));
    expectedNegativePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.0.0/24");
    mr = mapReply.getMappingRecordItem().get(0).getMappingRecord();
    assertEquals(expectedNegativePrefix, mr.getEid());
    assertTrue(MappingRecordUtil.isNegativeMapping(mr));
    mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.64.1/32"));
    expectedNegativePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.64.0/18");
    mr = mapReply.getMappingRecordItem().get(0).getMappingRecord();
    assertEquals(expectedNegativePrefix, mr.getEid());
    assertTrue(MappingRecordUtil.isNegativeMapping(mr));
    mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.1.1/32"));
    Eid expectedPositivePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.1.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 35 with Sent

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Sent 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

ArrayList (java.util.ArrayList)8 ExecutionException (java.util.concurrent.ExecutionException)8 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)7 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)6 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)5 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)4 GotMapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply)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 UnknownHostException (java.net.UnknownHostException)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 BigInteger (java.math.BigInteger)2 InetSocketAddress (java.net.InetSocketAddress)2 Date (java.util.Date)2 PacketException (org.opendaylight.openflowplugin.libraries.liblldp.PacketException)2 BGPDocumentedException (org.opendaylight.protocol.bgp.parser.BGPDocumentedException)2 PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)2 TunnelTypeVxlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan)2 GetPortFromInterfaceOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetPortFromInterfaceOutput)2 NodeConnectorRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef)2