use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.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));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.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");
}
Aggregations