Search in sources :

Example 11 with MapReply

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

the class MappingServiceIntegrationTest method sendMapRegisterTwiceWithDiffrentValues.

private MapReply sendMapRegisterTwiceWithDiffrentValues(Eid eid, Rloc rloc1, Rloc rloc2) throws SocketTimeoutException {
    mapService.addAuthenticationKey(eid, NULL_AUTH_KEY);
    sleepForSeconds(1);
    MapRegister mb = createMapRegister(eid, rloc1);
    MapNotify mapNotify = lms.handleMapRegister(mb).getLeft();
    MapRequest mr = createMapRequest(eid);
    MapReply mapReply = lms.handleMapRequest(mr);
    assertEquals(mb.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc(), mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc());
    mb = createMapRegister(eid, rloc2);
    mapNotify = lms.handleMapRegister(mb).getLeft();
    assertEquals(8, mapNotify.getNonce().longValue());
    mr = createMapRequest(eid);
    sendMapRequest(mr);
    mapReply = lms.handleMapRequest(mr);
    return mapReply;
}
Also used : 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 12 with MapReply

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

the class MappingServiceIntegrationTest method mapRequestSimple.

// ------------------------------- Simple Tests ---------------------------
public void mapRequestSimple() throws SocketTimeoutException {
    cleanUP();
    // We close and bind the socket on the correct port
    if (socket != null) {
        socket.close();
    }
    socket = MappingServiceIntegrationTestUtil.initSocket(56756);
    sendPacket(mapRequestPacket);
    MapReply reply = receiveMapReply();
    assertEquals(4435248268955932168L, reply.getNonce().longValue());
    restartSocket();
}
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 13 with MapReply

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

the class MappingServiceIntegrationTest method registerAndQuery__SrcDestLCAF.

// ------------------------------- LCAF Tests ---------------------------
public void registerAndQuery__SrcDestLCAF() throws SocketTimeoutException {
    cleanUP();
    String ipPrefix = "10.20.30.200/32";
    String macString = "01:02:03:04:05:06";
    SourceDestKeyBuilder builder = new SourceDestKeyBuilder();
    builder.setSource(new SimpleAddress(new IpPrefix(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix(ipPrefix))));
    builder.setDest(new SimpleAddress(new MacAddress(macString)));
    EidBuilder eb = new EidBuilder();
    eb.setAddressType(SourceDestKeyLcaf.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.SourceDestKeyBuilder().setSourceDestKey(builder.build()).build());
    MapReply reply = registerAddressAndQuery(eb.build());
    Eid fromNetwork = reply.getMappingRecordItem().get(0).getMappingRecord().getEid();
    assertEquals(SourceDestKeyLcaf.class, fromNetwork.getAddressType());
    SourceDestKey sourceDestFromNetwork = (SourceDestKey) fromNetwork.getAddress();
    SimpleAddress receivedAddr1 = sourceDestFromNetwork.getSourceDestKey().getSource();
    SimpleAddress receivedAddr2 = sourceDestFromNetwork.getSourceDestKey().getDest();
    assertNotNull(receivedAddr1.getIpPrefix().getIpv4Prefix());
    assertNotNull(receivedAddr2.getMacAddress());
    IpPrefix receivedIP = receivedAddr1.getIpPrefix();
    MacAddress receivedMAC = receivedAddr2.getMacAddress();
    assertEquals(ipPrefix, receivedIP.getIpv4Prefix().getValue());
    assertEquals(macString, receivedMAC.getValue());
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) SourceDestKeyBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKeyBuilder) 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) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) IpPrefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix) 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) SourceDestKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)

Example 14 with MapReply

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

the class MappingServiceIntegrationTest method testMapRegisterDosntOverwritesOtherSubKeys.

public void testMapRegisterDosntOverwritesOtherSubKeys() throws SocketTimeoutException {
    cleanUP();
    Eid eid = LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32");
    SimpleAddress rloc1Value = new SimpleAddress(new IpAddress(new Ipv4Address("4.3.2.1")));
    Rloc rloc1 = LispAddressUtil.asKeyValueAddress("subkey1", rloc1Value);
    SimpleAddress rloc2Value = new SimpleAddress(new IpAddress(new Ipv4Address("4.3.2.2")));
    Rloc rloc2 = LispAddressUtil.asKeyValueAddress("subkey2", rloc2Value);
    MapReply mapReply = sendMapRegisterTwiceWithDiffrentValues(eid, rloc1, rloc2);
    assertEquals(2, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().size());
    assertEquals(rloc2, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc());
    assertEquals(rloc1, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(1).getRloc());
}
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) Rloc(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc) ItrRloc(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) 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 15 with MapReply

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

the class MappingServiceIntegrationTest method registerAndQuery__KeyValueLCAF.

public void registerAndQuery__KeyValueLCAF() throws SocketTimeoutException {
    cleanUP();
    String ipString = "10.20.30.200";
    String macString = "01:02:03:04:05:06";
    SimpleAddress addrToSend1 = new SimpleAddress(new IpAddress(new Ipv4Address(ipString)));
    SimpleAddress addrToSend2 = new SimpleAddress(new MacAddress(macString));
    Eid kv = LispAddressUtil.asKeyValueAddressEid(addrToSend1, addrToSend2);
    MapReply reply = registerAddressAndQuery(kv);
    Eid fromNetwork = reply.getMappingRecordItem().get(0).getMappingRecord().getEid();
    assertEquals(KeyValueAddressLcaf.class, fromNetwork.getAddressType());
    KeyValueAddress keyValueFromNetwork = (KeyValueAddress) fromNetwork.getAddress();
    SimpleAddress receivedAddr1 = keyValueFromNetwork.getKeyValueAddress().getKey();
    SimpleAddress receivedAddr2 = keyValueFromNetwork.getKeyValueAddress().getValue();
    assertNotNull(receivedAddr1.getIpAddress().getIpv4Address());
    assertNotNull(receivedAddr2.getMacAddress());
    Ipv4Address receivedIP = receivedAddr1.getIpAddress().getIpv4Address();
    MacAddress receivedMAC = receivedAddr2.getMacAddress();
    assertEquals(ipString, receivedIP.getValue());
    assertEquals(macString, receivedMAC.getValue());
}
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) KeyValueAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) 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)

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