Fix: remove redundant parameter setup for LCAF addresses
Change-Id: I9f322b5a6566a723bd59a1b49721b7eae818bc9a
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispAppDataLcafAddress.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispAppDataLcafAddress.java
index d5cdf35..49d594d 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispAppDataLcafAddress.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispAppDataLcafAddress.java
@@ -327,7 +327,7 @@
@Override
public LispAppDataLcafAddress readFrom(ByteBuf byteBuf) throws LispParseError, LispReaderException {
- LispLcafAddress lcafAddress = LispLcafAddress.deserializeCommon(byteBuf);
+ LispLcafAddress.deserializeCommon(byteBuf);
byte[] ipTosByte = new byte[3];
byteBuf.readBytes(ipTosByte);
@@ -342,10 +342,6 @@
LispAfiAddress address = new LispAfiAddress.AfiAddressReader().readFrom(byteBuf);
return new AppDataAddressBuilder()
- .withReserved1(lcafAddress.getReserved1())
- .withReserved2(lcafAddress.getReserved2())
- .withFlag(lcafAddress.getFlag())
- .withLength(lcafAddress.getLength())
.withProtocol(protocol)
.withIpTos(ipTos)
.withLocalPortLow(localPortLow)
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispDistinguishedNameAddress.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispDistinguishedNameAddress.java
index d4be998..d2fe1b3 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispDistinguishedNameAddress.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispDistinguishedNameAddress.java
@@ -81,7 +81,8 @@
implements LispAddressReader<LispDistinguishedNameAddress> {
@Override
- public LispDistinguishedNameAddress readFrom(ByteBuf byteBuf) throws LispParseError {
+ public LispDistinguishedNameAddress readFrom(ByteBuf byteBuf)
+ throws LispParseError {
StringBuilder sb = new StringBuilder();
byte character;
@@ -101,7 +102,8 @@
implements LispAddressWriter<LispDistinguishedNameAddress> {
@Override
- public void writeTo(ByteBuf byteBuf, LispDistinguishedNameAddress address) throws LispWriterException {
+ public void writeTo(ByteBuf byteBuf, LispDistinguishedNameAddress address)
+ throws LispWriterException {
String distinguishedName = address.getDistinguishedName();
byte[] nameBytes = distinguishedName.getBytes();
for (int i = 0; i < nameBytes.length; i++) {
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispIpAddress.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispIpAddress.java
index 14d4949..a26abaa 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispIpAddress.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispIpAddress.java
@@ -20,6 +20,8 @@
import org.onosproject.lisp.msg.exceptions.LispParseError;
import org.onosproject.lisp.msg.exceptions.LispReaderException;
import org.onosproject.lisp.msg.exceptions.LispWriterException;
+import org.onosproject.lisp.msg.types.LispIpv4Address.Ipv4AddressWriter;
+import org.onosproject.lisp.msg.types.LispIpv6Address.Ipv6AddressWriter;
/**
* IP address that is used by LISP Locator.
@@ -69,7 +71,8 @@
public static class IpAddressReader implements LispAddressReader<LispIpAddress> {
@Override
- public LispIpAddress readFrom(ByteBuf byteBuf) throws LispParseError, LispReaderException {
+ public LispIpAddress readFrom(ByteBuf byteBuf)
+ throws LispParseError, LispReaderException {
// AFI code -> 16 bits
short afiCode = (short) byteBuf.readUnsignedShort();
@@ -90,12 +93,13 @@
public static class IpAddressWriter implements LispAddressWriter<LispIpAddress> {
@Override
- public void writeTo(ByteBuf byteBuf, LispIpAddress address) throws LispWriterException {
+ public void writeTo(ByteBuf byteBuf, LispIpAddress address)
+ throws LispWriterException {
if (address.getAddress().isIp4()) {
- new LispIpv4Address.Ipv4AddressWriter().writeTo(byteBuf, (LispIpv4Address) address);
+ new Ipv4AddressWriter().writeTo(byteBuf, (LispIpv4Address) address);
}
if (address.getAddress().isIp6()) {
- new LispIpv6Address.Ipv6AddressWriter().writeTo(byteBuf, (LispIpv6Address) address);
+ new Ipv6AddressWriter().writeTo(byteBuf, (LispIpv6Address) address);
}
}
}
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispIpv6Address.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispIpv6Address.java
index 2017174..f17a822 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispIpv6Address.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispIpv6Address.java
@@ -82,7 +82,8 @@
public static class Ipv6AddressWriter implements LispAddressWriter<LispIpv6Address> {
@Override
- public void writeTo(ByteBuf byteBuf, LispIpv6Address address) throws LispWriterException {
+ public void writeTo(ByteBuf byteBuf, LispIpv6Address address)
+ throws LispWriterException {
byte[] ipByte = address.getAddress().getIp6Address().toOctets();
byteBuf.writeBytes(ipByte);
}
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispListLcafAddress.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispListLcafAddress.java
index c46eed2..3c47e6c 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispListLcafAddress.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispListLcafAddress.java
@@ -160,10 +160,12 @@
/**
* List LCAF address reader class.
*/
- public static class ListLcafAddressReader implements LispAddressReader<LispListLcafAddress> {
+ public static class ListLcafAddressReader
+ implements LispAddressReader<LispListLcafAddress> {
@Override
- public LispListLcafAddress readFrom(ByteBuf byteBuf) throws LispParseError, LispReaderException {
+ public LispListLcafAddress readFrom(ByteBuf byteBuf)
+ throws LispParseError, LispReaderException {
LispLcafAddress lcafAddress = LispLcafAddress.deserializeCommon(byteBuf);
@@ -172,21 +174,25 @@
LispAfiAddress ipv4 = reader.readFrom(byteBuf);
LispAfiAddress ipv6 = reader.readFrom(byteBuf);
- return new LispListLcafAddress(lcafAddress.getReserved1(), lcafAddress.getReserved2(),
- lcafAddress.getFlag(), ImmutableList.of(ipv4, ipv6));
+ return new LispListLcafAddress(lcafAddress.getReserved1(),
+ lcafAddress.getReserved2(),
+ lcafAddress.getFlag(),
+ ImmutableList.of(ipv4, ipv6));
}
}
/**
* List LCAF address writer class.
*/
- public static class ListLcafAddressWriter implements LispAddressWriter<LispListLcafAddress> {
+ public static class ListLcafAddressWriter
+ implements LispAddressWriter<LispListLcafAddress> {
private static final int IPV4_ADDRESS_INDEX = 0;
private static final int IPV6_ADDRESS_INDEX = 1;
@Override
- public void writeTo(ByteBuf byteBuf, LispListLcafAddress address) throws LispWriterException {
+ public void writeTo(ByteBuf byteBuf, LispListLcafAddress address)
+ throws LispWriterException {
int lcafIndex = byteBuf.writerIndex();
LispLcafAddress.serializeCommon(byteBuf, address);
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispMacAddress.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispMacAddress.java
index 6828581..59f8e40 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispMacAddress.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispMacAddress.java
@@ -96,7 +96,8 @@
public static class MacAddressWriter implements LispAddressWriter<LispMacAddress> {
@Override
- public void writeTo(ByteBuf byteBuf, LispMacAddress address) throws LispWriterException {
+ public void writeTo(ByteBuf byteBuf, LispMacAddress address)
+ throws LispWriterException {
byte[] macByte = address.getAddress().toBytes();
byteBuf.writeBytes(macByte);
}
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispNatLcafAddress.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispNatLcafAddress.java
index 6f8994a..5bc88aa 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispNatLcafAddress.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispNatLcafAddress.java
@@ -293,16 +293,13 @@
}
return new NatAddressBuilder()
- .withReserved1(lcafAddress.getReserved1())
- .withReserved2(lcafAddress.getReserved2())
- .withFlag(lcafAddress.getFlag())
- .withLength(lcafAddress.getLength())
- .withMsUdpPortNumber(msUdpPortNumber)
- .withEtrUdpPortNumber(etrUdpPortNumber)
- .withGlobalEtrRlocAddress(globalEtrRlocAddress)
- .withMsRlocAddress(msRlocAddress)
- .withPrivateEtrRlocAddress(privateEtrRlocAddress)
- .withRtrRlocAddresses(rtrRlocAddresses).build();
+ .withMsUdpPortNumber(msUdpPortNumber)
+ .withEtrUdpPortNumber(etrUdpPortNumber)
+ .withGlobalEtrRlocAddress(globalEtrRlocAddress)
+ .withMsRlocAddress(msRlocAddress)
+ .withPrivateEtrRlocAddress(privateEtrRlocAddress)
+ .withRtrRlocAddresses(rtrRlocAddresses)
+ .build();
}
}
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispNoAddress.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispNoAddress.java
index a36c386..3fa52c5 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispNoAddress.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispNoAddress.java
@@ -48,7 +48,8 @@
public static class NoAddressWriter implements LispAddressWriter<LispNoAddress> {
@Override
- public void writeTo(ByteBuf byteBuf, LispNoAddress address) throws LispWriterException {
+ public void writeTo(ByteBuf byteBuf, LispNoAddress address)
+ throws LispWriterException {
// since there is nothing to write to channel, we just leave it empty
}
}
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispSegmentLcafAddress.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispSegmentLcafAddress.java
index 5ec58f7..a13d967 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispSegmentLcafAddress.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispSegmentLcafAddress.java
@@ -59,7 +59,8 @@
* @param instanceId instance id
* @param address address
*/
- private LispSegmentLcafAddress(byte idMaskLength, int instanceId, LispAfiAddress address) {
+ private LispSegmentLcafAddress(byte idMaskLength, int instanceId,
+ LispAfiAddress address) {
super(LispCanonicalAddressFormatEnum.SEGMENT, idMaskLength);
this.address = address;
this.instanceId = instanceId;
@@ -75,9 +76,11 @@
* @param instanceId instance id
* @param address address
*/
- private LispSegmentLcafAddress(byte reserved1, byte idMaskLength, byte flag, short length,
- int instanceId, LispAfiAddress address) {
- super(LispCanonicalAddressFormatEnum.SEGMENT, reserved1, idMaskLength, flag, length);
+ private LispSegmentLcafAddress(byte reserved1, byte idMaskLength, byte flag,
+ short length, int instanceId,
+ LispAfiAddress address) {
+ super(LispCanonicalAddressFormatEnum.SEGMENT, reserved1,
+ idMaskLength, flag, length);
this.address = address;
this.instanceId = instanceId;
}
@@ -209,9 +212,6 @@
LispAfiAddress address = new AfiAddressReader().readFrom(byteBuf);
return new SegmentAddressBuilder()
- .withReserved1(lcafAddress.getReserved1())
- .withFlag(lcafAddress.getFlag())
- .withLength(lcafAddress.getLength())
.withIdMaskLength(idMaskLength)
.withInstanceId(instanceId)
.withAddress(address)
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispSourceDestLcafAddress.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispSourceDestLcafAddress.java
index de067d0..696d08e 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispSourceDestLcafAddress.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispSourceDestLcafAddress.java
@@ -80,7 +80,7 @@
}
/**
- * Initializes source/dest key type LCAF address.
+ * Initializes source/destination key type LCAF address.
*
* @param reserved1 reserved1
* @param reserved2 reserved2
@@ -92,11 +92,13 @@
* @param srcPrefix source address prefix
* @param dstPrefix destination address prefix
*/
- private LispSourceDestLcafAddress(byte reserved1, byte reserved2, byte flag, short length,
- short reserved, byte srcMaskLength,
- byte dstMaskLength, LispAfiAddress srcPrefix,
+ private LispSourceDestLcafAddress(byte reserved1, byte reserved2, byte flag,
+ short length, short reserved,
+ byte srcMaskLength, byte dstMaskLength,
+ LispAfiAddress srcPrefix,
LispAfiAddress dstPrefix) {
- super(LispCanonicalAddressFormatEnum.SOURCE_DEST, reserved1, reserved2, flag, length);
+ super(LispCanonicalAddressFormatEnum.SOURCE_DEST, reserved1,
+ reserved2, flag, length);
this.reserved = reserved;
this.srcMaskLength = srcMaskLength;
this.dstMaskLength = dstMaskLength;
@@ -267,9 +269,10 @@
implements LispAddressReader<LispSourceDestLcafAddress> {
@Override
- public LispSourceDestLcafAddress readFrom(ByteBuf byteBuf) throws LispParseError, LispReaderException {
+ public LispSourceDestLcafAddress readFrom(ByteBuf byteBuf)
+ throws LispParseError, LispReaderException {
- LispLcafAddress lcafAddress = deserializeCommon(byteBuf);
+ deserializeCommon(byteBuf);
short reserved = byteBuf.readShort();
byte srcMaskLength = (byte) byteBuf.readUnsignedByte();
@@ -279,10 +282,6 @@
LispAfiAddress dstPrefix = new AfiAddressReader().readFrom(byteBuf);
return new SourceDestAddressBuilder()
- .withReserved1(lcafAddress.getReserved1())
- .withReserved2(lcafAddress.getReserved2())
- .withFlag(lcafAddress.getFlag())
- .withLength(lcafAddress.getLength())
.withReserved(reserved)
.withSrcMaskLength(srcMaskLength)
.withDstMaskLength(dstMaskLength)
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispTeLcafAddress.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispTeLcafAddress.java
index f019b4a..5892653 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispTeLcafAddress.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispTeLcafAddress.java
@@ -101,7 +101,8 @@
.add("TE records", records).toString();
}
- public static final class TeAddressBuilder extends LcafAddressBuilder<TeAddressBuilder> {
+ public static final class TeAddressBuilder
+ extends LcafAddressBuilder<TeAddressBuilder> {
private List<LispTeRecord> records;
/**
@@ -127,10 +128,12 @@
/**
* TE LCAF address reader class.
*/
- public static class TeLcafAddressReader implements LispAddressReader<LispTeLcafAddress> {
+ public static class TeLcafAddressReader
+ implements LispAddressReader<LispTeLcafAddress> {
@Override
- public LispTeLcafAddress readFrom(ByteBuf byteBuf) throws LispParseError, LispReaderException {
+ public LispTeLcafAddress readFrom(ByteBuf byteBuf)
+ throws LispParseError, LispReaderException {
LispLcafAddress lcafAddress = LispLcafAddress.deserializeCommon(byteBuf);
@@ -148,10 +151,12 @@
/**
* TE LCAF address writer class.
*/
- public static class TeLcafAddressWriter implements LispAddressWriter<LispTeLcafAddress> {
+ public static class TeLcafAddressWriter
+ implements LispAddressWriter<LispTeLcafAddress> {
@Override
- public void writeTo(ByteBuf byteBuf, LispTeLcafAddress address) throws LispWriterException {
+ public void writeTo(ByteBuf byteBuf, LispTeLcafAddress address)
+ throws LispWriterException {
int lcafIndex = byteBuf.writerIndex();
LispLcafAddress.serializeCommon(byteBuf, address);
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispTeRecord.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispTeRecord.java
index 3a496d6..48f7d47 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispTeRecord.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispTeRecord.java
@@ -193,7 +193,8 @@
private static final int LOOKUP_INDEX = 3;
@Override
- public LispTeRecord readFrom(ByteBuf byteBuf) throws LispParseError, LispReaderException {
+ public LispTeRecord readFrom(ByteBuf byteBuf)
+ throws LispParseError, LispReaderException {
// let's skip reserved 3
byteBuf.skipBytes(RESERVED_SKIP_LENGTH);
@@ -232,7 +233,8 @@
private static final int UNUSED_ZERO = 0;
@Override
- public void writeTo(ByteBuf byteBuf, LispTeRecord record) throws LispWriterException {
+ public void writeTo(ByteBuf byteBuf, LispTeRecord record)
+ throws LispWriterException {
byteBuf.writeByte(UNUSED_ZERO);