use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress in project lispflowmapping by opendaylight.
the class SourceDestKeySerializer method deserializeData.
private Address deserializeData(ByteBuffer buffer, LispAddressSerializerContext ctx) {
// reserved bytes
buffer.getShort();
short srcMaskLength = (short) ByteUtil.getUnsignedByte(buffer);
short dstMaskLength = (short) ByteUtil.getUnsignedByte(buffer);
ctx.setMaskLen(srcMaskLength);
SimpleAddress srcAddress = SimpleAddressSerializer.getInstance().deserialize(buffer, ctx);
ctx.setMaskLen(dstMaskLength);
SimpleAddress dstAddress = SimpleAddressSerializer.getInstance().deserialize(buffer, ctx);
SourceDestKeyBuilder sdb = new SourceDestKeyBuilder();
sdb.setSource(srcAddress);
sdb.setDest(dstAddress);
return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKeyBuilder().setSourceDestKey(sdb.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method registerAndQuery__ListLCAF.
public void registerAndQuery__ListLCAF() throws SocketTimeoutException {
cleanUP();
String macString = "01:02:03:04:05:06";
String ipString = "10.20.255.30";
List<SimpleAddress> addresses = new ArrayList<SimpleAddress>();
addresses.add(new SimpleAddress(new IpAddress(new Ipv4Address(ipString))));
addresses.add(new SimpleAddress(new MacAddress(macString)));
AfiListBuilder listbuilder = new AfiListBuilder();
listbuilder.setAddressList(addresses);
EidBuilder eb = new EidBuilder();
eb.setAddressType(AfiListLcaf.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.AfiListBuilder().setAfiList(listbuilder.build()).build());
MapReply reply = registerAddressAndQuery(eb.build());
Eid receivedAddress = reply.getMappingRecordItem().get(0).getMappingRecord().getEid();
assertEquals(AfiListLcaf.class, receivedAddress.getAddressType());
AfiList listAddrFromNetwork = (AfiList) receivedAddress.getAddress();
SimpleAddress receivedAddr1 = (SimpleAddress) listAddrFromNetwork.getAfiList().getAddressList().get(0);
SimpleAddress receivedAddr2 = (SimpleAddress) listAddrFromNetwork.getAfiList().getAddressList().get(1);
assertNotNull(receivedAddr1.getIpAddress().getIpv4Address());
assertNotNull(receivedAddr2.getMacAddress());
assertEquals(macString, receivedAddr2.getMacAddress().getValue());
assertEquals(ipString, receivedAddr1.getIpAddress().getIpv4Address().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method testRecievingNonProxyOnXtrPort.
public void testRecievingNonProxyOnXtrPort() throws SocketTimeoutException, SocketException, Throwable {
cleanUP();
configLispPlugin.shouldListenOnXtrPort(true);
notificationCalled = false;
final String eid = "10.10.10.10/32";
String rloc = "127.0.0.3";
int port = LispMessage.XTR_PORT_NUM;
RlocBuilder rb = new RlocBuilder();
rb.setAddressType(ApplicationDataLcaf.class);
rb.setVirtualNetworkId(null);
rb.setAddress(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ApplicationDataBuilder().setApplicationData(new ApplicationDataBuilder().setAddress(new SimpleAddress(new IpAddress(new Ipv4Address(rloc)))).setLocalPortLow(new PortNumber(port)).build()).build());
Rloc adLcaf = rb.build();
final MapRequest mapRequest = createNonProxyMapRequest(eid, adLcaf);
((LispMappingService) lms).getNotificationService().registerNotificationListener(new XtrRequestMappingListener() {
@Override
public void onXtrRequestMapping(XtrRequestMapping notification) {
assertEquals(((Ipv4Prefix) mapRequest.getEidItem().get(0).getEid().getAddress()).getIpv4Prefix().getValue(), eid);
notificationCalled = true;
LOG.warn("notification arrived");
}
});
sendMapRequest(mapRequest, port);
for (int i = 0; i < MAX_NOTIFICATION_RETRYS; i++) {
if (notificationCalled) {
return;
} else {
LOG.warn("notification hasn't arrived, sleeping...");
Thread.sleep(500);
}
}
fail("Notification hasn't arrived");
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress 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());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress 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());
}
Aggregations