Migrate to use stringValue() 00/74300/2
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 21 Jul 2018 05:40:41 +0000 (07:40 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 21 Jul 2018 05:43:18 +0000 (07:43 +0200)
This migrates away from char[]-based getValue() and constructors.

Change-Id: I6cf3c40361352629e5810969f7f01148f31d7ba0
JIRA: MDSAL-364
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
mappingservice/lisp-proto/src/main/java/org/opendaylight/lispflowmapping/lisp/util/LispAddressStringifier.java
mappingservice/lisp-proto/src/main/java/org/opendaylight/lispflowmapping/lisp/util/LispAddressUtil.java
mappingservice/lisp-proto/src/main/java/org/opendaylight/lispflowmapping/lisp/util/MaskUtil.java
mappingservice/lisp-proto/src/test/java/org/opendaylight/lispflowmapping/lisp/util/LispAddressUtilTest.java
mappingservice/lisp-proto/src/test/java/org/opendaylight/lispflowmapping/serializer/address/AfiListSerializerTest.java
mappingservice/lisp-proto/src/test/java/org/opendaylight/lispflowmapping/serializer/address/ApplicationDataSerializerTest.java
mappingservice/lisp-proto/src/test/java/org/opendaylight/lispflowmapping/serializer/address/ExplicitLocatorPathSerializerTest.java
mappingservice/lisp-proto/src/test/java/org/opendaylight/lispflowmapping/serializer/address/KeyValueAddressSerializerTest.java
mappingservice/lisp-proto/src/test/java/org/opendaylight/lispflowmapping/serializer/address/SourceDestKeySerializerTest.java
mappingservice/neutron/src/main/java/org/opendaylight/lispflowmapping/neutron/SubnetDataProcessor.java

index 3fff6d619345d64b216d65657fd97ea236d8b848..4362edc2cfa0b9b28efa6601178a3fc2e8bcff70 100644 (file)
@@ -331,7 +331,7 @@ public final class LispAddressStringifier {
             if (needComma) {
                 sb.append(",");
             }
-            sb.append(a.getValue());
+            sb.append(a.stringValue());
             needComma = true;
         }
         sb.append("}");
@@ -400,16 +400,16 @@ public final class LispAddressStringifier {
         // AFI = 16387, LCAF Type 12, Source/Destination Key
         // Example rendering:
         //    192.0.2.1/32|192.0.2.2/32
-        return getPrefixString(dst, (new String(addr.getSourceDestKey().getSource().getValue()))
-                + "|" + getPrefixString(dst, new String(addr.getSourceDestKey().getDest().getValue())));
+        return getPrefixString(dst, addr.getSourceDestKey().getSource().stringValue()
+                + "|" + getPrefixString(dst, addr.getSourceDestKey().getDest().stringValue()));
     }
 
     protected static String getStringFromKeyValueAddress(Destination dst, KeyValueAddress addr) {
         // AFI = 16387, LCAF Type 15, Key/Value Address Pair
         // Example rendering:
         //    192.0.2.1=>192.0.2.2
-        return getPrefixString(dst, new String(addr.getKeyValueAddress().getKey().getValue())
-                + "=>" + getPrefixString(dst, new String(addr.getKeyValueAddress().getValue().getValue())));
+        return getPrefixString(dst, addr.getKeyValueAddress().getKey().stringValue()
+                + "=>" + getPrefixString(dst, addr.getKeyValueAddress().getValue().stringValue()));
     }
 
     protected static String getStringFromMac(Destination dst, Mac addr) {
index c441972e0efbda5dd36d488f528d63dc59f3fc66..9d12413c4257be0e59d00f77dace9174d70ab9fd 100644 (file)
@@ -432,7 +432,7 @@ public final class LispAddressUtil {
     public static Eid toIpPrefixEid(IpAddress addr, int vni) {
         // If you touch this, be sure that sfclisp compiles!
         int mask = addressTypeFromIpAddress(addr) == Ipv4Afi.class ? 32 : 128;
-        IpPrefix prefix = asIpPrefix(String.valueOf(addr.getValue()), mask);
+        IpPrefix prefix = asIpPrefix(addr.stringValue(), mask);
         // XXX getMapping rcp fails if VNI set to 0
         return toEidNoVni(prefix);
     }
index 3b287efbb764dfb53df2e7337710d3d3029fccb2..9be7e2bbe96940e0da02a3d9e1675349cc2d9987 100644 (file)
@@ -168,7 +168,7 @@ public final class MaskUtil {
     }
 
     private static IpPrefix normalizeIpPrefix(IpPrefix address) throws UnknownHostException {
-        String[] prefix = splitPrefix(String.valueOf(address.getValue()));
+        String[] prefix = splitPrefix(address.stringValue());
         short mask = Short.parseShort(prefix[1]);
 
         InetAddress normalizedAddress = normalizeIP(InetAddresses.forString(prefix[0]), mask);
index b7fb14088d4d26248146f1851c5bb1f1722df6e4..7feb3f8100aec64aafbd2766e5e327937150e51f 100644 (file)
@@ -46,6 +46,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.addres
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.ServicePathIdType;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.ServicePathLcaf;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddressBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SourceDestKeyLcaf;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedName;
@@ -88,7 +89,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rl
 
 public class LispAddressUtilTest {
 
-    private static final char[] DUMMY_CHARACTER_ARRAY_TEST = new char[]{'a', 'b', 'c', 'd'};
     private static final Long NUMBER_TEST = 5L;
 
     private static final byte[] IPV4_ADDRESS_BYTES_A_TEST = new byte[]{(byte) 192, (byte) 168, 1, 1};
@@ -272,7 +272,7 @@ public class LispAddressUtilTest {
      */
     @Test
     public void addressFromSimpleAddressTest_asAddress() {
-        final SimpleAddress simpleAddress = new SimpleAddress(DUMMY_CHARACTER_ARRAY_TEST);
+        final SimpleAddress simpleAddress = SimpleAddressBuilder.getDefaultInstance("abcd");
         final Class<? extends LispAddressFamily> addressClass = LispAddressUtil.addressTypeFromSimpleAddress(
                 simpleAddress);
         assertEquals(DistinguishedNameAfi.class, addressClass);
index 98d10bae8eb18daf7c51c5a26c7dfdf323a01959..0fe917186667381181f6dcfa3751ed62ca46cb09 100644 (file)
@@ -12,10 +12,8 @@ import static org.junit.Assert.assertEquals;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
-
 import junitx.framework.ArrayAssert;
 import junitx.framework.Assert;
-
 import org.junit.Test;
 import org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializer;
 import org.opendaylight.lispflowmapping.lisp.serializer.exception.LispSerializationException;
@@ -23,7 +21,6 @@ import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.AfiListLcaf;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiList;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.afi.list.AfiListBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc;
@@ -44,8 +41,8 @@ public class AfiListSerializerTest extends BaseTestCase {
         List<SimpleAddress> addressList = afiList.getAfiList().getAddressList();
         assertEquals(2, addressList.size());
 
-        assertEquals("170.187.204.221", String.valueOf(addressList.get(0).getValue()));
-        assertEquals("1122:3344:1122:3344:1122:3344:1122:3344", String.valueOf(addressList.get(1).getValue()));
+        assertEquals("170.187.204.221", addressList.get(0).stringValue());
+        assertEquals("1122:3344:1122:3344:1122:3344:1122:3344", addressList.get(1).stringValue());
     }
 
     @Test
@@ -77,7 +74,7 @@ public class AfiListSerializerTest extends BaseTestCase {
     @Test
     public void serialize__Simple() throws Exception {
         AfiListBuilder listBuilder = new AfiListBuilder();
-        List<SimpleAddress> addressList = new ArrayList<SimpleAddress>();
+        List<SimpleAddress> addressList = new ArrayList<>();
         addressList.add(SimpleAddressBuilder.getDefaultInstance("170.187.204.221"));
         addressList.add(SimpleAddressBuilder.getDefaultInstance("1122:3344:1122:3344:1122:3344:1122:3344"));
         listBuilder.setAddressList(addressList);
@@ -85,10 +82,9 @@ public class AfiListSerializerTest extends BaseTestCase {
         RlocBuilder rb = new RlocBuilder();
         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()
-                .setAfiList(listBuilder.build()).build());
+        rb.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());
 
         ByteBuffer buf = ByteBuffer.allocate(LispAddressSerializer.getInstance().getAddressSize(rb.build()));
         LispAddressSerializer.getInstance().serialize(buf, rb.build());
@@ -102,16 +98,15 @@ public class AfiListSerializerTest extends BaseTestCase {
     @Test
     public void serialize__NoAddresses() throws Exception {
         AfiListBuilder listBuilder = new AfiListBuilder();
-        List<SimpleAddress> addressList = new ArrayList<SimpleAddress>();
+        List<SimpleAddress> addressList = new ArrayList<>();
         listBuilder.setAddressList(addressList);
 
         RlocBuilder rb = new RlocBuilder();
         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()
-                .setAfiList(listBuilder.build()).build());
+        rb.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());
 
         ByteBuffer buf = ByteBuffer.allocate(LispAddressSerializer.getInstance().getAddressSize(rb.build()));
         LispAddressSerializer.getInstance().serialize(buf, rb.build());
index 470615e64e4e7f2b31cf7f5777e1af20b7a2fe90..5e466ed6c600514d06f657851faa3c6e5a541a93 100644 (file)
@@ -10,9 +10,7 @@ package org.opendaylight.lispflowmapping.serializer.address;
 import static org.junit.Assert.assertEquals;
 
 import java.nio.ByteBuffer;
-
 import junitx.framework.ArrayAssert;
-
 import org.junit.Test;
 import org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializer;
 import org.opendaylight.lispflowmapping.lisp.serializer.exception.LispSerializationException;
@@ -23,7 +21,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.ApplicationDataLcaf;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ApplicationData;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.application.data.ApplicationDataBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
@@ -43,7 +40,7 @@ public class ApplicationDataSerializerTest extends BaseTestCase {
         assertEquals(ApplicationDataLcaf.class, address.getAddressType());
         ApplicationData appAddress = (ApplicationData) address.getAddress();
 
-        assertEquals("17.34.51.68", String.valueOf(appAddress.getApplicationData().getAddress().getValue()));
+        assertEquals("17.34.51.68", appAddress.getApplicationData().getAddress().stringValue());
         assertEquals(ByteUtil.getPartialInt(new byte[] { (byte) 0xAA, (byte) 0xBB, (byte) 0xCC }),
                 appAddress.getApplicationData().getIpTos().intValue());
         assertEquals((byte) 0xDD, appAddress.getApplicationData().getProtocol().byteValue());
@@ -81,8 +78,8 @@ public class ApplicationDataSerializerTest extends BaseTestCase {
                         "00 02 11 22 33 44 55 66 77 88 99 AA BB CC AA BB CC DD"), null); // AFI=2,
         // IPv6
 
-        assertEquals("1122:3344:5566:7788:99aa:bbcc:aabb:ccdd", String.valueOf(
-                ((ApplicationData) appAddress.getAddress()).getApplicationData().getAddress().getValue()));
+        assertEquals("1122:3344:5566:7788:99aa:bbcc:aabb:ccdd",
+                ((ApplicationData) appAddress.getAddress()).getApplicationData().getAddress().stringValue());
     }
 
     @Test
@@ -99,10 +96,9 @@ public class ApplicationDataSerializerTest extends BaseTestCase {
         EidBuilder eb = new EidBuilder();
         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()
-                .setApplicationData(addressBuilder.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(addressBuilder.build()).build());
 
         ByteBuffer buf = ByteBuffer.allocate(LispAddressSerializer.getInstance().getAddressSize(eb.build()));
         LispAddressSerializer.getInstance().serialize(buf, eb.build());
index cd1a9b85c74aeaf9618ffae37a93d1298b0f2d41..3e81c87270f4ec085ee68c904e14e792bddea1af 100644 (file)
@@ -12,16 +12,13 @@ import static org.junit.Assert.assertEquals;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
-
 import junitx.framework.ArrayAssert;
-
 import org.junit.Test;
 import org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializer;
 import org.opendaylight.lispflowmapping.lisp.serializer.exception.LispSerializationException;
 import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.ExplicitLocatorPathLcaf;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPath;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.explicit.locator.path.ExplicitLocatorPathBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.explicit.locator.path.explicit.locator.path.Hop;
@@ -44,8 +41,8 @@ public class ExplicitLocatorPathSerializerTest extends BaseTestCase {
         List<Hop> hops = elp.getExplicitLocatorPath().getHop();
         assertEquals(2, hops.size());
 
-        assertEquals("170.187.204.221", String.valueOf(hops.get(0).getAddress().getValue()));
-        assertEquals("17.34.51.68", String.valueOf(hops.get(1).getAddress().getValue()));
+        assertEquals("170.187.204.221", hops.get(0).getAddress().stringValue());
+        assertEquals("17.34.51.68", hops.get(1).getAddress().stringValue());
     }
 
     @Test
@@ -61,11 +58,11 @@ public class ExplicitLocatorPathSerializerTest extends BaseTestCase {
         List<Hop> hops = elp.getExplicitLocatorPath().getHop();
         assertEquals(2, hops.size());
 
-        assertEquals("170.187.204.221", String.valueOf(hops.get(0).getAddress().getValue()));
+        assertEquals("170.187.204.221", hops.get(0).getAddress().stringValue());
         assertEquals(true, hops.get(0).getLrsBits().isLookup().booleanValue());
         assertEquals(false, hops.get(0).getLrsBits().isRlocProbe().booleanValue());
         assertEquals(true, hops.get(0).getLrsBits().isStrict().booleanValue());
-        assertEquals("17.34.51.68", String.valueOf(hops.get(1).getAddress().getValue()));
+        assertEquals("17.34.51.68", hops.get(1).getAddress().stringValue());
         assertEquals(false, hops.get(1).getLrsBits().isLookup().booleanValue());
         assertEquals(true, hops.get(1).getLrsBits().isRlocProbe().booleanValue());
         assertEquals(false, hops.get(1).getLrsBits().isStrict().booleanValue());
@@ -99,7 +96,7 @@ public class ExplicitLocatorPathSerializerTest extends BaseTestCase {
 
     @Test
     public void serialize__Simple() throws Exception {
-        List<Hop> hops = new ArrayList<Hop>();
+        List<Hop> hops = new ArrayList<>();
         hops.add(new HopBuilder().setAddress(SimpleAddressBuilder.getDefaultInstance("170.187.204.221")).build());
         hops.add(new HopBuilder().setAddress(SimpleAddressBuilder.getDefaultInstance("17.34.51.68")).build());
 
@@ -109,10 +106,9 @@ public class ExplicitLocatorPathSerializerTest extends BaseTestCase {
         RlocBuilder rb = new RlocBuilder();
         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()
-                .setExplicitLocatorPath(elpb.build()).build());
+        rb.setAddress(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()));
         LispAddressSerializer.getInstance().serialize(buf, rb.build());
@@ -128,9 +124,8 @@ public class ExplicitLocatorPathSerializerTest extends BaseTestCase {
         RlocBuilder rb = new RlocBuilder();
         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());
+        rb.setAddress(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());
index 471ecbeab76fa1ad07ad9e4a97a604e4fb7eaa91..c5f1ea58bb94c2bbb8f5c20eadb1165fb3a22b74 100644 (file)
@@ -10,9 +10,7 @@ package org.opendaylight.lispflowmapping.serializer.address;
 import static org.junit.Assert.assertEquals;
 
 import java.nio.ByteBuffer;
-
 import junitx.framework.ArrayAssert;
-
 import org.junit.Test;
 import org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializer;
 import org.opendaylight.lispflowmapping.lisp.serializer.exception.LispSerializationException;
@@ -21,7 +19,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.KeyValueAddressLcaf;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.key.value.address.KeyValueAddressBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
@@ -39,8 +36,8 @@ public class KeyValueAddressSerializerTest extends BaseTestCase {
         assertEquals(KeyValueAddressLcaf.class, address.getAddressType());
         KeyValueAddress srcDestAddress = (KeyValueAddress) address.getAddress();
 
-        assertEquals("17.34.51.68", String.valueOf(srcDestAddress.getKeyValueAddress().getKey().getValue()));
-        assertEquals("34.51.68.85", String.valueOf(srcDestAddress.getKeyValueAddress().getValue().getValue()));
+        assertEquals("17.34.51.68", srcDestAddress.getKeyValueAddress().getKey().stringValue());
+        assertEquals("34.51.68.85", srcDestAddress.getKeyValueAddress().getValue().stringValue());
     }
 
     @Test(expected = LispSerializationException.class)
@@ -66,10 +63,10 @@ public class KeyValueAddressSerializerTest extends BaseTestCase {
                 "00 02 44 33 22 11 88 77 66 55 99 AA BB CC AA BB CC DD"), null); // AFI=2,
         // IPv6
 
-        assertEquals("1122:3344:5566:7788:99aa:bbcc:aabb:ccdd", String.valueOf(
-                ((KeyValueAddress) srcAddress.getAddress()).getKeyValueAddress().getKey().getValue()));
-        assertEquals("4433:2211:8877:6655:99aa:bbcc:aabb:ccdd", String.valueOf(
-                ((KeyValueAddress) srcAddress.getAddress()).getKeyValueAddress().getValue().getValue()));
+        assertEquals("1122:3344:5566:7788:99aa:bbcc:aabb:ccdd",
+                ((KeyValueAddress) srcAddress.getAddress()).getKeyValueAddress().getKey().stringValue());
+        assertEquals("4433:2211:8877:6655:99aa:bbcc:aabb:ccdd",
+                ((KeyValueAddress) srcAddress.getAddress()).getKeyValueAddress().getValue().stringValue());
     }
 
     @Test
@@ -81,10 +78,9 @@ public class KeyValueAddressSerializerTest extends BaseTestCase {
         EidBuilder eb = new EidBuilder();
         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()
-                .setKeyValueAddress(addressBuilder.build()).build());
+        eb.setAddress(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()));
         LispAddressSerializer.getInstance().serialize(buf, eb.build());
index 7c8f107e7c0aa68047ed08752e2f743860113c8b..79b7b14cb076d5c80c1e2b7c88ed66aeb12cee50 100644 (file)
@@ -10,9 +10,7 @@ package org.opendaylight.lispflowmapping.serializer.address;
 import static org.junit.Assert.assertEquals;
 
 import java.nio.ByteBuffer;
-
 import junitx.framework.ArrayAssert;
-
 import org.junit.Test;
 import org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializer;
 import org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializerContext;
@@ -23,7 +21,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SourceDestKeyLcaf;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKeyBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
@@ -46,8 +43,8 @@ public class SourceDestKeySerializerTest extends BaseTestCase {
         assertEquals((byte) 0x10, MaskUtil.getMaskForAddress(srcDestAddress.getSourceDestKey().getSource()));
         assertEquals((byte) 0x18, MaskUtil.getMaskForAddress(srcDestAddress.getSourceDestKey().getDest()));
 
-        assertEquals("17.34.51.68/16", String.valueOf(srcDestAddress.getSourceDestKey().getSource().getValue()));
-        assertEquals("34.51.68.85/24", String.valueOf(srcDestAddress.getSourceDestKey().getDest().getValue()));
+        assertEquals("17.34.51.68/16", srcDestAddress.getSourceDestKey().getSource().stringValue());
+        assertEquals("34.51.68.85/24", srcDestAddress.getSourceDestKey().getDest().stringValue());
     }
 
     @Test(expected = LispSerializationException.class)
@@ -77,10 +74,10 @@ public class SourceDestKeySerializerTest extends BaseTestCase {
                 new LispAddressSerializerContext(null));
         // IPv6
 
-        assertEquals("1122:3344:5566:7788:99aa:bbcc:aabb:ccdd/120", String.valueOf(
-                ((SourceDestKey) srcAddress.getAddress()).getSourceDestKey().getSource().getValue()));
-        assertEquals("4433:2211:8877:6655:99aa:bbcc:aabb:ccdd/120", String.valueOf(
-                ((SourceDestKey) srcAddress.getAddress()).getSourceDestKey().getDest().getValue()));
+        assertEquals("1122:3344:5566:7788:99aa:bbcc:aabb:ccdd/120",
+                ((SourceDestKey) srcAddress.getAddress()).getSourceDestKey().getSource().stringValue());
+        assertEquals("4433:2211:8877:6655:99aa:bbcc:aabb:ccdd/120",
+                ((SourceDestKey) srcAddress.getAddress()).getSourceDestKey().getDest().stringValue());
     }
 
     @Test
@@ -92,10 +89,9 @@ public class SourceDestKeySerializerTest extends BaseTestCase {
         EidBuilder eb = new EidBuilder();
         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()
-                .setSourceDestKey(addressBuilder.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(addressBuilder.build()).build());
 
         ByteBuffer buf = ByteBuffer.allocate(LispAddressSerializer.getInstance().getAddressSize(eb.build()));
         LispAddressSerializer.getInstance().serialize(buf, eb.build());
index b2c2b0d03f0691b8bf92be9449fe39d9500dfeed..13bc0bfb53618d16074387b3802a5995ccdbba64 100644 (file)
@@ -56,7 +56,7 @@ public class SubnetDataProcessor implements DataProcessor<Subnet> {
 
         // Determine the IANA code for the subnet IP version
         // Default is set to IPv4 for neutron subnets
-        final Eid eid = LispAddressUtil.asIpv4PrefixEid(String.valueOf(subnet.getCidr().getValue()));
+        final Eid eid = LispAddressUtil.asIpv4PrefixEid(subnet.getCidr().stringValue());
 
         try {
             final OdlMappingserviceService lfmdb = lispNeutronService.getMappingDbService();
@@ -100,7 +100,7 @@ public class SubnetDataProcessor implements DataProcessor<Subnet> {
 
         // Determine the IANA code for the subnet IP version
         // Default is set to IPv4 for neutron subnets
-        final Eid eid = LispAddressUtil.asIpv4PrefixEid(String.valueOf(subnet.getCidr().getValue()));
+        final Eid eid = LispAddressUtil.asIpv4PrefixEid(subnet.getCidr().stringValue());
 
         try {
             final OdlMappingserviceService lfmdb = lispNeutronService.getMappingDbService();