</module>
<module name="TreeWalker">
- <module name="RedundantImport"/>
- <module name="UnusedImports"/>
- <module name="AvoidStarImport"/>
- <module name="NeedBraces"/>
- <module name="UpperEll"/>
- <module name="EmptyStatement"/>
- <module name="EqualsHashCode"/>
+ <module name="LineLength">
+ <property name="max" value="120"/>
+ <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
+ </module>
+ <module name="RedundantImport"/>
+ <module name="UnusedImports"/>
+ <module name="AvoidStarImport"/>
+ <module name="NeedBraces"/>
+ <module name="UpperEll"/>
+ <module name="EmptyStatement"/>
+ <module name="EqualsHashCode"/>
</module>
</module>
// 255/0
//
- mapRegisterPacketWithAuthenticationAndMapNotify = extractWSUdpByteArray(new String("0000 00 50 56 ee d1 4f 00 0c 29 7a ce 79 08 00 45 00 " //
+ mapRegisterPacketWithAuthenticationAndMapNotify = extractWSUdpByteArray(new String(
+ "0000 00 50 56 ee d1 4f 00 0c 29 7a ce 79 08 00 45 00 " //
+ "0010 00 5c 00 00 40 00 40 11 d4 db c0 a8 88 0a 80 df "
+ "0020 9c 23 d6 40 10 f6 00 48 59 a4 38 00 01 01 00 00 "
+ "0030 00 00 00 00 00 00 00 01 00 14 0e a4 c6 d8 a4 06 "
// 255/0
//
- mapRegisterPacketWithNotify = extractWSUdpByteArray(new String("0000 00 50 56 ee d1 4f 00 0c 29 7a ce 79 08 00 45 00 " //
+ mapRegisterPacketWithNotify = extractWSUdpByteArray(new String(
+ "0000 00 50 56 ee d1 4f 00 0c 29 7a ce 79 08 00 45 00 " //
+ "0010 00 5c 00 00 40 00 40 11 d4 db c0 a8 88 0a 80 df "
+ "0020 9c 23 d6 40 10 f6 00 48 59 a4 38 00 01 01 00 00 "
+ "0030 00 00 00 00 00 07 00 00 00 14 0e a4 c6 d8 a4 06 "
// 255/0
//
- mapRegisterPacketWithoutNotify = extractWSUdpByteArray(new String("0000 00 50 56 ee d1 4f 00 0c 29 7a ce 79 08 00 45 00 " //
+ mapRegisterPacketWithoutNotify = extractWSUdpByteArray(new String(
+ "0000 00 50 56 ee d1 4f 00 0c 29 7a ce 79 08 00 45 00 " //
+ "0010 00 5c 00 00 40 00 40 11 d4 db c0 a8 88 0a 80 df "
+ "0020 9c 23 d6 40 10 f6 00 48 59 a4 38 00 00 01 00 00 "
+ "0030 00 00 00 00 00 07 00 00 00 14 0e a4 c6 d8 a4 06 "
Rloc rloc2Value = LispAddressUtil.asIpv4Rloc("4.3.2.2");
MapReply mapReply = sendMapRegisterTwiceWithDiffrentValues(eid, rloc1Value, rloc2Value);
assertEquals(1, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().size());
- Rloc rloc1ReturnValueContainer = mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc();
- Rloc rloc2ReturnValueContainer = mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(1).getRloc();
+ Rloc rloc1ReturnValueContainer = mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord()
+ .get(0).getRloc();
+ Rloc rloc2ReturnValueContainer = mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord()
+ .get(1).getRloc();
assertTrue((rloc1Value.equals(rloc1ReturnValueContainer) && rloc2Value.equals(rloc2ReturnValueContainer))
|| (rloc1Value.equals(rloc2ReturnValueContainer) && rloc2Value.equals(rloc1ReturnValueContainer)));
}
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());
+ 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());
private void northboundRetrieveSourceDestKey() throws Exception {
cleanUP();
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.lispsimpleaddress.primitiveaddress.Ipv4 address1 = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispsimpleaddress.primitiveaddress.Ipv4) LispAddressUtil
+ org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.lispsimpleaddress.primitiveaddress.Ipv4
+ address1 = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispsimpleaddress
+ .primitiveaddress.Ipv4) LispAddressUtil
.toPrimitive(LispAddressUtil.asIPAfiAddress("10.0.0.1"));
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.lispsimpleaddress.primitiveaddress.Ipv4 address2 = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispsimpleaddress.primitiveaddress.Ipv4) LispAddressUtil
+ org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.lispsimpleaddress.primitiveaddress.Ipv4
+ address2 = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispsimpleaddress
+ .primitiveaddress.Ipv4) LispAddressUtil
.toPrimitive(LispAddressUtil.asIPAfiAddress("10.0.0.2"));
int mask1 = 32;
int mask2 = 32;
- LcafSourceDestAddr sourceDestAddress = new LcafSourceDestAddrBuilder().setAfi(AddressFamilyNumberEnum.LCAF.getIanaCode())
+ LcafSourceDestAddr sourceDestAddress = new LcafSourceDestAddrBuilder().setAfi(
+ AddressFamilyNumberEnum.LCAF.getIanaCode())
.setLcafType((short) LispCanonicalAddressFormatEnum.SOURCE_DEST.getLispCode())
- .setSrcAddress(new SrcAddressBuilder().setPrimitiveAddress(address1).build()).setSrcMaskLength((short) mask1)
- .setDstAddress(new DstAddressBuilder().setPrimitiveAddress(address2).build()).setDstMaskLength((short) mask2).build();
+ .setSrcAddress(new SrcAddressBuilder().setPrimitiveAddress(address1).build())
+ .setSrcMaskLength((short) mask1)
+ .setDstAddress(new DstAddressBuilder().setPrimitiveAddress(address2).build())
+ .setDstMaskLength((short) mask2).build();
String pass = "asdf";
lms.addAuthenticationKey(LispAddressUtil.toContainer(sourceDestAddress), mask1, pass);
// URL url = createGetKeyIPv4URL(address1, mask1);
URL url = createGetKeySourceDestURL(address1.getIpv4Address().getAfi(),
- ((LispIpv4Address) LispAddressUtil.toAFIfromPrimitive(sourceDestAddress.getSrcAddress().getPrimitiveAddress())).getIpv4Address().getValue(), sourceDestAddress.getSrcMaskLength(),
- ((LispIpv4Address) LispAddressUtil.toAFIfromPrimitive(sourceDestAddress.getDstAddress().getPrimitiveAddress())).getIpv4Address().getValue(), sourceDestAddress.getDstMaskLength());
+ ((LispIpv4Address) LispAddressUtil.toAFIfromPrimitive(sourceDestAddress.getSrcAddress()
+ .getPrimitiveAddress())).getIpv4Address().getValue(), sourceDestAddress.getSrcMaskLength(),
+ ((LispIpv4Address) LispAddressUtil.toAFIfromPrimitive(sourceDestAddress.getDstAddress()
+ .getPrimitiveAddress())).getIpv4Address().getValue(), sourceDestAddress.getDstMaskLength());
String reply = callURL("GET", null, "application/json", null, url);
JSONTokener jt = new JSONTokener(reply);
JSONObject json = new JSONObject(jt);
mapRequestBuilder.setPitr(false);
mapRequestBuilder.setEidItem(new ArrayList<EidItem>());
mapRequestBuilder.getEidItem().add(
- new EidRecordBuilder().setMask((short) mask).setLispAddressContainer(LispAddressUtil.toContainer(eid)).build());
+ new EidRecordBuilder().setMask((short) mask).setLispAddressContainer(
+ LispAddressUtil.toContainer(eid)).build());
MapReply mapReply = lms.handleMapRequest(mapRequestBuilder.build());
LispIpv4Address retrievedRloc = (LispIpv4Address) LispAddressUtil.toAFI(
- mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getLispAddressContainer());
+ mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0)
+ .getLispAddressContainer());
assertEquals(rloc.getIpv4Address().getValue(), retrievedRloc.getIpv4Address().getValue());
}
private String createMapRegisterJSON(String key, LispIpv4Address eid, int mask, LispIpv4Address rloc) {
- String jsonString = "{ " + "\"key\" : \"" + key + "\"," + "\"mapregister\" : " + "{ " + "\"proxyMapReply\" : false, "
- + "\"eidToLocatorRecords\" : " + "[ " + "{ " + "\"authoritative\" : true," + "\"prefixGeneric\" : " + "{ " + "\"ipAddress\" : \""
- + eid.getIpv4Address().getValue() + "\"," + "\"afi\" : " + eid.getAfi().shortValue() + "}," + "\"mapVersion\" : 0,"
- + "\"maskLength\" : " + mask + ", " + "\"action\" : \"NoAction\"," + "\"locators\" : " + "[ " + "{ " + "\"multicastPriority\" : 1,"
- + "\"locatorGeneric\" : " + "{ " + "\"ipAddress\" : \"" + rloc.getIpv4Address().getValue() + "\"," + "\"afi\" : "
- + rloc.getAfi().shortValue() + "}, " + "\"routed\" : true," + "\"multicastWeight\" : 50," + "\"rlocProbed\" : false, "
- + "\"localLocator\" : false, " + "\"priority\" : 1, " + "\"weight\" : 50 " + "} " + "], " + "\"recordTtl\" : 100" + "} " + "], "
+ String jsonString = "{ " + "\"key\" : \"" + key + "\"," + "\"mapregister\" : " + "{ "
+ + "\"proxyMapReply\" : false, "
+ + "\"eidToLocatorRecords\" : " + "[ " + "{ " + "\"authoritative\" : true," + "\"prefixGeneric\" : "
+ + "{ " + "\"ipAddress\" : \""
+ + eid.getIpv4Address().getValue() + "\"," + "\"afi\" : " + eid.getAfi().shortValue() + "},"
+ + "\"mapVersion\" : 0,"
+ + "\"maskLength\" : " + mask + ", " + "\"action\" : \"NoAction\"," + "\"locators\" : " + "[ " + "{ "
+ + "\"multicastPriority\" : 1,"
+ + "\"locatorGeneric\" : " + "{ " + "\"ipAddress\" : \"" + rloc.getIpv4Address().getValue() + "\","
+ + "\"afi\" : "
+ + rloc.getAfi().shortValue() + "}, " + "\"routed\" : true," + "\"multicastWeight\" : 50,"
+ + "\"rlocProbed\" : false, "
+ + "\"localLocator\" : false, " + "\"priority\" : 1, " + "\"weight\" : 50 " + "} " + "], "
+ + "\"recordTtl\" : 100" + "} " + "], "
+ "\"nonce\" : 3," + "\"keyId\" : 0 " + "} " + "}";
return jsonString;
JSONObject json = new JSONObject(jt);
// With just one locator, locators is not a JSONArray
- String rlocRetrieved = json.getJSONArray("locators").getJSONObject(0).getJSONObject("locatorGeneric").getString("ipAddress");
+ String rlocRetrieved = json.getJSONArray("locators").getJSONObject(0).getJSONObject("locatorGeneric")
+ .getString("ipAddress");
assertEquals(rloc.getIpv4Address().getValue(), rlocRetrieved);
private void northboundRetrieveSourceDestMapping() throws Exception {
cleanUP();
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.lispsimpleaddress.primitiveaddress.Ipv4 address1 = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispsimpleaddress.primitiveaddress.Ipv4) LispAddressUtil
+ org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.lispsimpleaddress.primitiveaddress.Ipv4
+ address1 = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispsimpleaddress
+ .primitiveaddress.Ipv4) LispAddressUtil
.toPrimitive(LispAddressUtil.asIPAfiAddress("10.0.0.1"));
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.lispsimpleaddress.primitiveaddress.Ipv4 address2 = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispsimpleaddress.primitiveaddress.Ipv4) LispAddressUtil
+ org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.lispsimpleaddress.primitiveaddress.Ipv4
+ address2 = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispsimpleaddress
+ .primitiveaddress.Ipv4) LispAddressUtil
.toPrimitive(LispAddressUtil.asIPAfiAddress("10.0.0.2"));
int mask1 = 32;
int mask2 = 32;
- LcafSourceDestAddr sourceDestAddress = new LcafSourceDestAddrBuilder().setAfi(AddressFamilyNumberEnum.LCAF.getIanaCode())
+ LcafSourceDestAddr sourceDestAddress = new LcafSourceDestAddrBuilder().setAfi(
+ AddressFamilyNumberEnum.LCAF.getIanaCode())
.setLcafType((short) LispCanonicalAddressFormatEnum.SOURCE_DEST.getLispCode())
- .setSrcAddress(new SrcAddressBuilder().setPrimitiveAddress(address1).build()).setSrcMaskLength((short) mask1)
- .setDstAddress(new DstAddressBuilder().setPrimitiveAddress(address2).build()).setDstMaskLength((short) mask2).build();
+ .setSrcAddress(new SrcAddressBuilder().setPrimitiveAddress(
+ address1).build()).setSrcMaskLength((short) mask1)
+ .setDstAddress(new DstAddressBuilder().setPrimitiveAddress(
+ address2).build()).setDstMaskLength((short) mask2).build();
LispIpv4Address rloc = LispAddressUtil.asIPAfiAddress("20.0.0.2");
// Insert mapping in the database
JSONObject json = new JSONObject(jt);
// With just one locator, locators is not a JSONArray
- String rlocRetrieved = json.getJSONArray("locators").getJSONObject(0).getJSONObject("locatorGeneric").getString("ipAddress");
+ String rlocRetrieved = json.getJSONArray("locators").getJSONObject(0).getJSONObject("locatorGeneric")
+ .getString("ipAddress");
assertEquals(rloc.getIpv4Address().getValue(), rlocRetrieved);
}
private URL createGetKeyIPv4URL(LispIpv4Address address, int mask) throws MalformedURLException {
- String restUrl = String.format("http://localhost:8080/lispflowmapping/nb/v2/default/%s/0/%d/%s/%d", "key", address.getAfi().shortValue(),
+ String restUrl = String.format("http://localhost:8080/lispflowmapping/nb/v2/default/%s/0/%d/%s/%d", "key",
+ address.getAfi().shortValue(),
address.getIpv4Address().getValue(), mask);
URL url = new URL(restUrl);
return url;
}
- private URL createGetKeySourceDestURL(int afi, String srcAddress, int srcMask, String dstAddress, int dstMask) throws MalformedURLException {
- String restUrl = String.format("http://localhost:8080/lispflowmapping/nb/v2/default/%s/0/%d/%s/%d/%s/%d", "key", afi, srcAddress, srcMask,
+ private URL createGetKeySourceDestURL(int afi, String srcAddress, int srcMask, String dstAddress, int dstMask)
+ throws MalformedURLException {
+ String restUrl = String.format("http://localhost:8080/lispflowmapping/nb/v2/default/%s/0/%d/%s/%d/%s/%d",
+ "key", afi, srcAddress, srcMask,
dstAddress, dstMask);
URL url = new URL(restUrl);
return url;
}
- private URL createGetMappingSourceDestURL(int afi, String srcAddress, int srcMask, String dstAddress, int dstMask) throws MalformedURLException {
- String restUrl = String.format("http://localhost:8080/lispflowmapping/nb/v2/default/%s/0/%d/%s/%d/%s/%d", "mapping", afi, srcAddress,
+ private URL createGetMappingSourceDestURL(int afi, String srcAddress, int srcMask, String dstAddress, int dstMask)
+ throws MalformedURLException {
+ String restUrl = String.format("http://localhost:8080/lispflowmapping/nb/v2/default/%s/0/%d/%s/%d/%s/%d",
+ "mapping", afi, srcAddress,
srcMask, dstAddress, dstMask);
URL url = new URL(restUrl);
return url;
}
private URL createGetMappingIPv4URL(int iid, LispIpv4Address address, int mask) throws MalformedURLException {
- String restUrl = String.format("http://localhost:8080/lispflowmapping/nb/v2/default/%s/%d/%d/%s/%d", "mapping", iid, address.getAfi()
+ String restUrl = String.format("http://localhost:8080/lispflowmapping/nb/v2/default/%s/%d/%d/%s/%d", "mapping",
+ iid, address.getAfi()
.shortValue(), address.getIpv4Address().getValue(), mask);
URL url = new URL(restUrl);
return url;
}
private URL createDeleteMappingIPv4URL(int iid, LispIpv4Address address, int mask) throws MalformedURLException {
- String restUrl = String.format("http://localhost:8080/lispflowmapping/nb/v2/default/%s/%d/%d/%s/%d", "mapping", iid, address.getAfi()
+ String restUrl = String.format("http://localhost:8080/lispflowmapping/nb/v2/default/%s/%d/%d/%s/%d", "mapping",
+ iid, address.getAfi()
.shortValue(), address.getIpv4Address().getValue(), mask);
URL url = new URL(restUrl);
return url;
return authStringEnc;
}
- private String callURL(String method, String content, String accept, String body, URL url) throws IOException, JSONException {
+ private String callURL(String method, String content, String accept, String body, URL url) throws IOException,
+ JSONException {
String authStringEnc = createAuthenticationString();
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod(method);
public void eidPrefixLookupIPv6() throws SocketTimeoutException {
cleanUP();
- runPrefixTest(LispAddressUtil.asIpv6PrefixEid("1:2:3:4:5:6:7:8/64"), LispAddressUtil.asIpv6PrefixEid("1:2:3:4:5:1:2:3/128"),
+ runPrefixTest(LispAddressUtil.asIpv6PrefixEid("1:2:3:4:5:6:7:8/64"),
+ LispAddressUtil.asIpv6PrefixEid("1:2:3:4:5:1:2:3/128"),
LispAddressUtil.asIpv6PrefixEid("1:2:3:1:2:3:1:2/128"));
}
sendMapRequest(mapRequest.build());
MapReply mapReply = receiveMapReply();
assertEquals(4, mapReply.getNonce().longValue());
- assertEquals(record.getRloc(), mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc());
+ assertEquals(record.getRloc(), mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord()
+ .get(0).getRloc());
mapRequest.setEidItem(new ArrayList<EidItem>());
mapRequest.getEidItem().add(new EidItemBuilder().setEid(unMatchedAddress).build());
sendMapRequest(mapRequest.build());
LOG.trace("Sending this JSON to LISP server: \n" + jsonAuthData);
LOG.trace("Address: " + address);
- byte[] expectedSha = new byte[] { (byte) 146, (byte) 234, (byte) 52, (byte) 247, (byte) 186, (byte) 232, (byte) 31, (byte) 249, (byte) 87,
- (byte) 73, (byte) 234, (byte) 54, (byte) 225, (byte) 160, (byte) 129, (byte) 251, (byte) 73, (byte) 53, (byte) 196, (byte) 62 };
+ byte[] expectedSha = new byte[] { (byte) 146, (byte) 234, (byte) 52, (byte) 247, (byte) 186, (byte) 232,
+ (byte) 31, (byte) 249, (byte) 87,
+ (byte) 73, (byte) 234, (byte) 54, (byte) 225, (byte) 160, (byte) 129, (byte) 251, (byte) 73, (byte) 53,
+ (byte) 196, (byte) 62 };
byte[] zeros = new byte[20];
mapRegister.setKeyId((short) 1); // LispKeyIDEnum.SHA1.getKeyID()
mapRegister
- .setAuthenticationData(new byte[] { -15, -52, 38, -94, 125, -111, -68, -79, 68, 6, 101, 45, -1, 47, -4, -67, -113, 104, -110, -71 });
+ .setAuthenticationData(new byte[] { -15, -52, 38, -94, 125, -111, -68, -79, 68, 6, 101, 45, -1, 47, -4,
+ -67, -113, 104, -110, -71 });
sendMapRegister(mapRegister.build());
etlr.setLispAddressContainer(LispAddressUtil.toContainer(addressOutOfRange));
mapRegister
- .setAuthenticationData(new byte[] { -54, 68, -58, -91, -23, 22, -88, -31, 113, 39, 115, 78, -68, -123, -71, -14, -99, 67, -23, -73 });
+ .setAuthenticationData(new byte[] { -54, 68, -58, -91, -23, 22, -88, -31, 113, 39, 115, 78, -68, -123,
+ -71, -14, -99, 67, -23, -73 });
sendMapRegister(mapRegister.build());
assertNoPacketReceived(3000);
etlrBuilder.setLocatorRecord(new ArrayList<LocatorRecord>());
etlrBuilder.getLocatorRecord().add(recordBuilder.build());
mapRegisterBuilder.setMappingRecordItem(new ArrayList<MappingRecordItem>());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(etlrBuilder.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(
+ new MappingRecordItemBuilder().setMappingRecord(etlrBuilder.build()).build());
sendMapRegister(mapRegisterBuilder.build());
MapNotify mapNotify = receiveMapNotify();
assertEquals(8, mapNotify.getNonce().longValue());
if (srcEid != null) {
mapRequestBuilder.setSourceEid(new SourceEidBuilder().setEid(LispAddressUtil.asIpv4Eid(srcEid)).build());
} else {
- mapRequestBuilder.setSourceEid(new SourceEidBuilder().setEid(LispAddressUtil.asIpv4Eid(ourAddress)).build());
+ mapRequestBuilder.setSourceEid(new SourceEidBuilder().setEid(LispAddressUtil.asIpv4Eid(ourAddress))
+ .build());
}
mapRequestBuilder.getItrRloc().add(
new ItrRlocBuilder().setRloc(LispAddressUtil.asIpv4Rloc(ourAddress)).build());
etlrBuilder.setLocatorRecord(new ArrayList<LocatorRecord>());
etlrBuilder.getLocatorRecord().add(recordBuilder.build());
mapRegisterBuilder.setMappingRecordItem(new ArrayList<MappingRecordItem>());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(etlrBuilder.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(
+ etlrBuilder.build()).build());
sendMapRegister(mapRegisterBuilder.build());
MapNotify mapNotify = receiveMapNotify();
assertEquals(8, mapNotify.getNonce().longValue());
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.rev100924.Ipv4Prefix(ipPrefix))));
+ builder.setSource(new SimpleAddress(new IpPrefix(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
+ .ietf.inet.types.rev100924.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());
+ 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());
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());
+ 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());
EidBuilder eb = new EidBuilder();
eb.setAddressType(Ipv4PrefixAfi.class);
eb.setVirtualNetworkId(new InstanceIdType((long) instanceId));
- eb.setAddress(new Ipv4PrefixBuilder().setIpv4Prefix(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix(
- ipString)).build());
+ eb.setAddress(new Ipv4PrefixBuilder().setIpv4Prefix(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns
+ .yang.ietf.inet.types.rev100924.Ipv4Prefix(ipString)).build());
MapReply reply = registerAddressAndQuery(eb.build());
EidBuilder eb = new EidBuilder();
eb.setAddressType(ExplicitLocatorPathLcaf.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.ExplicitLocatorPathBuilder()
- .setExplicitLocatorPath(elpBuilder.build()).build());
+ eb.setAddress(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.ExplicitLocatorPathBuilder().setExplicitLocatorPath(elpBuilder.build()).build());
MapReply reply = registerAddressAndQuery(eb.build());
- assertEquals(ExplicitLocatorPathLcaf.class, reply.getMappingRecordItem().get(0).getMappingRecord().getEid().getAddressType());
+ assertEquals(ExplicitLocatorPathLcaf.class, reply.getMappingRecordItem().get(0).getMappingRecord().getEid()
+ .getAddressType());
- ExplicitLocatorPath receivedAddress = (ExplicitLocatorPath) reply.getMappingRecordItem().get(0).getMappingRecord().getEid().getAddress();
+ ExplicitLocatorPath receivedAddress = (ExplicitLocatorPath) reply.getMappingRecordItem().get(0)
+ .getMappingRecord().getEid().getAddress();
Hop receivedHop1 = (Hop) receivedAddress.getExplicitLocatorPath().getHop().get(0);
Hop receivedHop2 = (Hop) receivedAddress.getExplicitLocatorPath().getHop().get(1);
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());
+ 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);
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());
+ 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());
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()
+ 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();
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()
+ 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() {
+ ((LispMappingService) lms).getNotificationService().registerNotificationListener(
+ new XtrRequestMappingListener() {
@Override
public void onXtrRequestMapping(XtrRequestMapping notification) {
}
- private void sendProxyMapRequest(String rloc, int port, Rloc adLcaf) throws SocketTimeoutException, SocketException {
+ private void sendProxyMapRequest(String rloc, int port, Rloc adLcaf) throws SocketTimeoutException,
+ SocketException {
String eid = "10.1.0.1/32";
MapRequest mapRequest = createNonProxyMapRequest(eid, adLcaf);
sendMapRequest(mapRequest);
}
private MapRequest receiveMapRequest(DatagramSocket datagramSocket) throws SocketTimeoutException {
- return MapRequestSerializer.getInstance().deserialize(ByteBuffer.wrap(receivePacket(datagramSocket, 30000).getData()));
+ return MapRequestSerializer.getInstance().deserialize(ByteBuffer.wrap(receivePacket(
+ datagramSocket, 30000).getData()));
}
private MapNotify receiveMapNotify() throws SocketTimeoutException {
Bundle b[] = bc.getBundles();
for (Bundle element : b) {
int state = element.getState();
- LOG.trace("Bundle[" + element.getBundleId() + "]:" + element.getSymbolicName() + ",v" + element.getVersion() + ", state:"
- + stateToString(state));
+ LOG.trace("Bundle[" + element.getBundleId() + "]:" + element.getSymbolicName() + ",v"
+ + element.getVersion() + ", state:" + stateToString(state));
if (state != Bundle.ACTIVE && state != Bundle.RESOLVED) {
LOG.debug("Bundle:" + element.getSymbolicName() + " state:" + stateToString(state));
private volatile String elpPolicy = ConfigIni.getInstance().getElpPolicy();
private ThreadLocal<MapReply> tlsMapReply = new ThreadLocal<MapReply>();
- private ThreadLocal<Pair<MapNotify, List<TransportAddress>>> tlsMapNotify = new ThreadLocal<Pair<MapNotify, List<TransportAddress>>>();
- private ThreadLocal<Pair<MapRequest, TransportAddress>> tlsMapRequest = new ThreadLocal<Pair<MapRequest, TransportAddress>>();
+ private ThreadLocal<Pair<MapNotify, List<TransportAddress>>> tlsMapNotify =
+ new ThreadLocal<Pair<MapNotify, List<TransportAddress>>>();
+ private ThreadLocal<Pair<MapRequest, TransportAddress>> tlsMapRequest =
+ new ThreadLocal<Pair<MapRequest, TransportAddress>>();
private OdlLispSbService lispSB = null;
private IMapResolverAsync mapResolver;
private static void initializeMap() {
keyIDToAuthenticationMap = new HashMap<LispKeyIDEnum, ILispAuthentication>();
keyIDToAuthenticationMap.put(LispKeyIDEnum.NONE, LispNoAuthentication.getInstance());
- keyIDToAuthenticationMap.put(LispKeyIDEnum.SHA1, new LispMACAuthentication(LispKeyIDEnum.SHA1.getAuthenticationName()));
- keyIDToAuthenticationMap.put(LispKeyIDEnum.SHA256, new LispMACAuthentication(LispKeyIDEnum.SHA256.getAuthenticationName()));
+ keyIDToAuthenticationMap.put(LispKeyIDEnum.SHA1,
+ new LispMACAuthentication(LispKeyIDEnum.SHA1.getAuthenticationName()));
+ keyIDToAuthenticationMap.put(LispKeyIDEnum.SHA256,
+ new LispMACAuthentication(LispKeyIDEnum.SHA256.getAuthenticationName()));
keyIDToAuthenticationMap.put(LispKeyIDEnum.UNKNOWN, LispNoAuthentication.getInstance());
}
public static byte[] createAuthenticationData(MapNotify mapNotify, String key) {
// We assume that the key-ID is correctly set in the Map-Notify message
- ILispAuthentication authentication = LispAuthenticationFactory.getAuthentication(LispKeyIDEnum.valueOf(mapNotify.getKeyId()));
+ ILispAuthentication authentication = LispAuthenticationFactory.getAuthentication(
+ LispKeyIDEnum.valueOf(mapNotify.getKeyId()));
return authentication.getAuthenticationData(mapNotify, key);
}
mapRegisterBuffer.position(MAP_REGISTER_AND_NOTIFY_AUTHENTICATION_POSITION);
mapRegisterBuffer.put(tempAuthenticationData);
mapRegisterBuffer.position(0);
- return Arrays.equals(getAuthenticationData(mapRegisterBuffer.array(), key), mapRegister.getAuthenticationData());
+ return Arrays.equals(getAuthenticationData(mapRegisterBuffer.array(), key),
+ mapRegister.getAuthenticationData());
}
protected byte[] getAuthenticationData(byte[] data, String key) {
.setRlocProbed(record.isRlocProbed()).setWeight(record.getWeight())
.setPriority(priority).setMulticastWeight(record.getMulticastWeight())
.setMulticastPriority(record.getMulticastPriority()).setRouted(record.isRouted())
- .setRloc(LispAddressUtil.toRloc(nextHop)).setLocatorId(record.getLocatorId()).build());
+ .setRloc(LispAddressUtil.toRloc(nextHop))
+ .setLocatorId(record.getLocatorId()).build());
}
}
} catch (ClassCastException cce) {
mapSystem.removeMapping(mapping.getOrigin(), mapping.getMappingRecord().getEid());
try {
- notificationPublishService.putNotification(MSNotificationInputUtil.toMappingChanged(mapping, MappingChange.Removed));
+ notificationPublishService.putNotification(MSNotificationInputUtil.toMappingChanged(
+ mapping, MappingChange.Removed));
} catch (InterruptedException e) {
LOG.warn("Notification publication interrupted!");
}
public static InstanceIdentifier<AuthenticationKey> createAuthenticationKeyIid(Eid eid) {
Preconditions.checkNotNull(eid, "Key needs and EID entry!");
- VirtualNetworkIdentifierKey vniKey = new VirtualNetworkIdentifierKey(new VniUri(Long.toString(getLispInstanceId(eid))));
+ VirtualNetworkIdentifierKey vniKey = new VirtualNetworkIdentifierKey(new VniUri(
+ Long.toString(getLispInstanceId(eid))));
AuthenticationKeyKey authKeyKey = new AuthenticationKeyKey(new EidUri(getURIAddressString(eid)));
return InstanceIdentifier.create(MappingDatabase.class)
.child(VirtualNetworkIdentifier.class, vniKey).child(AuthenticationKey.class, authKeyKey);
public static InstanceIdentifier<Mapping> createMappingIid(Eid eid, MappingOrigin orig) {
Preconditions.checkNotNull(eid, "Mapping needs an EID entry!");
- VirtualNetworkIdentifierKey vniKey = new VirtualNetworkIdentifierKey(new VniUri(Long.toString(getLispInstanceId(eid))));
+ VirtualNetworkIdentifierKey vniKey = new VirtualNetworkIdentifierKey(new VniUri(
+ Long.toString(getLispInstanceId(eid))));
MappingKey eidKey = new MappingKey(new EidUri(getURIAddressString(eid)), orig);
return InstanceIdentifier.create(MappingDatabase.class)
.child(VirtualNetworkIdentifier.class, vniKey).child(Mapping.class, eidKey);
public static List<Mapping> getMapping(AddMapping mapRegisterNotification) {
List<Mapping> mappings = new ArrayList<Mapping>();
for (int i=0; i<mapRegisterNotification.getMapRegister().getMappingRecordItem().size(); i++) {
- MappingRecord record = mapRegisterNotification.getMapRegister().getMappingRecordItem().get(i).getMappingRecord();
+ MappingRecord record = mapRegisterNotification.getMapRegister().getMappingRecordItem().get(i)
+ .getMappingRecord();
MappingBuilder mb = new MappingBuilder();
mb.setEidUri(new EidUri(LispAddressStringifier.getURIString(
record.getEid())));
// Local RLOC: 192.168.136.10 (RLOC=0xC0A8880A), Reachable,
// Priority/Weight: 1/100, Multicast Priority/Weight: 255/0
//
- MapRegister mapRegister = MapRegisterSerializer.getInstance().deserialize(hexToByteBuffer("38 00 01 01 FF BB " //
- + "00 00 00 00 00 00 00 01 00 14 e8 f5 0b c5 c5 f2 " //
- + "b0 21 27 a8 21 41 04 f3 46 5a 5a 5b 5c 5d 00 00 " //
- + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
+ MapRegister mapRegister = MapRegisterSerializer.getInstance().deserialize(hexToByteBuffer("38 00 01 01 FF BB "
+ + "00 00 00 00 00 00 00 01 00 14 e8 f5 0b c5 c5 f2 "
+ + "b0 21 27 a8 21 41 04 f3 46 5a 5a 5b 5c 5d 00 00 "
+ + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 "
+ "ff 00 00 05 00 01 c0 a8 88 0a"), null);
assertFalse(LispAuthenticationUtil.validate(mapRegister, EID, PASSWORD));
// Local RLOC: 192.168.136.10 (RLOC=0xC0A8880A), Reachable,
// Priority/Weight: 1/100, Multicast Priority/Weight: 255/0
//
- MapRegister mapRegister = MapRegisterSerializer.getInstance().deserialize(hexToByteBuffer("38 00 01 01 FF BB " //
- + "00 00 00 00 00 00 00 01 00 14 2c 61 b9 c9 9a 20 ba d8 f5 40 d3 55 6f 5f 6e 5a b2 0a bf b5 00 00 " //
- + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
+ MapRegister mapRegister = MapRegisterSerializer.getInstance().deserialize(hexToByteBuffer("38 00 01 01 FF BB "
+ + "00 00 00 00 00 00 00 01 00 14 2c 61 b9 c9 9a 20 ba d8 f5 40 d3 55 6f 5f 6e 5a b2 0a bf b5 00 00 "
+ + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 "
+ "ff 00 00 05 00 01 c0 a8 88 0a"), null);
assertTrue(LispAuthenticationUtil.validate(mapRegister, EID, PASSWORD));
MapRegister mapRegister = MapRegisterSerializer
.getInstance()
.deserialize(
- hexToByteBuffer("38 00 01 01 FF BB " //
- + "00 00 00 00 00 00 00 02 00 20 70 30 d4 c6 10 44 0d 83 be 4d bf fd a9 8c 57 6d 68 a5 bf 32 11 c9 7b 58 c4 b9 9f 06 11 23 b9 38 00 00 " //
- + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
+ hexToByteBuffer("38 00 01 01 FF BB "
+ + "00 00 00 00 00 00 00 02 00 20 "
+ + "70 30 d4 c6 10 44 0d 83 be 4d bf fd a9 8c 57 6d "
+ + "68 a5 bf 32 11 c9 7b 58 c4 b9 9f 06 11 23 b9 38 "
+ + "00 00 "
+ + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 "
+ "ff 00 00 05 00 01 c0 a8 88 0a"), null);
assertTrue(LispAuthenticationUtil.validate(mapRegister, EID, PASSWORD));
// Local RLOC: 192.168.136.10 (RLOC=0xC0A8880A), Reachable,
// Priority/Weight: 1/100, Multicast Priority/Weight: 255/0
//
- MapRegister mapRegister = MapRegisterSerializer.getInstance().deserialize(hexToByteBuffer("38 00 01 01 FF BB " //
- + "00 00 00 00 00 00 00 00 00 00 " //
- + "00 00 " //
- + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
+ MapRegister mapRegister = MapRegisterSerializer.getInstance().deserialize(hexToByteBuffer("38 00 01 01 FF BB "
+ + "00 00 00 00 00 00 00 00 00 00 "
+ + "00 00 "
+ + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 "
+ "ff 00 00 05 00 01 c0 a8 88 0a"), null);
assertTrue(LispAuthenticationUtil.validate(mapRegister, EID, PASSWORD));
etlrBuilder.setRecordTtl(55);
mapNotifyBuilder.getMappingRecordItem().add(
new MappingRecordItemBuilder().setMappingRecord(etlrBuilder.build()).build());
- ArrayAssert.assertEquals(new byte[0], LispAuthenticationUtil.createAuthenticationData(mapNotifyBuilder.build(), "password"));
+ ArrayAssert.assertEquals(new byte[0], LispAuthenticationUtil.createAuthenticationData(mapNotifyBuilder.build(),
+ "password"));
}
}
MappingRecord eidToLocators = mapReply.getMappingRecordItem().get(0).getMappingRecord();
assertEquals(1, eidToLocators.getLocatorRecord().size());
- LocatorRecord resultLocator = mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0);
+ LocatorRecord resultLocator = mapReply.getMappingRecordItem().get(0).getMappingRecord()
+ .getLocatorRecord().get(0);
assertEquals(locator.isLocalLocator(), resultLocator.isLocalLocator());
assertEquals(locator.isRouted(), resultLocator.isRouted());
assertEquals(locator.getMulticastPriority(), resultLocator.getMulticastPriority());
recordBuilder.setEid(eid);
recordBuilder.setLocatorRecord(new ArrayList<LocatorRecord>());
recordBuilder.getLocatorRecord().add(new LocatorRecordBuilder().setRloc(rloc).build());
- recordBuilder.setAction(Action.NoAction).setMapVersion((short) 0).setAuthoritative(false).setRecordTtl(60).setMaskLength((short) 32);
+ recordBuilder.setAction(Action.NoAction).setMapVersion((short) 0).setAuthoritative(false).setRecordTtl(60)
+ .setMaskLength((short) 32);
mapRegisterBuilder.setMappingRecordItem(new ArrayList<MappingRecordItem>());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(recordBuilder.build()).build());
- mapRegisterWithAuthentication = MapRegisterSerializer.getInstance().deserialize(hexToByteBuffer("38 00 01 01 FF BB "
- //
- + "00 00 00 00 00 00 00 01 00 14 2c 61 b9 c9 9a 20 " //
- + "ba d8 f5 40 d3 55 6f 5f 6e 5a b2 0a bf b5 00 00 " //
- + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
+ .setMappingRecord(recordBuilder.build()).build());
+ mapRegisterWithAuthentication = MapRegisterSerializer.getInstance().deserialize(
+ hexToByteBuffer("38 00 01 01 FF BB "
+ + "00 00 00 00 00 00 00 01 00 14 2c 61 b9 c9 9a 20 "
+ + "ba d8 f5 40 d3 55 6f 5f 6e 5a b2 0a bf b5 00 00 "
+ + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 "
+ "ff 00 00 05 00 01 c0 a8 88 0a"), null);
mappingEntriesSaver = new ValueSaverAction<MappingEntry<?>[]>();
locatorBuilder.setPriority((short) 55);
eidToLocatorBuilder.getLocatorRecord().add(locatorBuilder.build());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(eidToLocatorBuilder.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
+ .setMappingRecord(eidToLocatorBuilder.build()).build());
addDefaultPutAndGetExpectations(eid);
LocatorRecordBuilder locator = getDefaultLocatorBuilder();
locator.setRloc(rloc);
recordBuilder.getLocatorRecord().add(locator.build());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(recordBuilder.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
+ .setMappingRecord(recordBuilder.build()).build());
mapRegisterBuilder.setWantMapNotify(true);
MapRegister mr = mapRegisterBuilder.build();
locatorBuilder.setRloc(rloc);
recordBuilder.setEid(addr).setMaskLength((short) mask);
recordBuilder.getLocatorRecord().add(locatorBuilder.build());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(recordBuilder.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
+ .setMappingRecord(recordBuilder.build()).build());
mapRegisterBuilder.setWantMapNotify(true);
addDefaultPutAndGetExpectations(addr);
locatorBuilder.setRloc(rloc);
recordBuilder.setEid(addr).setMaskLength((short) mask);
recordBuilder.getLocatorRecord().add(locatorBuilder.build());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(recordBuilder.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
+ .setMappingRecord(recordBuilder.build()).build());
mapRegisterBuilder.setWantMapNotify(true);
addDefaultPutAndGetExpectations(addr);
LocatorRecordBuilder locator = getDefaultLocatorBuilder();
locator.setRloc(rloc);
recordBuilder.getLocatorRecord().add(locator.build());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(recordBuilder.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
+ .setMappingRecord(recordBuilder.build()).build());
mapRegisterBuilder.setWantMapNotify(true);
MapRegister mr = mapRegisterBuilder.build();
LocatorRecordBuilder locator = getDefaultLocatorBuilder();
locator.setRloc(rloc);
recordBuilder.getLocatorRecord().add(locator.build());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(recordBuilder.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
+ .setMappingRecord(recordBuilder.build()).build());
mapRegisterBuilder.setWantMapNotify(true);
MapRegister mr = mapRegisterBuilder.build();
locatorBuilder.setRloc(rloc);
recordBuilder.setEid(addr).setMaskLength((short) mask);
recordBuilder.getLocatorRecord().add(locatorBuilder.build());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(recordBuilder.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
+ .setMappingRecord(recordBuilder.build()).build());
mapRegisterBuilder.setWantMapNotify(true);
addDefaultPutAndGetExpectations(addr);
locatorBuilder.setRloc(rloc);
recordBuilder.setEid(addr).setMaskLength((short) mask);
recordBuilder.getLocatorRecord().add(locatorBuilder.build());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(recordBuilder.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
+ .setMappingRecord(recordBuilder.build()).build());
mapRegisterBuilder.setWantMapNotify(true);
addDefaultPutAndGetExpectations(addr);
locatorBuilder.setRloc(rloc);
recordBuilder.setEid(addr).setMaskLength((short) mask);
recordBuilder.getLocatorRecord().add(locatorBuilder.build());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(recordBuilder.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
+ .setMappingRecord(recordBuilder.build()).build());
mapRegisterBuilder.setWantMapNotify(true);
addDefaultPutAndGetExpectations(addr);
locatorBuilder.setRloc(rloc);
recordBuilder.setEid(addr).setMaskLength((short) mask);
recordBuilder.getLocatorRecord().add(locatorBuilder.build());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(recordBuilder.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
+ .setMappingRecord(recordBuilder.build()).build());
mapRegisterBuilder.setWantMapNotify(true);
addDefaultPutAndGetExpectations(addr);
locatorBuilder.setRloc(rloc);
recordBuilder1.setEid(addr).setMaskLength((short) mask);
recordBuilder1.getLocatorRecord().add(locatorBuilder.build());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(recordBuilder0.build()).build());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(recordBuilder1.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
+ .setMappingRecord(recordBuilder0.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
+ .setMappingRecord(recordBuilder1.build()).build());
mapRegisterBuilder.setWantMapNotify(true);
addDefaultPutAndGetExpectations(eid);
recordBuilder.getLocatorRecord().add(locatorBuilder1.build());
recordBuilder.getLocatorRecord().add(locatorBuilder2.build());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(recordBuilder.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
+ .setMappingRecord(recordBuilder.build()).build());
testedMapServer.handleMapRegister(mapRegisterBuilder.build());
// LispAFIAddress rloc1 =
// LispAddressUtil.asIPv6AfiAddress("0:0:0:0:0:0:0:7");
String subkey = "bla";
- Rloc rloc1 = LispAddressUtil.asKeyValueAddress(subkey, SimpleAddressBuilder.getDefaultInstance("0:0:0:0:0:0:0:7"));
+ Rloc rloc1 = LispAddressUtil.asKeyValueAddress(subkey,
+ SimpleAddressBuilder.getDefaultInstance("0:0:0:0:0:0:0:7"));
MappingRecordBuilder recordBuilder = getDefaultMappingRecordBuilder();
recordBuilder.setEid(eid);
LocatorRecordBuilder locatorBuilder1 = getDefaultLocatorBuilder();
recordBuilder.getLocatorRecord().add(locatorBuilder1.build());
recordBuilder.getLocatorRecord().add(locatorBuilder2.build());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(recordBuilder.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
+ .setMappingRecord(recordBuilder.build()).build());
testedMapServer.handleMapRegister(mapRegisterBuilder.build());
recordBuilder.getLocatorRecord().add(locatorBuilder.build());
mapRegisterBuilder = getDefaultMapRegisterBuilder();
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(recordBuilder.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
+ .setMappingRecord(recordBuilder.build()).build());
testedMapServer.handleMapRegister(mapRegisterBuilder.build());
}
etlr2Builder.getLocatorRecord().add(
getDefaultLocatorBuilder().setPriority((short) 10)
.setRloc(LispAddressUtil.asIpv4Rloc("2.2.2.2")).build());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(etlrBuilder.build()).build());
- mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(etlr2Builder.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
+ .setMappingRecord(etlrBuilder.build()).build());
+ mapRegisterBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
+ .setMappingRecord(etlr2Builder.build()).build());
addDefaultPutAndGetExpectations(address);
MapNotify mapNotify = testedMapServer.handleMapRegister(mapRegisterBuilder.build()).getLeft();
MappingAuthkey authKey = new MappingAuthkeyBuilder().setKeyType(1).setKeyString("pass").build();
MappingEntry<MappingAuthkey> keyMappingEntry = new MappingEntry<>(SubKeys.AUTH_KEY, authKey);
Eid key = getDefaultKey();
- MappingEntry<MappingAuthkey>[] authKeys =(MappingEntry<MappingAuthkey>[]) (Arrays.asList(keyMappingEntry).toArray());
+ MappingEntry<MappingAuthkey>[] authKeys =(MappingEntry<MappingAuthkey>[])
+ (Arrays.asList(keyMappingEntry).toArray());
addDsbeAddKeyExpectation();
oneOf(dao).put(weq(key), weq(authKeys));
mapService.addAuthenticationKey(eid, authKey);
replyBuffer.put((byte) NumberUtil.asShort(record.getMulticastPriority()));
replyBuffer.put((byte) NumberUtil.asShort(record.getMulticastWeight()));
replyBuffer.position(replyBuffer.position() + Length.UNUSED_FLAGS);
- replyBuffer.put((byte) (ByteUtil.boolToBit(BooleanUtils.isTrue(record.isLocalLocator()), Flags.LOCAL_LOCATOR) | //
- ByteUtil.boolToBit(BooleanUtils.isTrue(record.isRlocProbed()), Flags.RLOC_PROBED) | //
+ replyBuffer.put((byte) (ByteUtil.boolToBit(BooleanUtils.isTrue(record.isLocalLocator()), Flags.LOCAL_LOCATOR) |
+ ByteUtil.boolToBit(BooleanUtils.isTrue(record.isRlocProbed()), Flags.RLOC_PROBED) |
ByteUtil.boolToBit(BooleanUtils.isTrue(record.isRouted()), Flags.ROUTED)));
LispAddressSerializer.getInstance().serialize(replyBuffer, record.getRloc());
}
notifyBuffer.limit(notifyBuffer.position());
return builder.build();
} catch (RuntimeException re) {
- throw new LispSerializationException("Couldn't deserialize Map-Notify (len=" + notifyBuffer.capacity() + ")", re);
+ throw new LispSerializationException("Couldn't deserialize Map-Notify (len="
+ + notifyBuffer.capacity() + ")", re);
}
}
registerBuffer.get(mapRegisterBytes);
return builder.build();
} catch (RuntimeException re) {
- throw new LispSerializationException("Couldn't deserialize Map-Register (len=" + registerBuffer.capacity() + ")", re);
+ throw new LispSerializationException("Couldn't deserialize Map-Register (len="
+ + registerBuffer.capacity() + ")", re);
}
}
| ByteUtil.boolToBit(BooleanUtils.isTrue(mapRequest.isMapDataPresent()), Flags.MAP_DATA_PRESENT)
| ByteUtil.boolToBit(BooleanUtils.isTrue(mapRequest.isProbe()), Flags.PROBE) | ByteUtil.boolToBit(
BooleanUtils.isTrue(mapRequest.isSmr()), Flags.SMR)));
- requestBuffer.put((byte) (ByteUtil.boolToBit(BooleanUtils.isTrue(mapRequest.isPitr()), Flags.PITR) | ByteUtil.boolToBit(
- BooleanUtils.isTrue(mapRequest.isSmrInvoked()), Flags.SMR_INVOKED)));
+ requestBuffer.put((byte) (ByteUtil.boolToBit(BooleanUtils.isTrue(mapRequest.isPitr()), Flags.PITR)
+ | ByteUtil.boolToBit(BooleanUtils.isTrue(mapRequest.isSmrInvoked()), Flags.SMR_INVOKED)));
if (mapRequest.getItrRloc() != null) {
int IRC = mapRequest.getItrRloc().size();
if (IRC > 0) {
}
if (builder.isMapDataPresent() && requestBuffer.hasRemaining()) {
try {
- builder.setMapReply(new org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.MapReplyBuilder().setMappingRecord(
+ builder.setMapReply(new org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105
+ .maprequest.MapReplyBuilder().setMappingRecord(
MappingRecordSerializer.getInstance().deserialize(requestBuffer)).build()).build();
} catch (RuntimeException re) {
LOG.warn("Couldn't deserialize Map-Reply encapsulated in Map-Request", re);
}
return builder.build();
} catch (RuntimeException re) {
- throw new LispSerializationException("Couldn't deserialize Map-Request (len=" + requestBuffer.capacity() + ")", re);
+ throw new LispSerializationException("Couldn't deserialize Map-Request (len="
+ + requestBuffer.capacity() + ")", re);
}
}
@Override
protected short getLcafLength(LispAddress lispAddress) {
short totalSize = 0;
- AfiList afiList = (((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiList)
- lispAddress.getAddress()).getAfiList());
+ AfiList afiList = (((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.AfiList) lispAddress.getAddress()).getAfiList());
for (SimpleAddress address : afiList.getAddressList()) {
totalSize += SimpleAddressSerializer.getInstance().getAddressSize(address);
}
@Override
protected void serializeData(ByteBuffer buffer, LispAddress lispAddress) {
- AfiList afiList = (((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiList)
- lispAddress.getAddress()).getAfiList());
+ AfiList afiList = (((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.AfiList) lispAddress.getAddress()).getAfiList());
for (SimpleAddress address : afiList.getAddressList()) {
SimpleAddressSerializer.getInstance().serialize(buffer, address);
}
length -= SimpleAddressSerializer.getInstance().getAddressSize(address);
addresses.add(address);
}
- return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiListBuilder()
- .setAfiList(new AfiListBuilder().setAddressList(addresses).build()).build();
+ return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp
+ .address.address.AfiListBuilder().setAfiList(new AfiListBuilder().setAddressList(addresses).build())
+ .build();
}
}
@Override
protected short getLcafLength(LispAddress lispAddress) {
- ApplicationData appData = ((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ApplicationData)
- lispAddress.getAddress()).getApplicationData();
+ ApplicationData appData = ((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types
+ .rev151105.lisp.address.address.ApplicationData) lispAddress.getAddress()).getApplicationData();
return (short) (Length.ALL_FIELDS + SimpleAddressSerializer.getInstance().getAddressSize(appData.getAddress()));
}
@Override
protected void serializeData(ByteBuffer buffer, LispAddress lispAddress) {
- ApplicationData appData = ((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ApplicationData)
- lispAddress.getAddress()).getApplicationData();
+ ApplicationData appData = ((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types
+ .rev151105.lisp.address.address.ApplicationData) lispAddress.getAddress()).getApplicationData();
buffer.put(ByteUtil.partialIntToByteArray(NumberUtil.asInt(appData.getIpTos()), Length.TOC));
buffer.put((byte) NumberUtil.asShort(appData.getProtocol()));
if (appData.getLocalPortLow() != null) {
}
@Override
- protected Rloc deserializeLcafRlocData(ByteBuffer buffer, byte res2, short length, LispAddressSerializerContext ctx) {
+ protected Rloc deserializeLcafRlocData(ByteBuffer buffer, byte res2, short length,
+ LispAddressSerializerContext ctx) {
RlocBuilder eb = new RlocBuilder();
eb.setAddressType(ApplicationDataLcaf.class);
eb.setVirtualNetworkId(null);
builder.setRemotePortHigh(new PortNumber(ByteUtil.asUnsignedShort(buffer.getShort())));
SimpleAddress address = SimpleAddressSerializer.getInstance().deserialize(buffer, ctx);
builder.setAddress(address);
- return 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();
+ return 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();
}
private interface Length {
for (Hop hop : elp.getExplicitLocatorPath().getHop()) {
buffer.put((byte) 0);
if (hop.getLrsBits() != null) {
- buffer.put((byte) (ByteUtil.boolToBit(BooleanUtils.isTrue(hop.getLrsBits().isLookup()), Flags.LOOKUP) | //
- ByteUtil.boolToBit(BooleanUtils.isTrue(hop.getLrsBits().isRlocProbe()), Flags.RLOC_PROBE) | //
+ buffer.put((byte) (
+ ByteUtil.boolToBit(BooleanUtils.isTrue(hop.getLrsBits().isLookup()), Flags.LOOKUP) |
+ ByteUtil.boolToBit(BooleanUtils.isTrue(hop.getLrsBits().isRlocProbe()), Flags.RLOC_PROBE) |
ByteUtil.boolToBit(BooleanUtils.isTrue(hop.getLrsBits().isStrict()), Flags.STRICT)));
} else {
buffer.put((byte) 0);
}
@Override
- protected Rloc deserializeLcafRlocData(ByteBuffer buffer, byte res2, short length, LispAddressSerializerContext ctx) {
+ protected Rloc deserializeLcafRlocData(ByteBuffer buffer, byte res2, short length,
+ LispAddressSerializerContext ctx) {
RlocBuilder rb = new RlocBuilder();
rb.setAddressType(ExplicitLocatorPathLcaf.class);
rb.setVirtualNetworkId(null);
length -= SimpleAddressSerializer.getInstance().getAddressSize(address) + 2;
hops.add(builder.build());
}
- return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPathBuilder()
+ return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.ExplicitLocatorPathBuilder()
.setExplicitLocatorPath(new ExplicitLocatorPathBuilder().setHop(hops).build()).build();
}
}
@Override
- protected Rloc deserializeLcafRlocData(ByteBuffer buffer, byte res2, short length, LispAddressSerializerContext ctx) {
+ protected Rloc deserializeLcafRlocData(ByteBuffer buffer, byte res2, short length,
+ LispAddressSerializerContext ctx) {
RlocBuilder rb = new RlocBuilder();
rb.setAddressType(KeyValueAddressLcaf.class);
rb.setVirtualNetworkId(null);
KeyValueAddressBuilder kvab = new KeyValueAddressBuilder();
kvab.setKey(keyAddress);
kvab.setValue(valueAddress);
- return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddressBuilder()
- .setKeyValueAddress(kvab.build()).build();
+ return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.KeyValueAddressBuilder().setKeyValueAddress(kvab.build()).build();
}
}
buffer.get(spi);
spb.setServicePathId(new ServicePathIdType((long) ByteUtil.getPartialInt(spi)));
spb.setServiceIndex((short) ByteUtil.getUnsignedByte(buffer));
- return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ServicePathBuilder()
- .setServicePath(spb.build()).build();
+ return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.ServicePathBuilder().setServicePath(spb.build()).build();
}
private interface Length {
protected short getLcafLength(LispAddress lispAddress) {
SourceDestKey sdk = (SourceDestKey) lispAddress.getAddress();
return (short) (Length.ALL_FIELDS
- + SimpleAddressSerializer.getInstance().getAddressSize(new SimpleAddress(sdk.getSourceDestKey().getSource()))
- + SimpleAddressSerializer.getInstance().getAddressSize(new SimpleAddress(sdk.getSourceDestKey().getDest())));
+ + SimpleAddressSerializer.getInstance().getAddressSize(
+ new SimpleAddress(sdk.getSourceDestKey().getSource()))
+ + SimpleAddressSerializer.getInstance().getAddressSize(
+ new SimpleAddress(sdk.getSourceDestKey().getDest())));
}
@Override
}
@Override
- protected Rloc deserializeLcafRlocData(ByteBuffer buffer, byte res2, short length, LispAddressSerializerContext ctx) {
+ protected Rloc deserializeLcafRlocData(ByteBuffer buffer, byte res2, short length,
+ LispAddressSerializerContext ctx) {
RlocBuilder rb = new RlocBuilder();
rb.setAddressType(SourceDestKeyLcaf.class);
rb.setVirtualNetworkId(null);
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();
+ 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();
}
private interface Length {
public static final short STARTING_SERVICE_INDEX = 255;
private static final Pattern IP4_PATTERN =
- Pattern.compile("(([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.){3}([01]?\\d\\d?|2[0-4]\\d|25[0-5])", Pattern.CASE_INSENSITIVE);
+ Pattern.compile("(([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.){3}([01]?\\d\\d?|2[0-4]\\d|25[0-5])",
+ Pattern.CASE_INSENSITIVE);
private static final Pattern IP6_PATTERN =
Pattern.compile("([0-9a-f]{1,4}:){7}([0-9a-f]){1,4}", Pattern.CASE_INSENSITIVE);
public static Address addressFromInet(InetAddress address) {
if (address instanceof Inet4Address) {
- return (Address) new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder()
- .setIpv4(IetfInetUtil.INSTANCE.ipv4AddressFor(address)).build();
+ return (Address) new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types
+ .rev151105.lisp.address.address.Ipv4Builder()
+ .setIpv4(IetfInetUtil.INSTANCE.ipv4AddressFor(address)).build();
} else if (address instanceof Inet6Address) {
- return (Address) new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Builder()
- .setIpv6(IetfInetUtil.INSTANCE.ipv6AddressFor(address)).build();
+ return (Address) new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types
+ .rev151105.lisp.address.address.Ipv6Builder()
+ .setIpv6(IetfInetUtil.INSTANCE.ipv6AddressFor(address)).build();
}
return null;
}
if (address == null) {
return null;
} else if (address.getIpv4Address() != null) {
- return (Address) new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder().setIpv4(address.getIpv4Address()).build();
+ return (Address) new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types
+ .rev151105.lisp.address.address.Ipv4Builder().setIpv4(address.getIpv4Address()).build();
} else if (address.getIpv6Address() != null) {
- return (Address) new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Builder().setIpv6(address.getIpv6Address()).build();
+ return (Address) new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types
+ .rev151105.lisp.address.address.Ipv6Builder().setIpv6(address.getIpv6Address()).build();
}
return null;
}
if (address == null) {
return null;
} else if (address.getIpv4Prefix() != null) {
- return (Address) new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder().setIpv4Prefix(address.getIpv4Prefix()).build();
+ return (Address) new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types
+ .rev151105.lisp.address.address.Ipv4PrefixBuilder().setIpv4Prefix(address.getIpv4Prefix()).build();
} else if (address.getIpv6Prefix() != null) {
- return (Address) new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6PrefixBuilder().setIpv6Prefix(address.getIpv6Prefix()).build();
+ return (Address) new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types
+ .rev151105.lisp.address.address.Ipv6PrefixBuilder().setIpv6Prefix(address.getIpv6Prefix()).build();
}
return null;
}
EidBuilder builder = new EidBuilder();
builder.setAddressType(eid.getAddressType());
builder.setVirtualNetworkId(eid.getVirtualNetworkId());
- builder.setAddress(new Ipv4PrefixBuilder().setIpv4Prefix(IetfInetUtil.INSTANCE.ipv4PrefixFor(address, mask)).build());
+ builder.setAddress(new Ipv4PrefixBuilder().setIpv4Prefix(
+ IetfInetUtil.INSTANCE.ipv4PrefixFor(address, mask)).build());
return builder.build();
}
EidBuilder builder = new EidBuilder();
builder.setAddressType(eid.getAddressType());
builder.setVirtualNetworkId(eid.getVirtualNetworkId());
- builder.setAddress(new Ipv6PrefixBuilder().setIpv6Prefix(IetfInetUtil.INSTANCE.ipv6PrefixFor(address, mask)).build());
+ builder.setAddress(new Ipv6PrefixBuilder().setIpv6Prefix(
+ IetfInetUtil.INSTANCE.ipv6PrefixFor(address, mask)).build());
return builder.build();
}
if (vni >= 0) {
eb.setVirtualNetworkId(new InstanceIdType(vni));
}
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.service.path.ServicePathBuilder spb = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.service.path.ServicePathBuilder();
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.service.path.ServicePathBuilder spb =
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.service.path.ServicePathBuilder();
spb.setServicePathId(new ServicePathIdType(servicePathId));
spb.setServiceIndex(serviceIndex);
return eb.setAddress(addressFromServicePath(spb.build())).build();
KeyValueAddressBuilder kvab = new KeyValueAddressBuilder();
kvab.setKey(key);
kvab.setValue(value);
- KeyValueAddress address = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddressBuilder()
+ KeyValueAddress address = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types
+ .rev151105.lisp.address.address.KeyValueAddressBuilder()
.setKeyValueAddress(kvab.build()).build();
EidBuilder builder = new EidBuilder();
builder.setAddressType(KeyValueAddressLcaf.class);
KeyValueAddressBuilder kvab = new KeyValueAddressBuilder();
kvab.setKey(key);
kvab.setValue(value);
- KeyValueAddress address = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddressBuilder()
+ KeyValueAddress address = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types
+ .rev151105.lisp.address.address.KeyValueAddressBuilder()
.setKeyValueAddress(kvab.build()).build();
RlocBuilder builder = new RlocBuilder();
builder.setAddressType(KeyValueAddressLcaf.class);
builder.setAddressType(SourceDestKeyLcaf.class);
builder.setVirtualNetworkId(new InstanceIdType(Long.valueOf(vni)));
builder.setAddress(
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKeyBuilder()
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.SourceDestKeyBuilder()
.setSourceDestKey(asSrcDst(src, dst, smask, dmask)).build());
return builder.build();
public static Rloc asTeLcafRloc(List<IpAddress> hopList) {
RlocBuilder teBuilder = new RlocBuilder();
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPathBuilder elpBuilder =
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPathBuilder();
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.ExplicitLocatorPathBuilder elpBuilder =
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.ExplicitLocatorPathBuilder();
ExplicitLocatorPathBuilder teAddrBuilder = new ExplicitLocatorPathBuilder();
teAddrBuilder.setHop(new ArrayList<Hop>());
for (IpAddress hop : hopList) {
*/
@Test
public void addressFromSimpleAddressTest_asIpPrefix() {
- final SimpleAddress simpleAddress = new SimpleAddress(new IpPrefix(new Ipv4Prefix(IPV4_ADDRESS_PREFIX_VALUE_TEST)));
+ final SimpleAddress simpleAddress = new SimpleAddress(new IpPrefix(new Ipv4Prefix(
+ IPV4_ADDRESS_PREFIX_VALUE_TEST)));
final Class<? extends LispAddressFamily> addressClass = LispAddressUtil.addressTypeFromSimpleAddress
(simpleAddress);
assertEquals(Ipv4PrefixAfi.class, addressClass);
final Address address = LispAddressUtil.addressFromIpPrefix(ipv4Prefix);
assertTrue(address instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.
types.rev151105.lisp.address.address.Ipv4Prefix);
- assertEquals(IPV4_ADDRESS_PREFIX_VALUE_TEST, ((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.
- address.types.rev151105.lisp.address.address.Ipv4Prefix) address).getIpv4Prefix().getValue());
+ assertEquals(IPV4_ADDRESS_PREFIX_VALUE_TEST, ((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.
+ lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix) address).getIpv4Prefix().getValue());
}
/**
*/
@Test
public void addressFromDistinguishedNameTest_withDistinguishedName() {
- final DistinguishedNameType distinguishedNameType = new DistinguishedNameType(DISTINGUISHED_NAME_TYPE_VALUE_TEST);
+ final DistinguishedNameType distinguishedNameType = new DistinguishedNameType(
+ DISTINGUISHED_NAME_TYPE_VALUE_TEST);
final Address testedAddress = LispAddressUtil.addressFromDistinguishedName(distinguishedNameType);
assertTrue(testedAddress instanceof DistinguishedName);
*/
@Test
public void asKeyValueAddress() {
- final Rloc rloc = LispAddressUtil.asKeyValueAddress(SIMPLE_ADDRESS_DISTINGUISHED_VALUE_TEST, SIMPLE_ADDRESS_B_TEST);
+ final Rloc rloc = LispAddressUtil.asKeyValueAddress(SIMPLE_ADDRESS_DISTINGUISHED_VALUE_TEST,
+ SIMPLE_ADDRESS_B_TEST);
verifyKeyValueAddress(rloc, SIMPLE_ADDRESS_DISTINGUISHED_TEST);
}
private void verifyKeyValueAddress(final LispAddress lispAddress, final SimpleAddress keyValue) {
assertEquals(KeyValueAddressLcaf.class, lispAddress.getAddressType());
assertNull(lispAddress.getVirtualNetworkId());
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address
- .address.key.value.address.KeyValueAddress keyValueAddress = ((KeyValueAddress) lispAddress.getAddress()).
- getKeyValueAddress();
+ final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.key.value.address.KeyValueAddress keyValueAddress =
+ ((KeyValueAddress) lispAddress.getAddress()).getKeyValueAddress();
assertNotNull(keyValueAddress);
assertEquals(keyValue, keyValueAddress.getKey());
assertEquals(SIMPLE_ADDRESS_B_TEST, keyValueAddress.getValue());
*/
@Test
public void asTeLcafRloc() {
- final List<IpAddress> ipAddresses = Arrays.asList(IP_ADDRESS_OBJECT_WITH_IPV4_TEST, IP_ADDRESS_OBJECT_WITH_IPV6_TEST);
+ final List<IpAddress> ipAddresses = Arrays.asList(IP_ADDRESS_OBJECT_WITH_IPV4_TEST,
+ IP_ADDRESS_OBJECT_WITH_IPV6_TEST);
final Rloc rloc = LispAddressUtil.asTeLcafRloc(ipAddresses);
assertNotNull(rloc);
assertEquals(ExplicitLocatorPathLcaf.class, rloc.getAddressType());
@Ignore /* remove when https://git.opendaylight.org/gerrit/#/c/35681/2 will be merged */
@Test
public void toIpPrefixEid() throws UnknownHostException {
- final Eid eid = LispAddressUtil.toIpPrefixEid(IP_ADDRESS_OBJECT_WITH_IPV4_TEST, INSTANCE_ID_TYPE_VALUE_SHORT_TEST);
+ final Eid eid = LispAddressUtil.toIpPrefixEid(IP_ADDRESS_OBJECT_WITH_IPV4_TEST,
+ INSTANCE_ID_TYPE_VALUE_SHORT_TEST);
verifyEidContainsIpPrefix(eid, MASK_OK_DEFAULT_IPV4_TEST);
}
mnBuilder.setNonce(6161616161L);
mnBuilder.setKeyId((short) 0x0001);
- byte[] authenticationData = new byte[] { (byte) 0x16, (byte) 0x98, (byte) 0x96, (byte) 0xeb, (byte) 0x88, (byte) 0x2d, (byte) 0x4d,
- (byte) 0x22, (byte) 0xe5, (byte) 0x8f, (byte) 0xe6, (byte) 0x89, (byte) 0x64, (byte) 0xb9, (byte) 0x17, (byte) 0xa4, (byte) 0xba,
- (byte) 0x4e, (byte) 0x8c, (byte) 0x41 };
+ byte[] authenticationData = new byte[] { (byte) 0x16, (byte) 0x98, (byte) 0x96, (byte) 0xeb, (byte) 0x88,
+ (byte) 0x2d, (byte) 0x4d, (byte) 0x22, (byte) 0xe5, (byte) 0x8f, (byte) 0xe6, (byte) 0x89, (byte) 0x64,
+ (byte) 0xb9, (byte) 0x17, (byte) 0xa4, (byte) 0xba, (byte) 0x4e, (byte) 0x8c, (byte) 0x41 };
mnBuilder.setAuthenticationData(authenticationData);
ByteBuffer bb = MapNotifySerializer.getInstance().serialize(mnBuilder.build());
mnBuilder.setNonce(6161616161L);
mnBuilder.setKeyId((short) 0x0001);
- byte[] authenticationData = new byte[] { (byte) 0x16, (byte) 0x98, (byte) 0x96, (byte) 0xeb, (byte) 0x88, (byte) 0x2d, (byte) 0x4d,
- (byte) 0x22, (byte) 0xe5, (byte) 0x8f, (byte) 0xe6, (byte) 0x89, (byte) 0x64, (byte) 0xb9, (byte) 0x17, (byte) 0xa4, (byte) 0xba,
- (byte) 0x4e, (byte) 0x8c, (byte) 0x41 };
+ byte[] authenticationData = new byte[] { (byte) 0x16, (byte) 0x98, (byte) 0x96, (byte) 0xeb, (byte) 0x88,
+ (byte) 0x2d, (byte) 0x4d, (byte) 0x22, (byte) 0xe5, (byte) 0x8f, (byte) 0xe6, (byte) 0x89, (byte) 0x64,
+ (byte) 0xb9, (byte) 0x17, (byte) 0xa4, (byte) 0xba, (byte) 0x4e, (byte) 0x8c, (byte) 0x41 };
mnBuilder.setAuthenticationData(authenticationData);
MapNotify mn = mnBuilder.build();
- ArrayAssert.assertEquals(
- MapNotifySerializer.getInstance().serialize(mn).array(),
- MapNotifySerializer.getInstance()
- .serialize(MapNotifySerializer.getInstance().deserialize(MapNotifySerializer.getInstance().serialize(mn))).array());
+ ArrayAssert.assertEquals(MapNotifySerializer.getInstance().serialize(mn).array(),
+ MapNotifySerializer.getInstance().serialize(MapNotifySerializer.getInstance()
+ .deserialize(MapNotifySerializer.getInstance().serialize(mn))).array());
}
// xTR-ID 1
// Site-ID 1
MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("48 00 00 01 FF BB "
- //
- + "00 00 00 00 00 00 00 00 00 00 00 00 " //
- + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
+ + "00 00 00 00 00 00 00 00 00 00 00 00 "
+ + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 "
+ "ff 00 00 05 00 01 c0 a8 88 0a "
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 " // xTR-ID
+ "00 00 00 00 00 00 00 01 " // Site-ID
// 192.168.136.13
//
MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("40 00 00 "
- //
+ "04 " // Record count
- + "FF BB 00 00 00 00 00 00 00 01 00 14 87 c1 33 cd " //
- + "d1 1e bc 80 fd 3e 71 11 81 17 40 74 26 25 44 bd " //
+ + "FF BB 00 00 00 00 00 00 00 01 00 14 87 c1 33 cd "
+ + "d1 1e bc 80 fd 3e 71 11 81 17 40 74 26 25 44 bd "
+ "00 00 00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " // Record
// 1
+ "ff 00 00 05 00 01 c0 a8 88 0a " // contd
@Test
public void deserialize__Locators() throws Exception {
MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("40 00 01 01 "
- //
- + "FF BB 00 00 00 00 00 00 00 01 00 14 f1 b8 ab f0 " //
- + "66 bb 2e ef 12 70 74 46 6f 6b 8e ca bf 1e 68 40 " //
- + "00 00 00 0a " //
+ + "FF BB 00 00 00 00 00 00 00 01 00 14 f1 b8 ab f0 "
+ + "66 bb 2e ef 12 70 74 46 6f 6b 8e ca bf 1e 68 40 "
+ + "00 00 00 0a "
+ "03 " // Locator Count
+ "20 10 00 00 00 00 01 99 10 fe 01 "
// Locator 1
@Test
public void deserialize__IllegalAction() throws Exception {
MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("40 00 01 01 FF BB "
- //
- + "00 00 00 00 00 00 00 01 00 14 ec 47 1e 53 25 91 " //
- + "2f 68 10 75 13 dd 2c e8 6e 3c ac 94 ed e4 00 00 " //
- + "00 0a 01 20 F0 00 00 00 00 01 99 10 fe 01 01 64 " //
+ + "00 00 00 00 00 00 00 01 00 14 ec 47 1e 53 25 91 "
+ + "2f 68 10 75 13 dd 2c e8 6e 3c ac 94 ed e4 00 00 "
+ + "00 0a 01 20 F0 00 00 00 00 01 99 10 fe 01 01 64 "
+ "ff 00 00 05 00 01 c0 a8 88 0a"));
assertEquals(1, mn.getMappingRecordItem().size());
// Priority/Weight: 1/100, Multicast Priority/Weight: 255/0
//
MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("48 00 00 01 FF BB "
- //
- + "00 00 00 00 00 00 00 00 00 14 e8 f5 0b c5 c5 f2 " //
- + "b0 21 27 a8 21 a5 68 89 ec 00 00 " //
- + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
+ + "00 00 00 00 00 00 00 00 00 14 e8 f5 0b c5 c5 f2 "
+ + "b0 21 27 a8 21 a5 68 89 ec 00 00 "
+ + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 "
+ "ff 00 00 05 00 01 c0 a8 88 0a"));
}
// Priority/Weight: 1/100, Multicast Priority/Weight: 255/0
//
MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("40 00 00 01 FF BB "
- //
- + "00 00 00 00 00 00 00 01 00 14 2c 61 b9 c9 9a 20 " //
- + "ba d8 f5 40 d3 55 6f 5f 6e 5a b2 0a bf b5 00 00 " //
- + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
+ + "00 00 00 00 00 00 00 01 00 14 2c 61 b9 c9 9a 20 "
+ + "ba d8 f5 40 d3 55 6f 5f 6e 5a b2 0a bf b5 00 00 "
+ + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 "
+ "ff 00 00 05 00 01 c0 a8 88 0a"));
assertFalse(mn.isXtrSiteIdPresent());
assertEquals(1, mn.getMappingRecordItem().size());
assertEquals(0xFFBB000000000000L, mn.getNonce().longValue());
assertEquals(0x0001, mn.getKeyId().shortValue());
- byte[] expectedAuthenticationData = { (byte) 0x2c, (byte) 0x61, (byte) 0xb9, (byte) 0xc9, (byte) 0x9a, (byte) 0x20, (byte) 0xba, (byte) 0xd8, //
- (byte) 0xf5, (byte) 0x40, (byte) 0xd3, (byte) 0x55, (byte) 0x6f, (byte) 0x5f, (byte) 0x6e, (byte) 0x5a, //
- (byte) 0xb2, (byte) 0x0a, (byte) 0xbf, (byte) 0xb5 };
+ byte[] expectedAuthenticationData = { (byte) 0x2c, (byte) 0x61, (byte) 0xb9, (byte) 0xc9, (byte) 0x9a,
+ (byte) 0x20, (byte) 0xba, (byte) 0xd8, (byte) 0xf5, (byte) 0x40, (byte) 0xd3, (byte) 0x55, (byte) 0x6f,
+ (byte) 0x5f, (byte) 0x6e, (byte) 0x5a, (byte) 0xb2, (byte) 0x0a, (byte) 0xbf, (byte) 0xb5 };
ArrayAssert.assertEquals(expectedAuthenticationData, mn.getAuthenticationData());
}
// Priority/Weight: 1/100, Multicast Priority/Weight: 255/0
//
MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("40 00 00 01 FF BB "
- //
+ "00 00 00 00 00 00 00 02 00 20 70 30 d4 c6 10 44 0d 83 be 4d bf fd a9 8c 57 6d 68 a5 bf 32 "
- //
- + "11 c9 7b 58 c4 b9 9f 06 11 23 b9 38 00 00 " //
- + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
+ + "11 c9 7b 58 c4 b9 9f 06 11 23 b9 38 00 00 "
+ + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 "
+ "ff 00 00 05 00 01 c0 a8 88 0a"));
assertFalse(mn.isXtrSiteIdPresent());
assertEquals(1, mn.getMappingRecordItem().size());
assertEquals(0xFFBB000000000000L, mn.getNonce().longValue());
assertEquals(0x0002, mn.getKeyId().shortValue());
- byte[] expectedAuthenticationData = { (byte) 0x70, (byte) 0x30, (byte) 0xd4, (byte) 0xc6, (byte) 0x10, (byte) 0x44, (byte) 0x0d, (byte) 0x83,
- (byte) 0xbe, (byte) 0x4d, (byte) 0xbf, (byte) 0xfd, (byte) 0xa9, (byte) 0x8c, (byte) 0x57, (byte) 0x6d, (byte) 0x68, (byte) 0xa5,
- (byte) 0xbf, (byte) 0x32, (byte) 0x11, (byte) 0xc9, (byte) 0x7b, (byte) 0x58, (byte) 0xc4, (byte) 0xb9, (byte) 0x9f, (byte) 0x06,
- (byte) 0x11, (byte) 0x23, (byte) 0xb9, (byte) 0x38 };
+ byte[] expectedAuthenticationData = { (byte) 0x70, (byte) 0x30, (byte) 0xd4, (byte) 0xc6, (byte) 0x10,
+ (byte) 0x44, (byte) 0x0d, (byte) 0x83, (byte) 0xbe, (byte) 0x4d, (byte) 0xbf, (byte) 0xfd, (byte) 0xa9,
+ (byte) 0x8c, (byte) 0x57, (byte) 0x6d, (byte) 0x68, (byte) 0xa5, (byte) 0xbf, (byte) 0x32, (byte) 0x11,
+ (byte) 0xc9, (byte) 0x7b, (byte) 0x58, (byte) 0xc4, (byte) 0xb9, (byte) 0x9f, (byte) 0x06, (byte) 0x11,
+ (byte) 0x23, (byte) 0xb9, (byte) 0x38 };
ArrayAssert.assertEquals(expectedAuthenticationData, mn.getAuthenticationData());
}
}
public void deserialize__SomeFlags() throws Exception {
MapReply mr = MapReplySerializer.getInstance().deserialize(hexToByteBuffer("2A 00 00 00 00 00 "
- //
+ "00 00 00 00 00 00"));
assertEquals(true, mr.isProbe());
assertEquals(false, mr.isEchoNonceEnabled());
@Test
public void deserialize__All() throws Exception {
MapReply mr = MapReplySerializer.getInstance().deserialize(hexToByteBuffer("20 00 00 02 00 00 "
- //
- + "00 00 00 00 00 02 00 00 " //
- + "00 02 02 20 00 00 00 00 " //
- + "00 01 01 02 03 04 01 02 " //
- + "03 04 00 06 00 01 0a 0a " //
- + "0a 0a 04 03 02 01 00 01 " //
- + "00 02 00 01 00 02 00 03 " //
+ + "00 00 00 00 00 02 00 00 "
+ + "00 02 02 20 00 00 00 00 "
+ + "00 01 01 02 03 04 01 02 "
+ + "03 04 00 06 00 01 0a 0a "
+ + "0a 0a 04 03 02 01 00 01 "
+ + "00 02 00 01 00 02 00 03 "
+ "00 04 00 05 00 06 00 07 00 08 00 00 00 00 00 10 30 00 00 02 00 01 04 03 00 00"));
assertEquals(2, mr.getNonce().longValue());
assertEquals("1.2.3.4/32", ((Ipv4Prefix) mr.getMappingRecordItem().get(0)
.getLocatorRecord().get(1).getRloc().getAddress()).getIpv6().getValue());
assertEquals("10.10.10.10", ((Ipv4) mr.getMappingRecordItem().get(0).getMappingRecord()
.getLocatorRecord().get(0).getRloc().getAddress()).getIpv4().getValue());
- assertEquals(1, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getPriority().byteValue());
- assertEquals(2, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getWeight().byteValue());
- assertEquals(3, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getMulticastPriority().byteValue());
- assertEquals(4, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getMulticastWeight().byteValue());
- assertEquals(4, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(1).getPriority().byteValue());
- assertEquals(3, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(1).getWeight().byteValue());
- assertEquals(2, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(1).getMulticastPriority().byteValue());
- assertEquals(1, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(1).getMulticastWeight().byteValue());
- assertEquals(true, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).isLocalLocator());
- assertEquals(true, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).isRlocProbed());
- assertEquals(false, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).isRouted());
- assertEquals(false, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(1).isLocalLocator());
- assertEquals(false, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(1).isRlocProbed());
+ assertEquals(1, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0)
+ .getPriority().byteValue());
+ assertEquals(2, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0)
+ .getWeight().byteValue());
+ assertEquals(3, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0)
+ .getMulticastPriority().byteValue());
+ assertEquals(4, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0)
+ .getMulticastWeight().byteValue());
+ assertEquals(4, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(1)
+ .getPriority().byteValue());
+ assertEquals(3, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(1)
+ .getWeight().byteValue());
+ assertEquals(2, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(1)
+ .getMulticastPriority().byteValue());
+ assertEquals(1, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(1)
+ .getMulticastWeight().byteValue());
+ assertEquals(true, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0)
+ .isLocalLocator());
+ assertEquals(true, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0)
+ .isRlocProbed());
+ assertEquals(false, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0)
+ .isRouted());
+ assertEquals(false, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(1)
+ .isLocalLocator());
+ assertEquals(false, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(1)
+ .isRlocProbed());
assertEquals(true, mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(1).isRouted());
}
assertEquals(2, packet.get(3));
packet.position(24); // EID in first record
- byte[] expected = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08 };
+ byte[] expected = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08 };
byte[] actual = new byte[16];
packet.get(actual);
ArrayAssert.assertEquals(expected, actual);
@Test
public void deserialize__MultipleRecordsWithoutRLOCs() throws Exception {
MapReply mr = MapReplySerializer.getInstance().deserialize(hexToByteBuffer("20 00 00 02 00 00 "
- //
- + "00 00 00 00 00 00 00 00 00 01 00 20 00 00 00 00 00 01 01 02 03 04 00 00 00 00 00 10 30 00 00 02 00 01 04 03 00 00"));
+ + "00 00 00 00 00 00 00 00 00 01 00 20 00 00 00 00 "
+ + "00 01 01 02 03 04 00 00 00 00 00 10 30 00 00 02 00 01 04 03 00 00"));
assertEquals("1.2.3.4/32", ((Ipv4Prefix) mr.getMappingRecordItem().get(0)
.getMappingRecord().getEid().getAddress()).getIpv4Prefix().getValue());
// XXX Why here normalized and other cases not normalized?
@Test
public void deserialize__FlagsInFirstByte() throws Exception {
MapRequest mr = MapRequestSerializer.getInstance().deserialize(hexToByteBuffer("16 00 00 01 3d 8d "
- //
- + "2a cd 39 c8 d6 08 00 00 00 01 c0 a8 88 0a 00 20 " //
+ + "2a cd 39 c8 d6 08 00 00 00 01 c0 a8 88 0a 00 20 "
+ "00 01 01 02 03 04"));
assertFalse(mr.isAuthoritative());
assertTrue(mr.isMapDataPresent());
assertFalse(mr.isSmr());
mr = MapRequestSerializer.getInstance().deserialize(hexToByteBuffer("19 00 00 01 3d 8d "
- //
- + "2a cd 39 c8 d6 08 00 00 00 01 c0 a8 88 0a 00 20 " //
+ + "2a cd 39 c8 d6 08 00 00 00 01 c0 a8 88 0a 00 20 "
+ "00 01 01 02 03 04"));
assertTrue(mr.isAuthoritative());
assertFalse(mr.isMapDataPresent());
assertTrue(mr.isSmr());
mr = MapRequestSerializer.getInstance().deserialize(hexToByteBuffer("1C 00 00 01 3d 8d "
- //
- + "2a cd 39 c8 d6 08 00 00 00 01 c0 a8 88 0a 00 20 " //
+ + "2a cd 39 c8 d6 08 00 00 00 01 c0 a8 88 0a 00 20 "
+ "00 01 01 02 03 04"));
assertTrue(mr.isAuthoritative());
assertTrue(mr.isMapDataPresent());
@Test
public void deserialize__LispMobMapRequestWithReply() throws Exception {
- MapRequest mr = MapRequestSerializer.getInstance().deserialize(hexToByteBuffer("14 00 00 01 3e f7 " //
- + "7f 5b 41 7c 77 3c 00 01 01 01 01 01 00 01 c0 a8 " //
- + "38 66 00 20 00 01 01 02 03 04 00 00 00 0a 01 20 " //
- + "10 00 00 00 00 01 01 01 01 01 01 64 ff 00 00 05 " //
+ MapRequest mr = MapRequestSerializer.getInstance().deserialize(hexToByteBuffer("14 00 00 01 3e f7 "
+ + "7f 5b 41 7c 77 3c 00 01 01 01 01 01 00 01 c0 a8 "
+ + "38 66 00 20 00 01 01 02 03 04 00 00 00 0a 01 20 "
+ + "10 00 00 00 00 01 01 01 01 01 01 64 ff 00 00 05 "
+ "00 01 c0 a8 38 66"));
assertEquals("1.1.1.1", ((Ipv4) mr.getSourceEid().getEid().getAddress()).getIpv4().getValue());
assertEquals("1.2.3.4/32",
public void serialize__EmptyMapRequest() throws Exception {
MapRequestBuilder mrBuilder = new MapRequestBuilder();
- ByteBuffer expected = hexToByteBuffer("10 00 00 00 00 00 " //
+ ByteBuffer expected = hexToByteBuffer("10 00 00 00 00 00 "
+ "00 00 00 00 00 00 00 00");
assertArrayEquals(expected.array(), MapRequestSerializer.getInstance().serialize(mrBuilder.build()).array());
}
MapRequestBuilder mrBuilder = new MapRequestBuilder();
mrBuilder.setAuthoritative(true);
mrBuilder.setProbe(true);
- ByteBuffer expected = hexToByteBuffer("1A 00 00 00 00 00 " //
+ ByteBuffer expected = hexToByteBuffer("1A 00 00 00 00 00 "
+ "00 00 00 00 00 00 00 00");
assertArrayEquals(expected.array(), MapRequestSerializer.getInstance().serialize(mrBuilder.build()).array());
mrBuilder = new MapRequestBuilder();
mrBuilder.setSmr(true);
mrBuilder.setMapDataPresent(true);
- expected = hexToByteBuffer("15 00 00 00 00 00 " //
+ expected = hexToByteBuffer("15 00 00 00 00 00 "
+ "00 00 00 00 00 00 00 00");
assertArrayEquals(expected.array(), MapRequestSerializer.getInstance().serialize(mrBuilder.build()).array());
mrBuilder.setAuthoritative(true);
mrBuilder.setProbe(true);
- expected = hexToByteBuffer("1F 00 00 00 00 00 " //
+ expected = hexToByteBuffer("1F 00 00 00 00 00 "
+ "00 00 00 00 00 00 00 00");
assertArrayEquals(expected.array(), MapRequestSerializer.getInstance().serialize(mrBuilder.build()).array());
}
MapRequestBuilder mrBuilder = new MapRequestBuilder();
mrBuilder.setPitr(true);
mrBuilder.setSmrInvoked(true);
- ByteBuffer expected = hexToByteBuffer("10 C0 00 00 00 00 " //
+ ByteBuffer expected = hexToByteBuffer("10 C0 00 00 00 00 "
+ "00 00 00 00 00 00 00 00");
assertArrayEquals(expected.array(), MapRequestSerializer.getInstance().serialize(mrBuilder.build()).array());
mrBuilder.setPitr(false);
- expected = hexToByteBuffer("10 40 00 00 00 00 " //
+ expected = hexToByteBuffer("10 40 00 00 00 00 "
+ "00 00 00 00 00 00 00 00");
assertArrayEquals(expected.array(), MapRequestSerializer.getInstance().serialize(mrBuilder.build()).array());
@Test
public void deserialize__FlagsInSecondByte() throws Exception {
MapRequest mr = MapRequestSerializer.getInstance().deserialize(hexToByteBuffer("16 80 00 01 3d 8d "
- //
- + "2a cd 39 c8 d6 08 00 00 00 01 c0 a8 88 0a 00 20 " //
+ + "2a cd 39 c8 d6 08 00 00 00 01 c0 a8 88 0a 00 20 "
+ "00 01 01 02 03 04"));
assertTrue(mr.isPitr());
assertFalse(mr.isSmrInvoked());
mr = MapRequestSerializer.getInstance().deserialize(hexToByteBuffer("19 40 00 01 3d 8d "
- //
- + "2a cd 39 c8 d6 08 00 00 00 01 c0 a8 88 0a 00 20 " //
+ + "2a cd 39 c8 d6 08 00 00 00 01 c0 a8 88 0a 00 20 "
+ "00 01 01 02 03 04"));
assertFalse(mr.isPitr());
assertTrue(mr.isSmrInvoked());
@Test
public void deserialize__SingleEidItem() throws Exception {
MapRequest mr = MapRequestSerializer.getInstance().deserialize(hexToByteBuffer("16 80 00 "
- //
+ "01 " // single record
- + "3d 8d 2a cd 39 c8 d6 08 00 00 00 01 c0 a8 88 0a " //
+ + "3d 8d 2a cd 39 c8 d6 08 00 00 00 01 c0 a8 88 0a "
+ "00 20 00 01 01 02 03 04"));
assertEquals(1, mr.getEidItem().size());
@Test
public void deserialize__ContainsMapReply() throws Exception {
- MapRequest mr = MapRequestSerializer.getInstance().deserialize(hexToByteBuffer("16 80 00 " //
+ MapRequest mr = MapRequestSerializer.getInstance().deserialize(hexToByteBuffer("16 80 00 "
+ "01 " // single record
- + "3d 8d 2a cd 39 c8 d6 08 00 00 00 01 c0 a8 88 0a " //
+ + "3d 8d 2a cd 39 c8 d6 08 00 00 00 01 c0 a8 88 0a "
+ "00 20 00 01 01 02 03 04 "// end of map request
- + "00 00 " //
- + "00 02 01 20 00 00 00 00 " //
- + "00 01 01 02 03 04 01 02 " //
- + "03 04 00 06 00 01 0a 0a " //
+ + "00 00 "
+ + "00 02 01 20 00 00 00 00 "
+ + "00 01 01 02 03 04 01 02 "
+ + "03 04 00 06 00 01 0a 0a "
+ "0a 0a"
));
@Test
public void deserialize__MultipleItrRlocs() throws Exception {
MapRequest mr = MapRequestSerializer.getInstance().deserialize(hexToByteBuffer("10 00 "
- //
+ "02 " // This means 3 ITR - RLOCs
- + "01 3d 8d 2a cd 39 c8 d6 08 00 00 " //
+ + "01 3d 8d 2a cd 39 c8 d6 08 00 00 "
+ "00 01 c0 a8 88 0a " // IPv4 (ITR-RLOC #1 of 3)
// IPv6 (ITR-RLOC #2 of 3)
+ "00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 " //
mrBuilder.setEidItem(new ArrayList<EidItem>());
mrBuilder.getEidItem().add(new EidItemBuilder().setEid(LispAddressUtil.asIpv4PrefixEid("1.2.3.4/32")).build());
ByteBuffer expected = hexToByteBuffer("12 80 01 01 00 00 " //
- + "00 00 00 00 00 0D 00 01 0a 00 00 01 00 01 01 02 03 04 00 02 00 01 00 02 00 03 00 04 00 05 00 06 00 07 00 08 00 20 00 01 01 02 03 04");
+ + "00 00 00 00 00 0D 00 01 0a 00 00 01 00 01 01 02 03 04 00 02 00 01 00 02 00 03 00 04 00 05 00 06 "
+ + "00 07 00 08 00 20 00 01 01 02 03 04");
assertArrayEquals(expected.array(), MapRequestSerializer.getInstance().serialize(mrBuilder.build()).array());
}
mapRequestBuilder.setMapDataPresent(true);
mapRequestBuilder.setPitr(true);
mapRequestBuilder.setNonce((long) 13);
- mapRequestBuilder.setSourceEid(new SourceEidBuilder().setEid(LispAddressUtil.asIpv4Eid(("10.0.0.1"))).build());
+ mapRequestBuilder.setSourceEid(new SourceEidBuilder().setEid(LispAddressUtil.asIpv4Eid(("10.0.0.1")))
+ .build());
mapRequestBuilder.setItrRloc(new ArrayList<ItrRloc>());
- mapRequestBuilder.getItrRloc().add(new ItrRlocBuilder().setRloc(LispAddressUtil.asIpv4Rloc("1.2.3.4")).build());
- mapRequestBuilder.getItrRloc().add(new ItrRlocBuilder().setRloc(LispAddressUtil.asIpv6Rloc("1:2:3:4:5:6:7:8")).build());
+ mapRequestBuilder.getItrRloc().add(new ItrRlocBuilder().setRloc(LispAddressUtil.asIpv4Rloc("1.2.3.4"))
+ .build());
+ mapRequestBuilder.getItrRloc().add(new ItrRlocBuilder().setRloc(LispAddressUtil.asIpv6Rloc("1:2:3:4:5:6:7:8"))
+ .build());
mapRequestBuilder.setEidItem(new ArrayList<EidItem>());
- mapRequestBuilder.getEidItem().add(new EidItemBuilder().setEid(LispAddressUtil.asIpv4PrefixEid("1.2.3.4/32")).build());
+ mapRequestBuilder.getEidItem().add(new EidItemBuilder().setEid(LispAddressUtil.asIpv4PrefixEid("1.2.3.4/32"))
+ .build());
MapReplyBuilder mapreplyBuilder = new MapReplyBuilder();
MappingRecordBuilder recordBuilder = new MappingRecordBuilder();
mapreplyBuilder.setMappingRecord(recordBuilder.build());
mapRequestBuilder.setMapReply(mapreplyBuilder.build());
- ByteBuffer expected = hexToByteBuffer("16 80 01 01 00 00 " //
- + "00 00 00 00 00 0D 00 01 0a 00 00 01 00 01 01 02 03 04 00 02 00 01 00 02 00 03 00 04 00 05 00 06 00 07 00 08 00 20 00 01 01 02 03 04 "// map
- // request
+ ByteBuffer expected = hexToByteBuffer("16 80 01 01 00 00 "
+ + "00 00 00 00 00 0D 00 01 0a 00 00 01 00 01 01 02 03 04 00 02 00 01 00 02 00 03 00 04 00 05 00 06 "
+ + "00 07 00 08 00 20 00 01 01 02 03 04 "// map
+ "00 00 00 00 01 00 00 00 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 02");
- assertArrayEquals(expected.array(), MapRequestSerializer.getInstance().serialize(mapRequestBuilder.build()).array());
+ assertArrayEquals(expected.array(),
+ MapRequestSerializer.getInstance().serialize(mapRequestBuilder.build()).array());
}
}
rb.setAddressType(AfiListLcaf.class);
rb.setVirtualNetworkId(null);
rb.setAddress((Address)
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiListBuilder()
+ 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());
ByteBuffer buf = ByteBuffer.allocate(LispAddressSerializer.getInstance().getAddressSize(rb.build()));
rb.setAddressType(AfiListLcaf.class);
rb.setVirtualNetworkId(null);
rb.setAddress((Address)
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiListBuilder()
+ 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());
ByteBuffer buf = ByteBuffer.allocate(LispAddressSerializer.getInstance().getAddressSize(rb.build()));
AfiListBuilder listBuilder = new AfiListBuilder().setAddressList(new ArrayList<SimpleAddress>());
listBuilder.getAddressList().add(ip1);
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.afi.list.AfiList address1 = listBuilder.build();
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.afi.list.AfiList address1 = listBuilder.build();
listBuilder.setAddressList(new ArrayList<SimpleAddress>());
listBuilder.getAddressList().add(ip1);
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.afi.list.AfiList address2 = listBuilder.build();
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.afi.list.AfiList address2 = listBuilder.build();
listBuilder.setAddressList(new ArrayList<SimpleAddress>());
listBuilder.getAddressList().add(ip2);
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.afi.list.AfiList address3 = listBuilder.build();
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.afi.list.AfiList address3 = listBuilder.build();
assertEquals(address1, address2);
Assert.assertNotEquals(address2, address3);
eb.setAddressType(ApplicationDataLcaf.class);
eb.setVirtualNetworkId(null);
eb.setAddress((Address)
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ApplicationDataBuilder()
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.ApplicationDataBuilder()
.setApplicationData(addressBuilder.build()).build());
ByteBuffer buf = ByteBuffer.allocate(LispAddressSerializer.getInstance().getAddressSize(eb.build()));
rb.setAddressType(ExplicitLocatorPathLcaf.class);
rb.setVirtualNetworkId(null);
rb.setAddress((Address)
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPathBuilder()
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.ExplicitLocatorPathBuilder()
.setExplicitLocatorPath(elpb.build()).build());
ByteBuffer buf = ByteBuffer.allocate(LispAddressSerializer.getInstance().getAddressSize(rb.build()));
rb.setAddressType(ExplicitLocatorPathLcaf.class);
rb.setVirtualNetworkId(null);
rb.setAddress((Address)
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPathBuilder().build());
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.ExplicitLocatorPathBuilder().build());
ByteBuffer buf = ByteBuffer.allocate(LispAddressSerializer.getInstance().getAddressSize(rb.build()));
LispAddressSerializer.getInstance().serialize(buf, rb.build());
eb.setAddressType(KeyValueAddressLcaf.class);
eb.setVirtualNetworkId(null);
eb.setAddress((Address)
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddressBuilder()
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.KeyValueAddressBuilder()
.setKeyValueAddress(addressBuilder.build()).build());
ByteBuffer buf = ByteBuffer.allocate(LispAddressSerializer.getInstance().getAddressSize(eb.build()));
eb.setAddressType(SourceDestKeyLcaf.class);
eb.setVirtualNetworkId(null);
eb.setAddress((Address)
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKeyBuilder()
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105
+ .lisp.address.address.SourceDestKeyBuilder()
.setSourceDestKey(addressBuilder.build()).build());
ByteBuffer buf = ByteBuffer.allocate(LispAddressSerializer.getInstance().getAddressSize(eb.build()));
// Check if port.hostID is in map-server, if it is, get host eidtoloc
// record?
if (port.getBindinghostID() == null) {
- LOG.error("Adding new Neutron port to lisp service mapping service failed. Port does not have Host_ID. Port : "
- + port.toString());
+ LOG.error("Adding new Neutron port to lisp mapping service failed. Port does not have Host_ID. Port: {}",
+ port.toString());
return;
}
Eid hostAddress = LispAddressUtil.asDistinguishedNameEid(port.getBindinghostID());
// iana code.
eidAddress = LispAddressUtil.asIpv4PrefixEid(ip.getIpAddress() + "/32");
- lispNeutronService.getMappingDbService().addMapping(LispUtil.buildAddMappingInput(eidAddress, hostLocRecords));
+ lispNeutronService.getMappingDbService().addMapping(LispUtil.buildAddMappingInput(eidAddress,
+ hostLocRecords));
}
}
LOG.trace("sendMapNotify called!!");
if (mapNotifyInput != null) {
ByteBuffer outBuffer = MapNotifySerializer.getInstance().serialize(mapNotifyInput.getMapNotify());
- lispSbPlugin.handleSerializedLispBuffer(mapNotifyInput.getTransportAddress(), outBuffer, MessageType.MapNotify);
+ lispSbPlugin.handleSerializedLispBuffer(mapNotifyInput.getTransportAddress(), outBuffer,
+ MessageType.MapNotify);
} else {
LOG.warn("MapNotify was null");
return Futures.immediateFuture(RpcResultBuilder.<Void> failed().build());
LOG.trace("sendMapReply called!!");
if (mapReplyInput != null) {
ByteBuffer outBuffer = MapReplySerializer.getInstance().serialize(mapReplyInput.getMapReply());
- lispSbPlugin.handleSerializedLispBuffer(mapReplyInput.getTransportAddress(), outBuffer, MessageType.MapReply);
+ lispSbPlugin.handleSerializedLispBuffer(mapReplyInput.getTransportAddress(), outBuffer,
+ MessageType.MapReply);
} else {
LOG.warn("MapReply was null");
return Futures.immediateFuture(RpcResultBuilder.<Void> failed().build());
LOG.trace("sendMapRequest called!!");
if (mapRequestInput != null) {
ByteBuffer outBuffer = MapRequestSerializer.getInstance().serialize(mapRequestInput.getMapRequest());
- lispSbPlugin.handleSerializedLispBuffer(mapRequestInput.getTransportAddress(), outBuffer, MessageType.MapRequest);
+ lispSbPlugin.handleSerializedLispBuffer(mapRequestInput.getTransportAddress(), outBuffer,
+ MessageType.MapRequest);
} else {
LOG.debug("MapRequest was null");
return Futures.immediateFuture(RpcResultBuilder.<Void> failed().build());
LOG.trace("sendMapRegister called!!");
if (mapRegisterInput != null) {
ByteBuffer outBuffer = MapRegisterSerializer.getInstance().serialize(mapRegisterInput.getMapRegister());
- lispSbPlugin.handleSerializedLispBuffer(mapRegisterInput.getTransportAddress(), outBuffer, MessageType.MapRegister);
+ lispSbPlugin.handleSerializedLispBuffer(mapRegisterInput.getTransportAddress(), outBuffer,
+ MessageType.MapRegister);
} else {
LOG.debug("MapRegister was null");
return Futures.immediateFuture(RpcResultBuilder.<Void> failed().build());
import org.slf4j.LoggerFactory;
@ChannelHandler.Sharable
-public class LispSouthboundHandler extends SimpleChannelInboundHandler<DatagramPacket> implements ILispSouthboundService {
+public class LispSouthboundHandler extends SimpleChannelInboundHandler<DatagramPacket>
+ implements ILispSouthboundService {
private NotificationPublishService notificationPublishService;
protected static final Logger LOG = LoggerFactory.getLogger(LispSouthboundHandler.class);
try {
handleMapRequest(inBuffer, extractEncapsulatedSourcePort(inBuffer));
} catch (RuntimeException re) {
- throw new LispMalformedPacketException("Couldn't deserialize Map-Request (len=" + inBuffer.capacity() + ")", re);
+ throw new LispMalformedPacketException("Couldn't deserialize Map-Request (len="
+ + inBuffer.capacity() + ")", re);
}
}
RequestMappingBuilder requestMappingBuilder = new RequestMappingBuilder();
requestMappingBuilder.setMapRequest(LispNotificationHelper.convertMapRequest(request));
TransportAddressBuilder transportAddressBuilder = new TransportAddressBuilder();
- transportAddressBuilder.setIpAddress(LispNotificationHelper.getIpAddressFromInetAddress(finalSourceAddress));
+ transportAddressBuilder.setIpAddress(
+ LispNotificationHelper.getIpAddressFromInetAddress(finalSourceAddress));
transportAddressBuilder.setPort(new PortNumber(port));
requestMappingBuilder.setTransportAddress(transportAddressBuilder.build());
if (notificationPublishService != null) {
LOG.warn("Notification Provider is null!");
}
} catch (RuntimeException re) {
- throw new LispMalformedPacketException("Couldn't deserialize Map-Request (len=" + inBuffer.capacity() + ")", re);
+ throw new LispMalformedPacketException("Couldn't deserialize Map-Request (len="
+ + inBuffer.capacity() + ")", re);
} catch (InterruptedException e) {
LOG.warn("Notification publication interrupted!");
}
} else if (ipType == 6) {
inBuffer.position(inBuffer.position() + PacketHeader.Length.IPV6_NO_EXT - 1);
} else {
- throw new LispMalformedPacketException("Couldn't deserialize Map-Request: inner packet has unknown IP version: " + ipType);
+ throw new LispMalformedPacketException(
+ "Couldn't deserialize Map-Request: inner packet has unknown IP version: " + ipType);
}
int encapsulatedSourcePort = inBuffer.getShort() & 0xFFFF;
inBuffer.position(inBuffer.position() + PacketHeader.Length.UDP - 2);
return encapsulatedSourcePort;
} catch (RuntimeException re) {
- throw new LispMalformedPacketException("Couldn't deserialize Map-Request (len=" + inBuffer.capacity() + ")", re);
+ throw new LispMalformedPacketException("Couldn't deserialize Map-Request (len="
+ + inBuffer.capacity() + ")", re);
}
}
LOG.warn("Notification Provider is null!");
}
} catch (RuntimeException re) {
- throw new LispMalformedPacketException("Couldn't deserialize Map-Register (len=" + inBuffer.capacity() + ")", re);
+ throw new LispMalformedPacketException("Couldn't deserialize Map-Register (len="
+ + inBuffer.capacity() + ")", re);
} catch (InterruptedException e) {
LOG.warn("Notification publication interrupted!");
}
LOG.warn("Notification Provider is null!");
}
} catch (RuntimeException re) {
- throw new LispMalformedPacketException("Couldn't deserialize Map-Notify (len=" + inBuffer.capacity() + ")", re);
+ throw new LispMalformedPacketException("Couldn't deserialize Map-Notify (len="
+ + inBuffer.capacity() + ")", re);
} catch (InterruptedException e) {
LOG.warn("Notification publication interrupted!");
}
LOG.warn("Notification Provider is null!");
}
} catch (RuntimeException re) {
- throw new LispMalformedPacketException("Couldn't deserialize Map-Reply (len=" + inBuffer.capacity() + ")", re);
+ throw new LispMalformedPacketException("Couldn't deserialize Map-Reply (len="
+ + inBuffer.capacity() + ")", re);
} catch (InterruptedException e) {
LOG.warn("Notification publication interrupted!");
}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class LispXtrSouthboundHandler extends SimpleChannelInboundHandler<DatagramPacket> implements ILispSouthboundService {
+public class LispXtrSouthboundHandler extends SimpleChannelInboundHandler<DatagramPacket>
+ implements ILispSouthboundService {
private NotificationPublishService notificationPublishService;
protected static final Logger LOG = LoggerFactory.getLogger(LispXtrSouthboundHandler.class);
XtrRequestMappingBuilder requestMappingBuilder = new XtrRequestMappingBuilder();
requestMappingBuilder.setMapRequest(LispNotificationHelper.convertMapRequest(request));
TransportAddressBuilder transportAddressBuilder = new TransportAddressBuilder();
- transportAddressBuilder.setIpAddress(LispNotificationHelper.getIpAddressFromInetAddress(finalSourceAddress));
+ transportAddressBuilder.setIpAddress(
+ LispNotificationHelper.getIpAddressFromInetAddress(finalSourceAddress));
transportAddressBuilder.setPort(new PortNumber(LispMessage.PORT_NUM));
requestMappingBuilder.setTransportAddress(transportAddressBuilder.build());
if (notificationPublishService != null) {
LOG.warn("Notification Provider is null!");
}
} catch (RuntimeException re) {
- throw new LispMalformedPacketException("Couldn't deserialize Map-Request (len=" + inBuffer.capacity() + ")", re);
+ throw new LispMalformedPacketException(
+ "Couldn't deserialize Map-Request (len=" + inBuffer.capacity() + ")", re);
} catch (InterruptedException e) {
LOG.warn("Notification publication interrupted!");
}
LOG.warn("Notification Provider is null!");
}
} catch (RuntimeException re) {
- throw new LispMalformedPacketException("Couldn't deserialize Map-Reply (len=" + buffer.capacity() + ")", re);
+ throw new LispMalformedPacketException(
+ "Couldn't deserialize Map-Reply (len=" + buffer.capacity() + ")", re);
} catch (InterruptedException e) {
LOG.warn("Notification publication interrupted!");
}
// Nonce: 0x3d8d2acd39c8d608
// ITR-RLOC AFI=1 Address=192.168.136.10
// Record 1: 1.2.3.4/32
- mapRequestPacket = extractWSUdpByteArray(new String("0000 00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00 " //
+ mapRequestPacket = extractWSUdpByteArray(new String(
+ "0000 00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00 "
+ "0010 00 58 00 00 40 00 40 11 3c 93 7f 00 00 01 7f 00 "
+ "0020 00 01 e4 c0 10 f6 00 44 fe 57 80 00 00 00 45 00 "
+ "0030 00 38 d4 31 00 00 ff 11 56 f3 c0 a8 88 0a 01 02 "
+ "0040 03 04 dd b4 10 f6 00 24 ef 3a 10 00 00 01 3d 8d "
- + "0050 2a cd 39 c8 d6 08 00 01 01 02 03 04 00 01 c0 a8 88 0a 00 20 " //
+ + "0050 2a cd 39 c8 d6 08 00 01 01 02 03 04 00 01 c0 a8 88 0a 00 20 "
+ "0060 00 01 01 02 03 04"));
mapReplyBuilder = new MapReplyBuilder();
mapReplyBuilder.setMappingRecordItem(new ArrayList<MappingRecordItem>());
// 255/0
//
- mapRegisterPacket = extractWSUdpByteArray(new String("0000 00 50 56 ee d1 4f 00 0c 29 7a ce 79 08 00 45 00 " //
+ mapRegisterPacket = extractWSUdpByteArray(new String(
+ "0000 00 50 56 ee d1 4f 00 0c 29 7a ce 79 08 00 45 00 "
+ "0010 00 5c 00 00 40 00 40 11 d4 db c0 a8 88 0a 80 df "
+ "0020 9c 23 d6 40 10 f6 00 48 59 a4 38 00 01 01 00 00 "
+ "0030 00 00 00 00 00 00 00 01 00 14 0e a4 c6 d8 a4 06 "
+ "0040 71 7c 33 a4 5c 4a 83 1c de 74 53 03 0c ad 00 00 "
- + "0050 00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
+ + "0050 00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 "
+ "0060 ff 00 00 05 00 01 c0 a8 88 0a"));
mapNotifyBuilder = new MapNotifyBuilder();
mapNotifyBuilder.setAuthenticationData(new byte[0]);
@Test(expected = LispMalformedPacketException.class)
public void mapRegister__IllegalPacket() throws Exception {
- mapRegisterPacket = extractWSUdpByteArray(new String("0000 00 0c 29 7a ce 8d 00 0c 29 e4 ef 70 08 00 45 00 "
- + "0010 00 68 00 00 40 00 40 11 26 15 0a 01 00 6e 0a 01 " //
+ mapRegisterPacket = extractWSUdpByteArray(new String(
+ "0000 00 0c 29 7a ce 8d 00 0c 29 e4 ef 70 08 00 45 00 "
+ + "0010 00 68 00 00 40 00 40 11 26 15 0a 01 00 6e 0a 01 "
+ "0020 00 01 10 f6 10 f6 00 54 03 3b 38 00 01 01 00 00 "));
handleMapRegisterPacket(mapRegisterPacket);
@Test(expected = LispMalformedPacketException.class)
public void mapRequest__IllegalPacket() throws Exception {
- mapRequestPacket = extractWSUdpByteArray(new String("0000 00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00 " //
+ mapRequestPacket = extractWSUdpByteArray(new String(
+ "0000 00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00 "
+ "0010 00 58 00 00 40 00 40 11 3c 93 7f 00 00 01 7f 00 "
+ "0020 00 01 e4 c0 10 f6 00 44 fe 57 80 00 00 00 45 00 "
- + "0030 00 38 d4 31 00 00 ff 11 56 f3 c0 a8 88 0a 01 02 " //
+ + "0030 00 38 d4 31 00 00 ff 11 56 f3 c0 a8 88 0a 01 02 "
+ "0040 03 04 dd b4 10 f6 00 24 ef 3a 10 00 00 01 3d 8d "));
handleMapRequestPacket(mapRequestPacket);
}
@Test(expected = LispMalformedPacketException.class)
public void mapRequest__IllegalEncapsulatedPacket() throws Exception {
- mapRequestPacket = extractWSUdpByteArray(new String("0000 00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00 " //
- + "0010 00 58 00 00 40 00 40 11 3c 93 7f 00 00 01 7f 00 " //
+ mapRequestPacket = extractWSUdpByteArray(new String(
+ "0000 00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00 "
+ + "0010 00 58 00 00 40 00 40 11 3c 93 7f 00 00 01 7f 00 "
+ "0020 00 01 e4 c0 10 f6 00 44 fe 57 80 00 00 00 45 00 "));
handleMapRequestPacket(mapRequestPacket);
}
// Priority/Weight: 255/0
// Local RLOC: 192.168.136.51, Reachable, Priority/Weight: 6/100,
// Multicast Priority/Weight: 255/0
- mapRegisterPacket = extractWSUdpByteArray(new String("0000 00 0c 29 7a ce 8d 00 0c 29 e4 ef 70 08 00 45 00 "
- + "0010 00 68 00 00 40 00 40 11 26 15 0a 01 00 6e 0a 01 " //
- + "0020 00 01 10 f6 10 f6 00 54 03 3b 38 00 01 01 00 00 " //
- + "0030 00 00 00 00 00 00 00 01 00 14 ae d8 7b d4 9c 59 " //
- + "0040 e9 35 75 6e f1 29 27 a3 45 20 96 06 c2 e1 00 00 " //
- + "0050 00 0a 02 20 10 00 00 00 00 01 ac 01 01 02 01 64 " //
- + "0060 ff 00 00 05 00 01 0a 01 00 6e 06 64 ff 00 00 05 " //
+ mapRegisterPacket = extractWSUdpByteArray(new String(
+ "0000 00 0c 29 7a ce 8d 00 0c 29 e4 ef 70 08 00 45 00 "
+ + "0010 00 68 00 00 40 00 40 11 26 15 0a 01 00 6e 0a 01 "
+ + "0020 00 01 10 f6 10 f6 00 54 03 3b 38 00 01 01 00 00 "
+ + "0030 00 00 00 00 00 00 00 01 00 14 ae d8 7b d4 9c 59 "
+ + "0040 e9 35 75 6e f1 29 27 a3 45 20 96 06 c2 e1 00 00 "
+ + "0050 00 0a 02 20 10 00 00 00 00 01 ac 01 01 02 01 64 "
+ + "0060 ff 00 00 05 00 01 0a 01 00 6e 06 64 ff 00 00 05 "
+ "0070 00 01 c0 a8 88 33"));
oneOf(nps).putNotification(with(lispNotificationSaver));
// Local RLOC: 10.0.58.156, Reachable, Priority/Weight: 1/100, Multicast
// Priority/Weight: 255/0
- mapRegisterPacket = extractWSUdpByteArray(new String("0000 00 0c 29 34 3e 1b 00 0c 29 f6 d6 0d 08 00 45 00 " //
- + "0010 00 68 00 00 40 00 40 11 ea c3 0a 00 3a 9c 0a 00 " //
- + "0020 01 26 10 f6 10 f6 00 54 f5 9a 38 00 03 01 00 00 " //
- + "0030 00 00 00 00 00 00 00 01 00 14 22 97 ff 61 ec d8 " //
- + "0040 0f 91 c6 c4 01 ef 7f bb 77 58 39 5c 92 23 00 00 " //
- + "0050 00 0a 01 80 10 00 00 00 00 02 26 10 00 d0 ff ff " //
- + "0060 01 92 00 00 00 00 00 00 00 01 01 64 ff 00 00 05 " //
+ mapRegisterPacket = extractWSUdpByteArray(new String(
+ "0000 00 0c 29 34 3e 1b 00 0c 29 f6 d6 0d 08 00 45 00 "
+ + "0010 00 68 00 00 40 00 40 11 ea c3 0a 00 3a 9c 0a 00 "
+ + "0020 01 26 10 f6 10 f6 00 54 f5 9a 38 00 03 01 00 00 "
+ + "0030 00 00 00 00 00 00 00 01 00 14 22 97 ff 61 ec d8 "
+ + "0040 0f 91 c6 c4 01 ef 7f bb 77 58 39 5c 92 23 00 00 "
+ + "0050 00 0a 01 80 10 00 00 00 00 02 26 10 00 d0 ff ff "
+ + "0060 01 92 00 00 00 00 00 00 00 01 01 64 ff 00 00 05 "
+ "0070 00 01 0a 00 3a 9c"));
oneOf(nps).putNotification(with(lispNotificationSaver));
@Test
public void mapRegister__NonSetMBit() throws Exception {
- byte[] registerWithNonSetMBit = extractWSUdpByteArray(new String("0000 00 50 56 ee d1 4f 00 0c 29 7a ce 79 08 00 45 00 " //
- + "0010 00 5c 00 00 40 00 40 11 d4 db c0 a8 88 0a 80 df " //
+ byte[] registerWithNonSetMBit = extractWSUdpByteArray(new String(
+ "0000 00 50 56 ee d1 4f 00 0c 29 7a ce 79 08 00 45 00 "
+ + "0010 00 5c 00 00 40 00 40 11 d4 db c0 a8 88 0a 80 df "
+ "0020 9c 23 d6 40 10 f6 00 48 59 a4 38 00 00 01 00 00 "
+ "0030 00 00 00 00 00 00 00 01 00 14 79 d1 44 66 19 99 "
- + "0040 83 63 a7 79 6e f0 40 97 54 26 3a 44 b4 eb 00 00 " //
- + "0050 00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
+ + "0040 83 63 a7 79 6e f0 40 97 54 26 3a 44 b4 eb 00 00 "
+ + "0050 00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 "
+ "0060 ff 00 00 05 00 01 c0 a8 88 0a"));
stubMapRegister(true);
@Test
public void mapRegister__NonSetMBitWithNonZeroReservedBits() throws Exception {
- byte[] registerWithNonSetMBit = extractWSUdpByteArray(new String("0000 00 50 56 ee d1 4f 00 0c 29 7a ce 79 08 00 45 00 " //
+ byte[] registerWithNonSetMBit = extractWSUdpByteArray(new String(
+ "0000 00 50 56 ee d1 4f 00 0c 29 7a ce 79 08 00 45 00 "
+ "0010 00 5c 00 00 40 00 40 11 d4 db c0 a8 88 0a 80 df "
+ "0020 9c 23 d6 40 10 f6 00 48 59 a4 38 00 02 01 00 00 "
+ "0030 00 00 00 00 00 00 00 01 00 14 c0 c7 c5 2f 57 f6 "
+ "0040 e7 20 25 3d e8 b2 07 e2 63 de 62 2b 7a 20 00 00 "
- + "0050 00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
+ + "0050 00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 "
+ "0060 ff 00 00 05 00 01 c0 a8 88 0a"));
stubMapRegister(true);
@Test
public void mapRegister__SetMBitWithNonZeroReservedBits() throws Exception {
- byte[] registerWithNonSetMBit = extractWSUdpByteArray(new String("0000 00 50 56 ee d1 4f 00 0c 29 7a ce 79 08 00 45 00 " //
+ byte[] registerWithNonSetMBit = extractWSUdpByteArray(new String(
+ "0000 00 50 56 ee d1 4f 00 0c 29 7a ce 79 08 00 45 00 "
+ "0010 00 5c 00 00 40 00 40 11 d4 db c0 a8 88 0a 80 df "
+ "0020 9c 23 d6 40 10 f6 00 48 59 a4 38 00 03 01 00 00 "
+ "0030 00 00 00 00 00 00 00 01 00 14 a2 72 40 7b 1a ae "
+ "0040 4e 6b e2 e5 e1 01 40 8a c9 e1 d1 80 cb 72 00 00 "
- + "0050 00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
+ + "0050 00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 "
+ "0060 ff 00 00 05 00 01 c0 a8 88 0a"));
stubMapRegister(true);
System.arraycopy(mapRegisterPacket, 0, extraDataPacket, 0, mapRegisterPacket.length);
stubMapRegister(true);
- DatagramPacket dp = new DatagramPacket(wrappedBuffer(extraDataPacket), new InetSocketAddress(0), new InetSocketAddress(0));
+ DatagramPacket dp = new DatagramPacket(wrappedBuffer(extraDataPacket), new InetSocketAddress(0),
+ new InetSocketAddress(0));
testedLispService.handlePacket(dp);
// Check map register fields.
// XXX: test
assertHexEquals((byte) 0x00, result[1]);
assertHexEquals((byte) 0x00, result[2]);
- byte[] registerWithoutTypeWithoutAuthenticationData = ArrayUtils.addAll(Arrays.copyOfRange(mapRegisterPacket, 3, 16),
+ byte[] registerWithoutTypeWithoutAuthenticationData = ArrayUtils.addAll(
+ Arrays.copyOfRange(mapRegisterPacket, 3, 16),
Arrays.copyOfRange(mapRegisterPacket, 36, mapRegisterPacket.length));
byte[] notifyWithoutTypeWithOutAuthenticationData = ArrayUtils.addAll(Arrays.copyOfRange(result, 3, 16),
Arrays.copyOfRange(result, 36, result.length));
- ArrayAssert.assertEquals(registerWithoutTypeWithoutAuthenticationData, notifyWithoutTypeWithOutAuthenticationData);
+ ArrayAssert.assertEquals(registerWithoutTypeWithoutAuthenticationData,
+ notifyWithoutTypeWithOutAuthenticationData);
}
@Ignore
// Map-Reply Record: EID prefix: 2610:d0:ffff:192::1/128, TTL: 10,
// Authoritative, No-Action
- mapRequestPacket = extractWSUdpByteArray(new String("0000 00 0c 29 34 3e 1b 00 0c 29 f6 d6 0d 08 00 45 00 " //
+ mapRequestPacket = extractWSUdpByteArray(new String(
+ "0000 00 0c 29 34 3e 1b 00 0c 29 f6 d6 0d 08 00 45 00 "
+ "0010 00 b0 00 00 40 00 40 11 ea 7b 0a 00 3a 9c 0a 00 "
+ "0020 01 26 10 f6 10 f6 00 9c 9b 19 80 00 00 00 60 00 "
+ "0030 00 00 00 68 11 ff 26 10 00 d0 ff ff 01 92 00 00 "
+ "0060 00 01 ff f5 bf 5d 7b 75 93 e6 00 02 26 10 00 d0 "
+ "0070 ff ff 01 92 00 00 00 00 00 00 00 01 00 01 0a 00 "
+ "0080 3a 9c 00 80 00 02 26 10 00 d0 ff ff 01 92 00 00 "
- + "0090 00 00 00 00 00 02 00 00 00 0a 01 80 10 00 00 00 " //
- + "00a0 00 02 26 10 00 d0 ff ff 01 92 00 00 00 00 00 00 " //
+ + "0090 00 00 00 00 00 02 00 00 00 0a 01 80 10 00 00 00 "
+ + "00a0 00 02 26 10 00 d0 ff ff 01 92 00 00 00 00 00 00 "
+ "00b0 00 01 01 64 ff 00 00 05 00 01 0a 00 3a 9c"));
oneOf(nps).putNotification(with(lispNotificationSaver));
handleMapRequestAsByteArray(mapRequestPacket);
assertEquals(LispAddressUtil.asIpv6Eid("2610:d0:ffff:192:0:0:0:1"), lastMapRequest().getSourceEid().getEid());
- assertEquals(LispAddressUtil.asIpv6PrefixEid("2610:d0:ffff:192:0:0:0:2/128"), lastMapRequest().getEidItem().get(0).getEid());
+ assertEquals(LispAddressUtil.asIpv6PrefixEid("2610:d0:ffff:192:0:0:0:2/128"),
+ lastMapRequest().getEidItem().get(0).getEid());
}
@Ignore
// (2610:d0:ffff:192::2)
// encapsulated UDP source port: 4342
- mapRequestPacket = extractWSUdpByteArray(new String("0000 00 0c 29 34 3e 1b 00 0c 29 f6 d6 0d 08 00 45 00 " //
+ mapRequestPacket = extractWSUdpByteArray(new String(
+ "0000 00 0c 29 34 3e 1b 00 0c 29 f6 d6 0d 08 00 45 00 "
+ "0010 00 b0 00 00 40 00 40 11 ea 7b 0a 00 3a 9c 0a 00 "
+ "0020 01 26 10 f6 10 f6 00 9c 9b 19 80 00 00 00 60 00 "
+ "0030 00 00 00 68 11 ff 26 10 00 d0 ff ff 01 92 00 00 "
+ "0060 00 01 ff f5 bf 5d 7b 75 93 e6 00 02 26 10 00 d0 "
+ "0070 ff ff 01 92 00 00 00 00 00 00 00 01 00 01 0a 00 "
+ "0080 3a 9c 00 80 00 02 26 10 00 d0 ff ff 01 92 00 00 "
- + "0090 00 00 00 00 00 02 00 00 00 0a 01 80 10 00 00 00 " //
- + "00a0 00 02 26 10 00 d0 ff ff 01 92 00 00 00 00 00 00 " //
+ + "0090 00 00 00 00 00 02 00 00 00 0a 01 80 10 00 00 00 "
+ + "00a0 00 02 26 10 00 d0 ff ff 01 92 00 00 00 00 00 00 "
+ "00b0 00 01 01 64 ff 00 00 05 00 01 0a 00 3a 9c"));
oneOf(nps).putNotification(with(lispNotificationSaver));
// ret(mapReply);
// encapsulated LISP packet
// Source EID = 153.16.254.1
- mapRequestPacket = extractWSUdpByteArray(new String("0000 00 0c 29 7a ce 83 00 15 17 c6 4a c9 08 00 45 00 " //
+ mapRequestPacket = extractWSUdpByteArray(new String(
+ "0000 00 0c 29 7a ce 83 00 15 17 c6 4a c9 08 00 45 00 "
+ "0010 00 78 00 00 40 00 3e 11 ec b1 0a 00 01 26 0a 00 "
+ "0020 3a 9e 10 f6 10 f6 00 64 c3 a5 80 00 00 00 45 00 "
+ "0030 00 58 d4 31 00 00 ff 11 31 89 99 10 fe 01 0a 00 "
+ "0040 14 c8 10 f6 10 f6 00 44 84 ee 10 00 00 01 ba f9 "
+ "0050 ff 53 27 36 38 3a 00 01 99 10 fe 01 00 01 0a 00 "
+ "0060 01 26 00 20 00 01 0a 00 14 c8 00 00 00 0a 01 20 "
- + "0070 10 00 00 00 00 01 99 10 fe 01 01 64 ff 00 00 05 " //
+ + "0070 10 00 00 00 00 01 99 10 fe 01 01 64 ff 00 00 05 "
+ "0080 00 01 0a 00 01 26"));
oneOf(nps).putNotification(with(lispNotificationSaver));
byte expectedRecordCount = (byte) 1;
assertEquals(expectedRecordCount, result[MapReplyIpv4SingleLocatorPos.RECORD_COUNT]);
- assertEquals(MaskUtil.getMaskForAddress(mappingRecordBuilder.getEid().getAddress()), result[MapReplyIpv4SingleLocatorPos.EID_MASK_LEN]);
+ assertEquals(MaskUtil.getMaskForAddress(mappingRecordBuilder.getEid().getAddress()),
+ result[MapReplyIpv4SingleLocatorPos.EID_MASK_LEN]);
assertEquals(AddressFamily.IpV4.getIntValue(), ByteUtil.getInt(result, MapReplyIpv4SingleLocatorPos.AFI_TYPE));
assertEquals(0x0a0014c8, ByteUtil.getInt(result, MapReplyIpv4SingleLocatorPos.EID_PREFIX));
}
byte expectedRecordCount = (byte) 1;
assertEquals(expectedRecordCount, result[MapReplyIpv4SingleLocatorPos.RECORD_COUNT]);
- assertEquals(MaskUtil.getMaskForAddress(mappingRecordBuilder.getEid().getAddress()), result[MapReplyIpv4SingleLocatorPos.EID_MASK_LEN]);
+ assertEquals(MaskUtil.getMaskForAddress(mappingRecordBuilder.getEid().getAddress()),
+ result[MapReplyIpv4SingleLocatorPos.EID_MASK_LEN]);
assertEquals(AddressFamily.IpV6.getIntValue(), ByteUtil.getInt(result, MapReplyIpv4SingleLocatorPos.AFI_TYPE));
byte[] expectedIpv6 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 };
mappingRecordBuilder.getLocatorRecord().add(
new LocatorRecordBuilder().setRouted(true).setRloc(LispAddressUtil.asIpv4Rloc("4.3.2.1")).build());
mappingRecordBuilder.getLocatorRecord().add(
- new LocatorRecordBuilder().setRouted(true).setRloc(LispAddressUtil.asIpv6Rloc("0:0:0:0:0:0:0:1")).build());
+ new LocatorRecordBuilder().setRouted(true).setRloc(LispAddressUtil.asIpv6Rloc("0:0:0:0:0:0:0:1"))
+ .build());
stubHandleRequest();
byte[] result = handleMapRequestAsByteArray(mapRequestPacket);
assertEquals(AddressFamily.IpV6.getIntValue(), ByteUtil.getInt(result, MapReplyIpv4SecondLocatorPos.LOC_AFI));
byte[] expectedIpv6Rloc = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 };
- ArrayAssert.assertEquals(expectedIpv6Rloc,
- Arrays.copyOfRange(result, MapReplyIpv4SecondLocatorPos.LOCATOR, MapReplyIpv4SecondLocatorPos.LOCATOR + 16));
+ ArrayAssert.assertEquals(expectedIpv6Rloc, Arrays.copyOfRange(result, MapReplyIpv4SecondLocatorPos.LOCATOR,
+ MapReplyIpv4SecondLocatorPos.LOCATOR + 16));
assertEquals(0x01, result[MapReplyIpv4SecondLocatorPos.LOCATOR_RBIT] & 0x01);
}
// UDP: 49289 -> 4342
// LISP(Type = 14 UNKNOWN!!!, P=1, M=1
- byte[] unknownTypePacket = extractWSUdpByteArray(new String("0000 00 50 56 ee d1 4f 00 0c 29 7a ce 79 08 00 45 00 " //
+ byte[] unknownTypePacket = extractWSUdpByteArray(new String(
+ "0000 00 50 56 ee d1 4f 00 0c 29 7a ce 79 08 00 45 00 "
+ "0010 00 5c 00 00 40 00 40 11 d4 db c0 a8 88 0a 80 df "
+ "0020 9c 23 d6 40 10 f6 00 48 59 a4 F8 00 01 01 00 00 "
+ "0030 00 00 00 00 00 00 00 01 00 14 e8 f5 0b c5 c5 f2 "
+ "0040 b0 21 27 a8 21 41 04 f3 46 5a a5 68 89 ec 00 00 "
- + "0050 00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
+ + "0050 00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 "
+ "0060 ff 00 00 05 00 01 c0 a8 88 0a"));
assertNull(handlePacket(unknownTypePacket));
}
// ITR-RLOC 1: 10.1.0.111
// ITR-RLOC 2: 192.168.136.51
//
- mapRequestPacket = extractWSUdpByteArray(new String("0000 00 0c 29 7a ce 8d 00 0c 29 e4 ef 70 08 00 45 00 "
- + "0010 00 8a 00 00 40 00 40 11 25 f2 0a 01 00 6f 0a 01 " //
- + "0020 00 01 10 f6 10 f6 00 76 06 1f 80 00 00 00 45 00 " //
- + "0030 00 6a d4 31 00 00 ff 11 2a 3e ac 01 01 02 08 08 " //
- + "0040 08 08 10 f6 10 f6 00 56 63 14 10 00 01 01 79 67 " //
- + "0050 ff 75 a0 61 66 19 00 01 ac 01 01 02 00 01 0a 01 " //
- + "0060 00 6f 00 01 c0 a8 88 33 00 20 00 01 08 08 08 08 " //
- + "0070 00 00 00 0a 02 20 10 00 00 00 00 01 ac 01 01 02 " //
- + "0080 01 64 ff 00 00 05 00 01 0a 01 00 6f 06 64 ff 00 " //
+ mapRequestPacket = extractWSUdpByteArray(new String(
+ "0000 00 0c 29 7a ce 8d 00 0c 29 e4 ef 70 08 00 45 00 "
+ + "0010 00 8a 00 00 40 00 40 11 25 f2 0a 01 00 6f 0a 01 "
+ + "0020 00 01 10 f6 10 f6 00 76 06 1f 80 00 00 00 45 00 "
+ + "0030 00 6a d4 31 00 00 ff 11 2a 3e ac 01 01 02 08 08 "
+ + "0040 08 08 10 f6 10 f6 00 56 63 14 10 00 01 01 79 67 "
+ + "0050 ff 75 a0 61 66 19 00 01 ac 01 01 02 00 01 0a 01 "
+ + "0060 00 6f 00 01 c0 a8 88 33 00 20 00 01 08 08 08 08 "
+ + "0070 00 00 00 0a 02 20 10 00 00 00 00 01 ac 01 01 02 "
+ + "0080 01 64 ff 00 00 05 00 01 0a 01 00 6f 06 64 ff 00 "
+ "0090 00 05 00 01 c0 a8 88 33"));
oneOf(nps).putNotification(with(lispNotificationSaver));
}
private DatagramPacket handleMapRequestPacket(byte[] inPacket) {
- DatagramPacket dp = new DatagramPacket(wrappedBuffer(inPacket), new InetSocketAddress(0), new InetSocketAddress(0));
+ DatagramPacket dp = new DatagramPacket(wrappedBuffer(inPacket), new InetSocketAddress(0),
+ new InetSocketAddress(0));
// Unless we explicitly set the source port, it will be -1, which breaks some tests
// This is till not the real port number, but it's better
//dp.setPort(LispMessage.PORT_NUM);
}
private DatagramPacket handleMapRegisterPacket(byte[] inPacket) {
- DatagramPacket dp = new DatagramPacket(wrappedBuffer(inPacket), new InetSocketAddress(0), new InetSocketAddress(0));
+ DatagramPacket dp = new DatagramPacket(wrappedBuffer(inPacket), new InetSocketAddress(0),
+ new InetSocketAddress(0));
// Unless we explicitly set the source port, it will be -1, which breaks some tests
// This is till not the real port number, but it's better
//dp.setPort(LispMessage.PORT_NUM);
private DatagramPacket handlePacket(byte[] inPacket) {
// TODO get from mock
- testedLispService.handlePacket(new DatagramPacket(wrappedBuffer(inPacket), new InetSocketAddress(0), new InetSocketAddress(0)));
+ testedLispService.handlePacket(new DatagramPacket(wrappedBuffer(inPacket), new InetSocketAddress(0),
+ new InetSocketAddress(0)));
return null;
}