Prepare for odlparent 3.0.0 checkstyle rules 26/63326/10
authorLorand Jakab <lojakab@cisco.com>
Wed, 20 Sep 2017 11:09:23 +0000 (14:09 +0300)
committerLorand Jakab <lojakab@cisco.com>
Mon, 6 Nov 2017 13:58:24 +0000 (15:58 +0200)
Odlparent 3.0.0 will have updated checkstyle rules, see [0] for details.
This patch makes sure the code base will pass those new rules when we
upgrade.

[0] https://lists.opendaylight.org/pipermail/release/2017-September/012353.html

Change-Id: I5d8165f21a276468a2e2262fb106792b0e670885
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
26 files changed:
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/LispMappingService.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/MappingSystem.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/lisp/MapServer.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/MappingSystemTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/lisp/MapResolverTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/lisp/MapServerTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/lisp/MappingServiceTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/util/MappingMergeUtilTest.java
mappingservice/inmemorydb/src/main/java/org/opendaylight/lispflowmapping/inmemorydb/HashMapDb.java
mappingservice/inmemorydb/src/main/java/org/opendaylight/lispflowmapping/inmemorydb/radixtrie/RadixTrie.java
mappingservice/inmemorydb/src/test/java/org/opendaylight/lispflowmapping/inmemorydb/radixtrie/RadixTrieTest.java
mappingservice/mapcache/src/main/java/org/opendaylight/lispflowmapping/mapcache/SimpleMapCache.java
mappingservice/mapcache/src/main/java/org/opendaylight/lispflowmapping/mapcache/lisp/LispMapCacheStringifier.java
mappingservice/mapcache/src/test/java/org/opendaylight/lispflowmapping/mapcache/SimpleMapCacheTest.java
mappingservice/neutron/src/main/java/org/opendaylight/lispflowmapping/neutron/intenthandler/IntentHandlerAsyncExecutorProvider.java
mappingservice/neutron/src/main/java/org/opendaylight/lispflowmapping/neutron/intenthandler/exception/RlocNotFoundOnVppNode.java
mappingservice/neutron/src/main/java/org/opendaylight/lispflowmapping/neutron/intenthandler/util/InfoUtil.java
mappingservice/neutron/src/main/java/org/opendaylight/lispflowmapping/neutron/intenthandler/util/LispNeutronUtil.java
mappingservice/neutron/src/main/java/org/opendaylight/lispflowmapping/neutron/intenthandler/util/VppNetconfTrasaction.java
mappingservice/neutron/src/main/java/org/opendaylight/lispflowmapping/neutron/intenthandler/util/VppNodeReader.java
mappingservice/neutron/src/main/java/org/opendaylight/lispflowmapping/neutron/mappingmanager/HostInformationManager.java
mappingservice/neutron/src/test/java/org/opendaylight/lispflowmapping/neutron/PortDataProcessorTest.java
mappingservice/southbound/src/main/java/org/opendaylight/lispflowmapping/southbound/LispSouthboundPlugin.java
mappingservice/southbound/src/test/java/org/opendaylight/lispflowmapping/southbound/LispSouthboundPluginTest.java
mappingservice/southbound/src/test/java/org/opendaylight/lispflowmapping/southbound/lisp/LispSouthboundHandlerTest.java
mappingservice/southbound/src/test/java/org/opendaylight/lispflowmapping/southbound/lisp/MapRegisterCacheTestUtil.java

index 874a8150b45f39a5497ded9de6c8106aa96520b3..1168243b804cf328cf0c73dc8facab20833f277c 100644 (file)
@@ -101,15 +101,15 @@ public class LispMappingService implements IFlowMapping, IMapRequestResultHandle
         return this.smr;
     }
 
-    public void setShouldUseSmr(boolean smr) {
-        this.smr = smr;
+    public void setShouldUseSmr(boolean shouldUseSmr) {
+        this.smr = shouldUseSmr;
         if (mapServer != null) {
-            mapServer.setSubscriptionService(smr);
+            mapServer.setSubscriptionService(shouldUseSmr);
         }
         if (mapResolver != null) {
-            mapResolver.setSubscriptionService(smr);
+            mapResolver.setSubscriptionService(shouldUseSmr);
         }
-        ConfigIni.getInstance().setSmr(smr);
+        ConfigIni.getInstance().setSmr(shouldUseSmr);
     }
 
     public NotificationService getNotificationService() {
@@ -257,15 +257,15 @@ public class LispMappingService implements IFlowMapping, IMapRequestResultHandle
     }
 
     @Override
-    public void handleSMR(MapRequest smr, Rloc subscriber) {
+    public void handleSMR(MapRequest smrMapRequest, Rloc subscriber) {
         if (LOG.isDebugEnabled()) {
             LOG.debug("Sending SMR Map-Request to {} with Source-EID {} and EID Record {} (reversed)",
                     LispAddressStringifier.getString(subscriber),
-                    LispAddressStringifier.getString(smr.getSourceEid().getEid()),
-                    LispAddressStringifier.getString(smr.getEidItem().get(0).getEid()));
+                    LispAddressStringifier.getString(smrMapRequest.getSourceEid().getEid()),
+                    LispAddressStringifier.getString(smrMapRequest.getEidItem().get(0).getEid()));
         }
         SendMapRequestInputBuilder smrib = new SendMapRequestInputBuilder();
-        smrib.setMapRequest(new MapRequestBuilder(smr).build());
+        smrib.setMapRequest(new MapRequestBuilder(smrMapRequest).build());
         smrib.setTransportAddress(LispNotificationHelper.getTransportAddressFromRloc(subscriber));
         getLispSB().sendMapRequest(smrib.build());
 
index b7ee94c5c501af3bad2b10b44eaac41d5a2fa0c9..5a75a814bbbeb83ec2d4c78921d19f2ae13e5293 100644 (file)
@@ -112,8 +112,8 @@ public class MappingSystem implements IMappingSystem {
                 this);
     }
 
-    public void setDataStoreBackEnd(DataStoreBackEnd dsbe) {
-        this.dsbe = dsbe;
+    public void setDataStoreBackEnd(DataStoreBackEnd dataStoreBackEnd) {
+        this.dsbe = dataStoreBackEnd;
     }
 
     @Override
index 924c1c4347f2a974fbd6371783fc654166fc0bb4..65e659ccc3a71156208015d74c4e0d925858bafd 100644 (file)
@@ -503,16 +503,16 @@ public class MapServer implements IMapServerAsync, OdlMappingserviceListener, IS
                 executionCount++;
             }
 
-            private void cancelAndRemove(Subscriber subscriber, Eid eid) {
+            private void cancelAndRemove(Subscriber sub, Eid eid) {
                 final Map<Subscriber, ScheduledFuture<?>> subscriberFutureMap = eidFutureMap.get(eid);
                 if (subscriberFutureMap == null) {
-                    LOG.warn("Couldn't find subscriber {} in SMR scheduler internal list", subscriber);
+                    LOG.warn("Couldn't find subscriber {} in SMR scheduler internal list", sub);
                     return;
                 }
 
-                if (subscriberFutureMap.containsKey(subscriber)) {
-                    ScheduledFuture<?> eidFuture = subscriberFutureMap.get(subscriber);
-                    subscriberFutureMap.remove(subscriber);
+                if (subscriberFutureMap.containsKey(sub)) {
+                    ScheduledFuture<?> eidFuture = subscriberFutureMap.get(sub);
+                    subscriberFutureMap.remove(sub);
                     eidFuture.cancel(false);
                 }
                 if (subscriberFutureMap.isEmpty()) {
index ebb5d71fc64f71cb49a28c687bd71b881a47de24..9e7e85ce6502eaca9e5d163eb3c6b1257cfb98e3 100644 (file)
@@ -104,8 +104,9 @@ public class MappingSystemTest {
     private static final Eid EID_IPV4_1 = LispAddressUtil.asIpv4Eid(IPV4_STRING_1);
     private static final Eid EID_IPV4_2 = LispAddressUtil.asIpv4Eid(IPV4_STRING_2);
     private static final Eid EID_SERVICE_PATH = new EidBuilder().setAddress(getDefaultServicePath((short) 253)).build();
+    // with index out of bounds
     private static final Eid EID_SERVICE_PATH_INDEX_OOB = new EidBuilder()
-            .setAddress(getDefaultServicePath((short) 200)).build(); // with index out of bounds
+            .setAddress(getDefaultServicePath((short) 200)).build();
 
     public static final SimpleAddress SIMPLE_ADDR_1 = new SimpleAddress(new IpAddress(new Ipv4Address(IPV4_STRING_1)));
     public static final SimpleAddress SIMPLE_ADDR_2 = new SimpleAddress(new IpAddress(new Ipv4Address(IPV4_STRING_2)));
@@ -203,7 +204,8 @@ public class MappingSystemTest {
     public void getMappingTest_NbFirst_withServicePathDestinationAddress_multipleLocatorRecords() {
         final MappingRecord mappingRecord = getDefaultMappingRecordBuilder()
                 .setLocatorRecord(Lists.newArrayList(
-                        getDefaultLocatorRecordBuilder().build(), // set two locators
+                        // set two locators
+                        getDefaultLocatorRecordBuilder().build(),
                         getDefaultLocatorRecordBuilder().build())).build();
         final MappingData mappingData = getDefaultMappingData(mappingRecord);
         Mockito.when(pmcMock.getMapping(EID_IPV4_SRC, EID_SERVICE_PATH)).thenReturn(mappingData);
@@ -219,7 +221,8 @@ public class MappingSystemTest {
     public void getMappingTest_NbFirst_withServicePathDestinationAddress_singleIpv4LocatorRecord() {
         final MappingRecord mappingRecord = getDefaultMappingRecordBuilder()
                 .setLocatorRecord(Lists.newArrayList(
-                        getDefaultLocatorRecordBuilder().build())).build(); // Ipv4 type Rloc
+                        // Ipv4 type Rloc
+                        getDefaultLocatorRecordBuilder().build())).build();
         final MappingData mappingData = getDefaultMappingData(mappingRecord);
         Mockito.when(pmcMock.getMapping(EID_IPV4_SRC, EID_SERVICE_PATH)).thenReturn(mappingData);
 
@@ -314,7 +317,8 @@ public class MappingSystemTest {
         setLookupPolicy(IMappingService.LookupPolicy.NB_AND_SB);
         final MappingRecord mappingRecord = getDefaultMappingRecordBuilder()
                 .setLocatorRecord(Lists.newArrayList(
-                        getDefaultLocatorRecordBuilder().build())).build(); // Ipv4 type Rloc
+                        // Ipv4 type Rloc
+                        getDefaultLocatorRecordBuilder().build())).build();
         final MappingData mappingData = getDefaultMappingData(mappingRecord);
         Mockito.when(pmcMock.getMapping(EID_IPV4_SRC, EID_SERVICE_PATH)).thenReturn(mappingData);
 
@@ -332,7 +336,8 @@ public class MappingSystemTest {
 
         final MappingRecord mappingRecord = getDefaultMappingRecordBuilder()
                 .setLocatorRecord(Lists.newArrayList(
-                        getDefaultLocatorRecordBuilder().build())).build(); // Ipv4 type Rloc
+                        // Ipv4 type Rloc
+                        getDefaultLocatorRecordBuilder().build())).build();
         MappingData nbMappingData = getDefaultMappingData(mappingRecord);
         MappingData sbMappingData = getDefaultMappingData(mappingRecord);
         sbMappingData.setTimestamp(EXPIRED_DATE);
index 09feab567931317110db5d4544bad95455c6e372..d1b64a73b93740006f305fc2a1d3f761f6adb33e 100644 (file)
@@ -349,8 +349,10 @@ public class MapResolverTest {
         mapResolver = new MapResolver(mapServiceMock, true, "both", lispMappingServiceMock);
 
         final List<IpAddress> ipAddressList = new ArrayList<>();
-        ipAddressList.add(IPV4_ADDRESS_1); // hop 1
-        ipAddressList.add(IPV4_ADDRESS_2); // hop 2
+        // hop 1
+        ipAddressList.add(IPV4_ADDRESS_1);
+        // hop 2
+        ipAddressList.add(IPV4_ADDRESS_2);
 
         final Rloc rloc = LispAddressUtil.asTeLcafRloc(ipAddressList);
         final LocatorRecordBuilder locatorRecordBuilder_1 = getDefaultLocatorBuilder();
@@ -362,30 +364,31 @@ public class MapResolverTest {
         mappingRecordBuilder.getLocatorRecord().add(locatorRecordBuilder_2.build());
         final MappingData mappingData = getDefaultMappingData(mappingRecordBuilder.build());
 
-        final MapRequestBuilder mapRequestBuilder = getDefaultMapRequestBuilder();
-        mapRequestBuilder.getItrRloc().add(new ItrRlocBuilder().setRloc(LispAddressUtil.asIpv4Rloc(IPV4_STRING_1))
-                .build());
-        mapRequestBuilder.getItrRloc().add(new ItrRlocBuilder().setRloc(LispAddressUtil.asIpv4Rloc(IPV4_STRING_2))
-                .build());
+        final MapRequestBuilder mrb = getDefaultMapRequestBuilder();
+        mrb.getItrRloc().add(new ItrRlocBuilder().setRloc(LispAddressUtil.asIpv4Rloc(IPV4_STRING_1)).build());
+        mrb.getItrRloc().add(new ItrRlocBuilder().setRloc(LispAddressUtil.asIpv4Rloc(IPV4_STRING_2)).build());
 
-        Mockito.when(mapServiceMock.getMapping(mapRequestBuilder.getSourceEid().getEid(), IPV4_PREFIX_EID_1))
-                .thenReturn(mappingData);
+        Mockito.when(mapServiceMock.getMapping(mrb.getSourceEid().getEid(), IPV4_PREFIX_EID_1)).thenReturn(mappingData);
 
         // result
         final LocatorRecordBuilder locatorRecordBuilder_3 = getDefaultLocatorBuilder()
-                .setRloc(LispAddressUtil.asIpv4Rloc(IPV4_STRING_2)).setPriority((short) 1); // priority increased by 1
+                // priority increased by 1
+                .setRloc(LispAddressUtil.asIpv4Rloc(IPV4_STRING_2)).setPriority((short) 1);
         final MappingRecordBuilder resultMappingRecordBuilder = getDefaultMappingRecordBuilder();
 
-        resultMappingRecordBuilder.getLocatorRecord().add(locatorRecordBuilder_1.build()); // as Ipv4
-        resultMappingRecordBuilder.getLocatorRecord().add(locatorRecordBuilder_2.build()); // as ELP
-        resultMappingRecordBuilder.getLocatorRecord().add(locatorRecordBuilder_3.build()); // added to the result
+        // as Ipv4
+        resultMappingRecordBuilder.getLocatorRecord().add(locatorRecordBuilder_1.build());
+        // as ELP
+        resultMappingRecordBuilder.getLocatorRecord().add(locatorRecordBuilder_2.build());
+        // added to the result
+        resultMappingRecordBuilder.getLocatorRecord().add(locatorRecordBuilder_3.build());
 
         final MapReplyBuilder mapReplyBuilder = getDefaultMapReplyBuilder();
         mapReplyBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
                 .setMappingRecord(resultMappingRecordBuilder.build()).build());
 
         // invocation
-        mapResolver.handleMapRequest(mapRequestBuilder.build());
+        mapResolver.handleMapRequest(mrb.build());
         Mockito.verify(lispMappingServiceMock).handleMapReply(mapReplyBuilder.build());
     }
 
@@ -397,8 +400,10 @@ public class MapResolverTest {
         mapResolver = new MapResolver(mapServiceMock, true, "replace", lispMappingServiceMock);
 
         final List<IpAddress> ipAddressList = new ArrayList<>();
-        ipAddressList.add(IPV4_ADDRESS_1); // hop 1
-        ipAddressList.add(IPV4_ADDRESS_2); // hop 2
+        // hop 1
+        ipAddressList.add(IPV4_ADDRESS_1);
+        // hop 2
+        ipAddressList.add(IPV4_ADDRESS_2);
 
         final Rloc rloc = LispAddressUtil.asTeLcafRloc(ipAddressList);
         final LocatorRecordBuilder locatorRecordBuilder_1 = getDefaultLocatorBuilder();
@@ -410,29 +415,28 @@ public class MapResolverTest {
         mappingRecordBuilder.getLocatorRecord().add(locatorRecordBuilder_2.build());
         final MappingData mappingData = getDefaultMappingData(mappingRecordBuilder.build());
 
-        final MapRequestBuilder mapRequestBuilder = getDefaultMapRequestBuilder();
-        mapRequestBuilder.getItrRloc().add(new ItrRlocBuilder().setRloc(LispAddressUtil.asIpv4Rloc(IPV4_STRING_1))
-                .build());
-        mapRequestBuilder.getItrRloc().add(new ItrRlocBuilder().setRloc(LispAddressUtil.asIpv4Rloc(IPV4_STRING_2))
-                .build());
+        final MapRequestBuilder mrb = getDefaultMapRequestBuilder();
+        mrb.getItrRloc().add(new ItrRlocBuilder().setRloc(LispAddressUtil.asIpv4Rloc(IPV4_STRING_1)).build());
+        mrb.getItrRloc().add(new ItrRlocBuilder().setRloc(LispAddressUtil.asIpv4Rloc(IPV4_STRING_2)).build());
 
-        Mockito.when(mapServiceMock.getMapping(mapRequestBuilder.getSourceEid().getEid(), IPV4_PREFIX_EID_1))
-                .thenReturn(mappingData);
+        Mockito.when(mapServiceMock.getMapping(mrb.getSourceEid().getEid(), IPV4_PREFIX_EID_1)).thenReturn(mappingData);
 
         // result
         final LocatorRecordBuilder locatorRecordBuilder_3 = getDefaultLocatorBuilder()
                 .setRloc(LispAddressUtil.asIpv4Rloc(IPV4_STRING_2));
         final MappingRecordBuilder resultMappingRecordBuilder = getDefaultMappingRecordBuilder();
 
-        resultMappingRecordBuilder.getLocatorRecord().add(locatorRecordBuilder_1.build()); // as Ipv4
-        resultMappingRecordBuilder.getLocatorRecord().add(locatorRecordBuilder_3.build()); // added to the result
+        // as Ipv4
+        resultMappingRecordBuilder.getLocatorRecord().add(locatorRecordBuilder_1.build());
+        // added to the result
+        resultMappingRecordBuilder.getLocatorRecord().add(locatorRecordBuilder_3.build());
 
         final MapReplyBuilder mapReplyBuilder = getDefaultMapReplyBuilder();
         mapReplyBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder()
                 .setMappingRecord(resultMappingRecordBuilder.build()).build());
 
         // invocation
-        mapResolver.handleMapRequest(mapRequestBuilder.build());
+        mapResolver.handleMapRequest(mrb.build());
         Mockito.verify(lispMappingServiceMock).handleMapReply(mapReplyBuilder.build());
     }
 
index 928a41e341a338a17fb308f0373023ab78215c6e..160fef23e298ee9c946877dbf1d59f981e286b22 100644 (file)
@@ -116,20 +116,26 @@ public class MapServerTest {
 
     private static final long TWO_DAYS = 86400000L * 2;
 
-    private static final Subscriber SUBSCRIBER_RLOC_1 = new Subscriber(RLOC_1,         // timedOut() == true
+    // timedOut() == true
+    private static final Subscriber SUBSCRIBER_RLOC_1 = new Subscriber(RLOC_1,
             IPV4_SOURCE_EID_1, Subscriber.DEFAULT_SUBSCRIBER_TIMEOUT,
             new Date(System.currentTimeMillis() - TWO_DAYS));
-    private static final Subscriber SUBSCRIBER_RLOC_2 = new Subscriber(RLOC_2,         // timedOut() == false
+    // timedOut() == false
+    private static final Subscriber SUBSCRIBER_RLOC_2 = new Subscriber(RLOC_2,
             IPV4_SOURCE_EID_2, Subscriber.DEFAULT_SUBSCRIBER_TIMEOUT);
-    private static final Subscriber SUBSCRIBER_RLOC_3 = new Subscriber(RLOC_3,         // timedOut() == true
+    // timedOut() == true
+    private static final Subscriber SUBSCRIBER_RLOC_3 = new Subscriber(RLOC_3,
             IPV4_SOURCE_EID_3, Subscriber.DEFAULT_SUBSCRIBER_TIMEOUT,
             new Date(System.currentTimeMillis() - TWO_DAYS));
-    private static final Subscriber SUBSCRIBER_RLOC_4 = new Subscriber(RLOC_4,         // timedOut() == false
+    // timedOut() == false
+    private static final Subscriber SUBSCRIBER_RLOC_4 = new Subscriber(RLOC_4,
             IPV4_SOURCE_EID_4, Subscriber.DEFAULT_SUBSCRIBER_TIMEOUT);
-    private static final Subscriber SUBSCRIBER_RLOC_5 = new Subscriber(RLOC_5,         // timedOut() == true
+    // timedOut() == true
+    private static final Subscriber SUBSCRIBER_RLOC_5 = new Subscriber(RLOC_5,
             IPV4_SOURCE_EID_5, Subscriber.DEFAULT_SUBSCRIBER_TIMEOUT,
             new Date(System.currentTimeMillis() - TWO_DAYS));
-    private static final Subscriber SUBSCRIBER_RLOC_6 = new Subscriber(RLOC_6,         // timedOut() == false
+    // timedOut() == false
+    private static final Subscriber SUBSCRIBER_RLOC_6 = new Subscriber(RLOC_6,
             IPV4_SOURCE_EID_6, Subscriber.DEFAULT_SUBSCRIBER_TIMEOUT);
 
     private static final Eid SOURCE_DEST_KEY_EID = LispAddressUtil
@@ -539,14 +545,14 @@ public class MapServerTest {
                 .setEid(eid);
     }
 
-    private static MapNotifyBuilder getDefaultMapNotifyBuilder(MapRegister mapRegister) {
+    private static MapNotifyBuilder getDefaultMapNotifyBuilder(MapRegister mr) {
         final MapNotifyBuilder mapNotifyBuilder = new MapNotifyBuilder()
-                .setXtrSiteIdPresent(mapRegister.isXtrSiteIdPresent())
-                .setSiteId(mapRegister.getSiteId())
-                .setXtrId(mapRegister.getXtrId())
-                .setNonce(mapRegister.getNonce())
-                .setKeyId(mapRegister.getKeyId())
-                .setMergeEnabled(mapRegister.isMergeEnabled())
+                .setXtrSiteIdPresent(mr.isXtrSiteIdPresent())
+                .setSiteId(mr.getSiteId())
+                .setXtrId(mr.getXtrId())
+                .setNonce(mr.getNonce())
+                .setKeyId(mr.getKeyId())
+                .setMergeEnabled(mr.isMergeEnabled())
                 .setMappingRecordItem(new ArrayList<>())
                 .setAuthenticationData(new byte[]{});
         mapNotifyBuilder.getMappingRecordItem().add(getDefaultMappingRecordItemBuilder().build());
index 8eb516b0f9b15eab9a9e632488476758756af7f9..83d9c2f38d80643f018929e306bc2e0b42573483 100644 (file)
@@ -116,7 +116,8 @@ public class MappingServiceTest {
         // input
         final RpcResult<Object> rpc = RpcResultBuilder.failed().withError(RpcError.ErrorType.PROTOCOL, "data-exists",
                 "Key already exists! Please use update-key if you want to change it.").build();
-        final RpcError error = rpc.getErrors().iterator().next(); // equals() not implemented int RpcError
+        // equals() not implemented int RpcError
+        final RpcError error = rpc.getErrors().iterator().next();
 
         // result
         final Future<RpcResult<Void>> result = mappingService.addKey(addKeyInput);
index 263eb2d3865a4f7e9374b0e62cc039b5f3b4c64f..38620100014659505ec244738f59c85264eaccc8 100644 (file)
@@ -244,10 +244,12 @@ public class MappingMergeUtilTest {
         assertEquals(2, result.getRecord().getLocatorRecord().size());
 
         assertEquals("NB-locator-id", resultLocator_1.getLocatorId());
-        assertEquals(255, (short) resultLocator_1.getPriority()); // priority changed to 255
+        // priority changed to 255
+        assertEquals(255, (short) resultLocator_1.getPriority());
 
         assertEquals("NB-locator-id", resultLocator_2.getLocatorId());
-        assertEquals(1, (short) resultLocator_2.getPriority());   // priority remains original
+        // priority remains original
+        assertEquals(1, (short) resultLocator_2.getPriority());
     }
 
     private static MappingData getDefaultMappingData() {
index 0df70387a75e4986ac4371e30a37de8c69c535eb..df27cd8f91ab75f64a5a6ca61f2474cadcd0a127 100644 (file)
@@ -107,17 +107,17 @@ public class HashMapDb implements ILispDAO, AutoCloseable {
 
     @Override
     public SimpleImmutableEntry<Eid, Map<String, ?>> getBestPair(Object key) {
-        Map<String, ?> data = null;
+        Map<String, ?> result = null;
 
         if (key instanceof Eid) {
             Eid eid = (Eid) key;
             RadixTrie<Object>.TrieNode node = lookupBestNode(eid);
             if (node == null) {
-                data = get(key);
-                return (data == null) ? null : new SimpleImmutableEntry<>((Eid)key, data);
+                result = get(key);
+                return (result == null) ? null : new SimpleImmutableEntry<>((Eid)key, result);
             }
-            data = get(node.data());
-            return (data == null) ? null : new SimpleImmutableEntry<>((Eid)node.data(), data);
+            result = get(node.data());
+            return (result == null) ? null : new SimpleImmutableEntry<>((Eid)node.data(), result);
         }
         return null;
     }
index 744bfe605dc00d5057ae183b59132ab312a32742..ef14492fefb0b9d009587a61ad52589d32bb4c7d 100644 (file)
@@ -400,7 +400,8 @@ public class RadixTrie<T> {
             this.bit = prefixlen;
             this.prefix = prefix;
             this.data = data;
-            left = right = null;
+            left = null;
+            right = null;
         }
 
         public byte[] prefix() {
@@ -418,15 +419,15 @@ public class RadixTrie<T> {
         /**
          * Finds closest prefix NOT the longest prefix match.
          *
-         * @param prefix Searched prefix
+         * @param pref Searched prefix
          * @param preflen Searched prefix length
          * @return The node found
          */
-        public TrieNode findClosest(byte[] prefix, int preflen) {
+        public TrieNode findClosest(byte[] pref, int preflen) {
             TrieNode node = this;
 
             while (node.prefix == null || node.bit < preflen) {
-                if (testBitInPrefixByte(prefix, node.bit)) {
+                if (testBitInPrefixByte(pref, node.bit)) {
                     if (node.right == null) {
                         break;
                     }
@@ -449,18 +450,19 @@ public class RadixTrie<T> {
         /**
          * Compares prefix to node's prefix and returns position of first different bit.
          *
-         * @param prefix Prefix to be compared.
+         * @param pref Prefix to be compared.
          * @param preflen Prefix length.
          * @return Position of first different bit.
          */
-        public int firstDifferentBit(byte[] prefix, int preflen) {
+        public int firstDifferentBit(byte[] pref, int preflen) {
             int bitxor;
 
             int maxbit = (bit < preflen) ? bit : preflen;
             int diffbit = 0;
             for (int i = 0; i * 8 < maxbit; i++) {
+                bitxor = ((toUnsignedInt(this.prefix[i])) ^ toUnsignedInt(pref[i]));
                 // if match, move to next byte
-                if ((bitxor = ((toUnsignedInt(this.prefix[i])) ^ toUnsignedInt(prefix[i]))) == 0) {
+                if (bitxor == 0) {
                     diffbit = (i + 1) * 8;
                     continue;
                 }
@@ -515,10 +517,10 @@ public class RadixTrie<T> {
          * @param pref Prefix to be inserted.
          * @param preflen Prefix length of the prefix to be inserted.
          * @param diffbit Bit index of the first different bit between prefix and current node
-         * @param data Data to be stored together with the prefix
+         * @param prefdata Data to be stored together with the prefix
          * @return The trie node created or current node if it's an overwrite.
          */
-        public TrieNode insert(byte[] pref, int preflen, int diffbit, T data, byte[] closest) {
+        public TrieNode insert(byte[] pref, int preflen, int diffbit, T prefdata, byte[] closest) {
             TrieNode parent;
 
             // same node, check if prefix needs saving
@@ -527,12 +529,12 @@ public class RadixTrie<T> {
                     return this;
                 }
                 this.prefix = pref;
-                this.data = data;
+                this.data = prefdata;
                 nbActiveNodes++;
                 return this;
             }
 
-            TrieNode newNode = new TrieNode(pref, preflen, data);
+            TrieNode newNode = new TrieNode(pref, preflen, prefdata);
 
             // node is more specific, add new prefix as parent
             if (preflen == diffbit) {
@@ -660,7 +662,9 @@ public class RadixTrie<T> {
                     return false;
                 }
             }
-            if ((remainder = bit % 8) != 0) {
+
+            remainder = bit % 8;
+            if (remainder != 0) {
                 int mask = (0xFF << (8 - remainder)) & 0xFF;
                 return ((prefix[iterator] & mask) == (pref[iterator] & mask));
             }
index 6b17a29744680a4c62c00a93fe0e75a75c91af75..ccd259b242f8915c9bb4b57dcce10da27bb59c14 100644 (file)
@@ -452,63 +452,63 @@ public class RadixTrieTest {
 
     @Test
     public void testClearIntermediariesToRoot() {
-        RadixTrie<String> radixTrie4 = new RadixTrie<>(32);
+        RadixTrie<String> stringRadixTrie4 = new RadixTrie<>(32);
 
         // Add prefixes
-        radixTrie4.insert(IP4_BYTES22, 32, "1.1.1.1");
-        radixTrie4.insert(IP4_BYTES23, 32, "2.2.2.2");
-        radixTrie4.insert(IP4_BYTES24, 32, "10.10.10.10");
-        radixTrie4.insert(IP4_BYTES25, 32, "20.20.20.20");
+        stringRadixTrie4.insert(IP4_BYTES22, 32, "1.1.1.1");
+        stringRadixTrie4.insert(IP4_BYTES23, 32, "2.2.2.2");
+        stringRadixTrie4.insert(IP4_BYTES24, 32, "10.10.10.10");
+        stringRadixTrie4.insert(IP4_BYTES25, 32, "20.20.20.20");
 
         // Remove 10.10.10.10 & 20.20.20.20 (root should be updated)
-        radixTrie4.remove(IP4_BYTES24, 32);
-        radixTrie4.remove(IP4_BYTES25, 32);
+        stringRadixTrie4.remove(IP4_BYTES24, 32);
+        stringRadixTrie4.remove(IP4_BYTES25, 32);
 
         // Re-add 10.10.10.10 & 20.20.20.20
-        radixTrie4.insert(IP4_BYTES24, 32, "10.10.10.10");
-        radixTrie4.insert(IP4_BYTES25, 32, "20.20.20.20");
+        stringRadixTrie4.insert(IP4_BYTES24, 32, "10.10.10.10");
+        stringRadixTrie4.insert(IP4_BYTES25, 32, "20.20.20.20");
 
         // Make sure 10.10.10.10 & 20.20.20.20 lookup succeeds
-        RadixTrie<String>.TrieNode res2 = radixTrie4.lookupBest(IP4_BYTES24, 32);
+        RadixTrie<String>.TrieNode res2 = stringRadixTrie4.lookupBest(IP4_BYTES24, 32);
         assertTrue("Lookup 10.10.10.10 result is NULL", res2 != null);
         assertTrue("Lookup Result for 10.10.10.10 is not right", res2.data().equals("10.10.10.10"));
-        RadixTrie<String>.TrieNode res3 = radixTrie4.lookupBest(IP4_BYTES25, 32);
+        RadixTrie<String>.TrieNode res3 = stringRadixTrie4.lookupBest(IP4_BYTES25, 32);
         assertTrue("Lookup 20.20.20.20 result is NULL", res3 != null);
         assertTrue("Lookup Result for 20.20.20.20 is not right", res3.data().equals("20.20.20.20"));
 
         // Remove 10.10.10.10 & 20.20.20.20 (root should be updated)
-        radixTrie4.remove(IP4_BYTES24, 32);
-        radixTrie4.remove(IP4_BYTES25, 32);
+        stringRadixTrie4.remove(IP4_BYTES24, 32);
+        stringRadixTrie4.remove(IP4_BYTES25, 32);
 
         // Add 10.10.10.0 & 20.20.20.0
-        radixTrie4.insert(IP4_BYTES25, 24, "20.20.20.0");
-        radixTrie4.insert(IP4_BYTES24, 24, "10.10.10.0");
+        stringRadixTrie4.insert(IP4_BYTES25, 24, "20.20.20.0");
+        stringRadixTrie4.insert(IP4_BYTES24, 24, "10.10.10.0");
 
-        RadixTrie<String>.TrieNode res4 = radixTrie4.lookupBest(IP4_BYTES23, 32);
+        RadixTrie<String>.TrieNode res4 = stringRadixTrie4.lookupBest(IP4_BYTES23, 32);
         assertTrue("Lookup 2.2.2.2 result is NULL", res4 != null);
         assertTrue("Lookup Result for 2.2.2.2 is not right", res4.data().equals("2.2.2.2"));
-        RadixTrie<String>.TrieNode res5 = radixTrie4.lookupBest(IP4_BYTES22, 32);
+        RadixTrie<String>.TrieNode res5 = stringRadixTrie4.lookupBest(IP4_BYTES22, 32);
         assertTrue("Lookup 1.1.1.1 result is NULL", res5 != null);
         assertTrue("Lookup Result for 1.1.1.1 is not right", res5.data().equals("1.1.1.1"));
 
-        RadixTrie<String>.TrieNode res6 = radixTrie4.lookupBest(IP4_BYTES25, 24);
+        RadixTrie<String>.TrieNode res6 = stringRadixTrie4.lookupBest(IP4_BYTES25, 24);
         assertTrue("Lookup 20.20.20.20 result is NULL", res6 != null);
         assertTrue("Lookup Result for 20.20.20.0 is not right", res6.data().equals("20.20.20.0"));
-        RadixTrie<String>.TrieNode res7 = radixTrie4.lookupBest(IP4_BYTES24, 24);
+        RadixTrie<String>.TrieNode res7 = stringRadixTrie4.lookupBest(IP4_BYTES24, 24);
         assertTrue("Lookup 10.10.10.10 result is NULL", res7 != null);
         assertTrue("Lookup Result for 10.10.10.0 is not right", res7.data().equals("10.10.10.0"));
     }
 
     @Test
     public void testLookupExact() {
-        RadixTrie<String> radixTrie4 = new RadixTrie<>(32);
+        RadixTrie<String> stringRadixTrie4 = new RadixTrie<>(32);
 
-        radixTrie4.insert(IP4_BYTES1, 16, "192.168.0.0");
+        stringRadixTrie4.insert(IP4_BYTES1, 16, "192.168.0.0");
 
-        RadixTrie<String>.TrieNode res1 = radixTrie4.lookupExact(IP4_BYTES4, 24);
+        RadixTrie<String>.TrieNode res1 = stringRadixTrie4.lookupExact(IP4_BYTES4, 24);
         assertTrue("Lookup for 192.168.1.0 is not NULL", res1 == null);
 
-        RadixTrie<String>.TrieNode res2 = radixTrie4.lookupExact(IP4_BYTES1, 16);
+        RadixTrie<String>.TrieNode res2 = stringRadixTrie4.lookupExact(IP4_BYTES1, 16);
         assertTrue("Lookup for 192.168.0.0 is NULL", res2 != null);
     }
 
index 562cd3fa19bb5e1256e3f56635dcd452b5853cd7..e7a5753d018a416c4cc5d1913178814ee00a6a28 100644 (file)
@@ -66,10 +66,10 @@ public class SimpleMapCache implements ILispMapCache {
         return table;
     }
 
-    private ILispDAO getOrInstantiateXtrIdTable(Eid eid, ILispDAO dao) {
-        ILispDAO table = (ILispDAO) dao.getSpecific(eid, SubKeys.XTRID_RECORDS);
+    private ILispDAO getOrInstantiateXtrIdTable(Eid eid, ILispDAO lispDAO) {
+        ILispDAO table = (ILispDAO) lispDAO.getSpecific(eid, SubKeys.XTRID_RECORDS);
         if (table == null) {
-            table = dao.putNestedTable(eid, SubKeys.XTRID_RECORDS);
+            table = lispDAO.putNestedTable(eid, SubKeys.XTRID_RECORDS);
         }
         return table;
     }
@@ -99,8 +99,8 @@ public class SimpleMapCache implements ILispMapCache {
 
     // Returns the mapping corresponding to the longest prefix match for eid. eid must be a simple (maskable or not)
     // address
-    private Object getMappingLpmEid(Eid eid, XtrId xtrId, ILispDAO dao) {
-        SimpleImmutableEntry<Eid, Map<String, ?>> daoEntry = dao.getBestPair(MaskUtil.normalize(eid));
+    private Object getMappingLpmEid(Eid eid, XtrId xtrId, ILispDAO lispDAO) {
+        SimpleImmutableEntry<Eid, Map<String, ?>> daoEntry = lispDAO.getBestPair(MaskUtil.normalize(eid));
         if (daoEntry != null) {
             if (xtrId != null) {
                 ILispDAO xtrIdTable = (ILispDAO) daoEntry.getValue().get(SubKeys.XTRID_RECORDS);
@@ -134,10 +134,10 @@ public class SimpleMapCache implements ILispMapCache {
     }
 
     // Returns the list of mappings stored in an xTR-ID DAO
-    private List<Object> getXtrIdMappingList(ILispDAO dao) {
-        if (dao != null) {
+    private List<Object> getXtrIdMappingList(ILispDAO lispDAO) {
+        if (lispDAO != null) {
             final List<Object> records = new ArrayList<>();
-            dao.getAll(new IRowVisitor() {
+            lispDAO.getAll(new IRowVisitor() {
                 public void visitRow(Object keyId, String valueKey, Object value) {
                     if (valueKey.equals(SubKeys.RECORD)) {
                         records.add(value);
index cb80a10492bf992966050c3e3339665549c28dba..96c38c161d67bc3186f8cf9e906db6e81ea6f0cf 100644 (file)
@@ -20,7 +20,11 @@ import org.opendaylight.lispflowmapping.lisp.util.Stringifier;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey;
 
-public class LispMapCacheStringifier {
+public final class LispMapCacheStringifier {
+    // Utility class, should not be instantiated
+    private LispMapCacheStringifier() {
+    }
+
     public static String printKeys(ILispDAO dao) {
         final StringBuilder sb = new StringBuilder();
         sb.append("Keys\tValues\n");
index 2fcd1477d986b3b40e917c802d120610b9e0b10d..4694debde231c46a8fcf054979bee41c9e332305 100644 (file)
@@ -189,8 +189,8 @@ public class SimpleMapCacheTest {
         Mockito.when(daoMock.getSpecific(VNI_0, SubKeys.VNI)).thenReturn(tableMock);
         Mockito.when(tableMock.getBestPair(NORMALIZED_EID_IPV4_PREFIX_DST)).thenReturn(mapPair);
         Mockito.when(mapMock.get(SubKeys.XTRID_RECORDS)).thenReturn(xtrIdDaoMock);
-        Mockito.when(xtrIdDaoMock.getSpecific(XTR_ID, SubKeys.RECORD))
-                .thenReturn(mappingData);       // second invocation
+        // second invocation
+        Mockito.when(xtrIdDaoMock.getSpecific(XTR_ID, SubKeys.RECORD)).thenReturn(mappingData);
 
         // with non-expired mapping record
         assertEquals(mappingData, simpleMapCache.getMapping(EID_IPV4_PREFIX_DST, XTR_ID));
@@ -375,7 +375,8 @@ public class SimpleMapCacheTest {
         Mockito.when(daoMock.getSpecific(VNI_0, SubKeys.VNI)).thenReturn(tableMock);
         Mockito.when(tableMock.getSpecific(NORMALIZED_EID_2, SubKeys.XTRID_RECORDS)).thenReturn(xtrIdDaoMock);
 
-        simpleMapCache.addMapping(EID_IPV4_PREFIX_2, mappingDataMock); // Eid VNI_100 == null
+        // Eid VNI_100 == null
+        simpleMapCache.addMapping(EID_IPV4_PREFIX_2, mappingDataMock);
         Mockito.verify(daoMock).getSpecific(VNI_0, SubKeys.VNI);
         Mockito.verify(daoMock, Mockito.never()).putNestedTable(VNI_0, SubKeys.VNI);
     }
@@ -389,7 +390,8 @@ public class SimpleMapCacheTest {
         Mockito.when(tableMock.getSpecific(NORMALIZED_EID_2, SubKeys.XTRID_RECORDS)).thenReturn(xtrIdDaoMock);
         Mockito.when(daoMock.putNestedTable(VNI_0, SubKeys.VNI)).thenReturn(tableMock);
 
-        simpleMapCache.addMapping(EID_IPV4_PREFIX_2, mappingDataMock); // Eid VNI_100 == null
+        // Eid VNI_100 == null
+        simpleMapCache.addMapping(EID_IPV4_PREFIX_2, mappingDataMock);
         Mockito.verify(daoMock).putNestedTable(VNI_0, SubKeys.VNI);
     }
 
@@ -402,7 +404,8 @@ public class SimpleMapCacheTest {
         Mockito.when(tableMock.getSpecific(NORMALIZED_EID_1, SubKeys.XTRID_RECORDS)).thenReturn(xtrIdDaoMock);
         Mockito.when(daoMock.putNestedTable(VNI_100, SubKeys.VNI)).thenReturn(tableMock);
 
-        simpleMapCache.addMapping(EID_IPV4_PREFIX_1_VNI, mappingDataMock); // Eid VNI_100 == null
+        // Eid VNI_100 == null
+        simpleMapCache.addMapping(EID_IPV4_PREFIX_1_VNI, mappingDataMock);
         Mockito.verify(daoMock).putNestedTable(VNI_100, SubKeys.VNI);
     }
 
index 7e0a94b498dae636968d7c47485ab18fc1b334ea..f4da63f4c7751b26e4fc5981f898685bf2e2f9da 100644 (file)
@@ -15,7 +15,7 @@ import java.util.concurrent.Executors;
 /**
  * Created by Shakib Ahmed on 1/24/17.
  */
-public class IntentHandlerAsyncExecutorProvider {
+public final class IntentHandlerAsyncExecutorProvider {
     private static ListeningExecutorService listeningExecutorService;
 
     private static final int EXTRA_THREADS_TO_HANDLE_VPP_LISTENER = 1;
@@ -41,4 +41,4 @@ public class IntentHandlerAsyncExecutorProvider {
     public void close() {
         listeningExecutorService.shutdown();
     }
-}
\ No newline at end of file
+}
index d053da17f3b8bb008f7ef7d86efd9b02e2a25ff0..6bf8a10fe7d54bb42b656d24fab5d073f75efc79 100644 (file)
@@ -11,7 +11,13 @@ package org.opendaylight.lispflowmapping.neutron.intenthandler.exception;
  * Created by Shakib Ahmed on 1/12/17.
  */
 public class RlocNotFoundOnVppNode extends RuntimeException {
+    private static final String MESSAGE = "No available interface found on node ";
+
     public RlocNotFoundOnVppNode(String hostId) {
-        super("No available interface found on node " + hostId);
+        super(MESSAGE + hostId);
+    }
+
+    public RlocNotFoundOnVppNode(String hostId, Throwable cause) {
+        super(MESSAGE + hostId, cause);
     }
 }
index b48f512505cf1a9cafb8535e03088c9b3cc46ddd..d1c32f904352759df890d81b6021e4634bcd56df 100644 (file)
@@ -16,10 +16,8 @@ import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 /**
  * Created by Shakib Ahmed on 1/23/17.
  */
-public class InfoUtil {
-
+public final class InfoUtil {
     private InfoUtil() {
-
     }
 
     public static String topology(final KeyedInstanceIdentifier<Topology, TopologyKey> topoIID) {
index 820d76a8837c4623551f0994e52b1d33eb84483f..b4b96c081bf23aa637cf562d976b72f591594696 100644 (file)
@@ -19,10 +19,11 @@ import org.slf4j.LoggerFactory;
 /**
  * Created by Shakib Ahmed on 1/12/17.
  */
-public class LispNeutronUtil {
+public final class LispNeutronUtil {
     protected static final Logger LOG = LoggerFactory.getLogger(LispNeutronUtil.class);
 
-    private LispNeutronUtil(){}
+    private LispNeutronUtil() {
+    }
 
     public static DataBroker resolveDataBrokerForMountPoint(InstanceIdentifier<Node> iiToMountPoint,
                                                             MountPointService mountService) {
index 9a3debb20c849b79bc8155e82dcba37c3fb62de8..bd7b51b2ab7b03d18e89d8663502035a69620874 100644 (file)
@@ -25,11 +25,14 @@ import org.slf4j.LoggerFactory;
 /**
  * Created by Shakib Ahmed on 1/12/17.
  */
-public class VppNetconfTrasaction {
+public final class VppNetconfTrasaction {
     private static final Logger LOG = LoggerFactory.getLogger(VppNetconfTrasaction.class);
 
     public static final byte RETRY_COUNT = 5;
 
+    private VppNetconfTrasaction() {
+    }
+
     public static synchronized <T extends DataObject> Optional<T> read(DataBroker dataBroker,
                                                                        LogicalDatastoreType datastoreType,
                                                                        InstanceIdentifier<T> instanceIdentifier) {
index dad2cff0d0cf943f8ae7010590b6ce15f36de421..031178bcc621d32c3721b5ce052585a20bc60011 100644 (file)
@@ -60,7 +60,7 @@ public class VppNodeReader {
         } catch (final InterruptedException | ExecutionException ex) {
             LOG.warn("Got exception while reading IP addresses from nodes {}",
                     InfoUtil.node(instanceIdentifierToVppNode));
-            throw new RlocNotFoundOnVppNode(InfoUtil.node(instanceIdentifierToVppNode));
+            throw new RlocNotFoundOnVppNode(InfoUtil.node(instanceIdentifierToVppNode), ex);
         }
     }
 
index 516c45aa4669bf912cd3385a1a7dfd6648026b2d..62bfdf07245a1aa9c333aae5ec15aadb0105735d 100644 (file)
@@ -36,7 +36,7 @@ public class HostInformationManager {
 
     private static HostInformationManager instance;
 
-    private HostInformationManager() {
+    HostInformationManager() {
         hostIdToPortDataMapper = new HostIdToPortDataMapper();
         hostIdToRlocMapper = new HostIdToRlocMapper();
         neutronTenantToVniMapper = new NeutronTenantToVniMapper();
@@ -53,8 +53,8 @@ public class HostInformationManager {
         return neutronTenantToVniMapper.getVni(tenantUuid);
     }
 
-    public void setOdlMappingserviceService(OdlMappingserviceService lfmDbService) {
-        this.lfmDbService = lfmDbService;
+    public void setOdlMappingserviceService(OdlMappingserviceService mappingservice) {
+        this.lfmDbService = mappingservice;
     }
 
     public synchronized void addHostRelatedInfo(String hostId, Object data) {
@@ -107,4 +107,4 @@ public class HostInformationManager {
         lfmDbService.removeMapping(removeMappingInput);
         uuidToEidMapper.deleteProcessedPortData(portUuid);
     }
-}
\ No newline at end of file
+}
index 4e5cd1a5d9de426bb5218add1af18792fe1c6f92..5b5058677492c156902bf9e0904071a5600abd4a 100644 (file)
@@ -69,7 +69,8 @@ public class PortDataProcessorTest {
         future = Mockito.mock(Future.class);
         rpcResult = Mockito.mock(RpcResult.class);
         Whitebox.setInternalState(portDataProcessor, "hostInformationManager", hostInformationManager);
-        commonStubbing(); // common stubbing is called before invocation of each test
+        // common stubbing is called before invocation of each test
+        commonStubbing();
     }
 
     /**
@@ -94,7 +95,8 @@ public class PortDataProcessorTest {
      */
     @Test
     public void createTest_nullHostId() throws ExecutionException, InterruptedException {
-        Mockito.when(augmentationMock.getHostId()).thenReturn(null); // overriding default stubbing
+        // overriding default stubbing
+        Mockito.when(augmentationMock.getHostId()).thenReturn(null);
 
         portDataProcessor.create(portMock);
 
index 6977e60773ff2afe3dc9ebb2fef1b74bef852e7e..229d94c266824e0ff11ff05154810ce70941eb42 100644 (file)
@@ -117,11 +117,11 @@ public class LispSouthboundPlugin implements IConfigLispSouthboundPlugin, AutoCl
             this.dsbe = new DataStoreBackEnd(dataBroker);
             restoreDaoFromDatastore();
 
-            LispSouthboundHandler lispSouthboundHandler = new LispSouthboundHandler(this);
-            this.lispSouthboundHandler = lispSouthboundHandler;
+            LispSouthboundHandler lsbh = new LispSouthboundHandler(this);
+            this.lispSouthboundHandler = lsbh;
 
-            LispXtrSouthboundHandler lispXtrSouthboundHandler = new LispXtrSouthboundHandler(this);
-            this.lispXtrSouthboundHandler = lispXtrSouthboundHandler;
+            LispXtrSouthboundHandler lxsbh = new LispXtrSouthboundHandler(this);
+            this.lispXtrSouthboundHandler = lxsbh;
 
             if (Epoll.isAvailable()) {
                 eventLoopGroup = new EpollEventLoopGroup(numChannels, threadFactory);
@@ -137,11 +137,11 @@ public class LispSouthboundPlugin implements IConfigLispSouthboundPlugin, AutoCl
 
             bootstrap.group(eventLoopGroup);
             bootstrap.channel(channelType);
-            bootstrap.handler(lispSouthboundHandler);
+            bootstrap.handler(lsbh);
 
             xtrBootstrap.group(eventLoopGroup);
             xtrBootstrap.channel(channelType);
-            xtrBootstrap.handler(lispXtrSouthboundHandler);
+            xtrBootstrap.handler(lxsbh);
 
             start();
             startXtr();
index 843b6d4e4c9fc7018185d62733b824e4a2e725ee..0f201d7bc57373fda2d223ea7ec445674e5a98fc 100644 (file)
@@ -207,8 +207,8 @@ public class LispSouthboundPluginTest {
         Mockito.verify(handlerMock).close();
         assertNull(getField("lispSouthboundHandler"));
         assertNull(getField("lispXtrSouthboundHandler"));
-        Channel[] channel = getField("channel");
-        assertNull(channel[0]);
+        Channel[] channels = getField("channel");
+        assertNull(channels[0]);
     }
 
     private static void injectChannel() throws NoSuchFieldException, IllegalAccessException {
index b600dade11cae07e7dd1c7c3802ecccbdb890ca9..aae6e3d8e02ef2a0dcf6163c46968b9613fe78f1 100644 (file)
@@ -169,14 +169,14 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
         // Nonce: 0x3d8d2acd39c8d608
         // ITR-RLOC AFI=1 Address=192.168.136.10
         // Record 1: 1.2.3.4/32
-        mapRequestPacket = extractWSUdpByteArray(new String(
+        mapRequestPacket = extractWSUdpByteArray(
                   "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 "
-                + "0060   00 01 01 02 03 04"));
+                + "0060   00 01 01 02 03 04");
         mapReplyBuilder = new MapReplyBuilder();
         mapReplyBuilder.setMappingRecordItem(new ArrayList<MappingRecordItem>());
         mapReplyBuilder.setNonce((long) 0);
@@ -209,14 +209,14 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
         // 255/0
         //
 
-        mapRegisterPacket = extractWSUdpByteArray(new String(
+        mapRegisterPacket = extractWSUdpByteArray(
                   "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 "
-                + "0060   ff 00 00 05 00 01 c0 a8 88 0a"));
+                + "0060   ff 00 00 05 00 01 c0 a8 88 0a");
         mapNotifyBuilder = new MapNotifyBuilder();
         mapNotifyBuilder.setAuthenticationData(new byte[0]);
     }
@@ -231,31 +231,31 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
 
     @Test(expected = LispMalformedPacketException.class)
     public void mapRegister__IllegalPacket() throws Exception {
-        mapRegisterPacket = extractWSUdpByteArray(new String(
+        mapRegisterPacket = extractWSUdpByteArray(
                   "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 "));
+                + "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(
+        mapRequestPacket = extractWSUdpByteArray(
                   "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 "));
+                + "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(
+        mapRequestPacket = extractWSUdpByteArray(
                   "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 "));
+                + "0020   00 01 e4 c0 10 f6 00 44 fe 57 80 00 00 00 45 00 ");
         handleMapRequestPacket(mapRequestPacket);
     }
 
@@ -267,7 +267,7 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
         // Priority/Weight: 255/0
         // Local RLOC: 192.168.136.51, Reachable, Priority/Weight: 6/100,
         // Multicast Priority/Weight: 255/0
-        mapRegisterPacket = extractWSUdpByteArray(new String(
+        mapRegisterPacket = extractWSUdpByteArray(
                   "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 "
@@ -275,7 +275,7 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
                 + "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"));
+                + "0070   00 01 c0 a8 88 33");
 
         ArgumentCaptor<AddMapping> captor = ArgumentCaptor.forClass(AddMapping.class);
         handleMapRegisterPacket(mapRegisterPacket);
@@ -303,7 +303,7 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
         // Local RLOC: 10.0.58.156, Reachable, Priority/Weight: 1/100, Multicast
         // Priority/Weight: 255/0
 
-        mapRegisterPacket = extractWSUdpByteArray(new String(
+        mapRegisterPacket = extractWSUdpByteArray(
                   "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 "
@@ -311,7 +311,7 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
                 + "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"));
+                + "0070   00 01 0a 00 3a 9c");
 
         ArgumentCaptor<AddMapping> captor = ArgumentCaptor.forClass(AddMapping.class);
         handleMapRegisterPacket(mapRegisterPacket);
@@ -347,14 +347,14 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
 
     @Test
     public void mapRegister__NonSetMBit() throws Exception {
-        byte[] registerWithNonSetMBit = extractWSUdpByteArray(new String(
+        byte[] registerWithNonSetMBit = extractWSUdpByteArray(
                   "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 "
-                + "0060   ff 00 00 05 00 01 c0 a8 88 0a"));
+                + "0060   ff 00 00 05 00 01 c0 a8 88 0a");
 
         ArgumentCaptor<AddMapping> captor = ArgumentCaptor.forClass(AddMapping.class);
         handleMapRegisterPacket(registerWithNonSetMBit);
@@ -364,14 +364,14 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
 
     @Test
     public void mapRegister__NonSetMBitWithNonZeroReservedBits() throws Exception {
-        byte[] registerWithNonSetMBit = extractWSUdpByteArray(new String(
+        byte[] registerWithNonSetMBit = extractWSUdpByteArray(
                   "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 "
-                + "0060   ff 00 00 05 00 01 c0 a8 88 0a"));
+                + "0060   ff 00 00 05 00 01 c0 a8 88 0a");
 
         ArgumentCaptor<AddMapping> captor = ArgumentCaptor.forClass(AddMapping.class);
         handleMapRegisterPacket(registerWithNonSetMBit);
@@ -381,14 +381,14 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
 
     @Test
     public void mapRegister__SetMBitWithNonZeroReservedBits() throws Exception {
-        byte[] registerWithNonSetMBit = extractWSUdpByteArray(new String(
+        byte[] registerWithNonSetMBit = extractWSUdpByteArray(
                   "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 "
-                + "0060   ff 00 00 05 00 01 c0 a8 88 0a"));
+                + "0060   ff 00 00 05 00 01 c0 a8 88 0a");
 
         ArgumentCaptor<AddMapping> captor = ArgumentCaptor.forClass(AddMapping.class);
         handleMapRegisterPacket(registerWithNonSetMBit);
@@ -403,11 +403,13 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
     public void mapRegister_isMappingKeepAliveAndMapNotifyGenerated() throws InterruptedException,
             UnknownHostException {
         byte[] eidPrefixAfi = new byte[] {
-            0x00, 0x01                  //eid-prefix-afi
+            //eid-prefix-afi
+            0x00, 0x01
         };
 
         byte[] eidPrefix = new byte[] {
-            0x0a, 0x0a, 0x0a, 0x0a     //ipv4 address
+            //ipv4 address
+            0x0a, 0x0a, 0x0a, 0x0a
         };
 
         //send stream of byte -> map register message
@@ -446,11 +448,13 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
     @Test
     public void mapRegister_cacheWithEidPrefixIpv4Test() throws InterruptedException {
         byte[] eidPrefixAfi = new byte[] {
-            0x00, 0x01                  //eid-prefix-afi
+            //eid-prefix-afi
+            0x00, 0x01
         };
 
         byte[] eidPrefix = new byte[] {
-            0x0a, 0x0a, 0x0a, 0x0a     //ipv4 address
+            //ipv4 address
+            0x0a, 0x0a, 0x0a, 0x0a
         };
 
         cacheTest(eidPrefixAfi, eidPrefix, MapRegisterCacheTestUtil.AUTH_DATA);
@@ -462,17 +466,22 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
     @Test
     public void mapRegister_cacheWithEidPrefixIpv6Test() throws InterruptedException {
         byte[] eidPrefixAfi = new byte[] {
-            0x00, 0x02                  //eid-prefix-afi
+            //eid-prefix-afi
+            0x00, 0x02
         };
 
         byte[] eidPrefix = new byte[] {
-            0x0f, 0x0f, 0x0f, 0x0f,     //ipv6 address
-            0x0f, 0x0f, 0x0f, 0x0f,     //ipv6 address
-            0x0f, 0x0f, 0x0f, 0x0f,     //ipv6 address
-            0x0f, 0x0f, 0x0f, 0x0f      //ipv6 address
+            //ipv6 address
+            0x0f, 0x0f, 0x0f, 0x0f,
+            //ipv6 address
+            0x0f, 0x0f, 0x0f, 0x0f,
+            //ipv6 address
+            0x0f, 0x0f, 0x0f, 0x0f,
+            //ipv6 address
+            0x0f, 0x0f, 0x0f, 0x0f
         };
 
-        byte[] authenticationData = new byte[]{
+        byte[] authenticationData = new byte[] {
             0x00, 0x14,
             0x41,(byte)0x83,0x13,0x7C,
             0x48,(byte)0xEE,0x75,(byte)0x9A,
@@ -490,14 +499,16 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
     @Test
     public void mapRegister_cacheWithEidPrefixMac48Test() throws InterruptedException {
         byte[] eidPrefixAfi = new byte[] {
-            0x40, 0x05                  //eid-prefix-afi
+            //eid-prefix-afi
+            0x40, 0x05
         };
 
         byte[] eidPrefix = new byte[] {
-            0x0a, 0x0b, 0x0c, 0x0d,     //mac address
-            0x0e, 0x0f                 //mac address
+            //mac address
+            0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
         };
-        byte[] authenticationData = new byte[]{
+
+        byte[] authenticationData = new byte[] {
             0x00, 0x14,
             (byte)0xB2,(byte)0x8E,0x6,(byte)0x9D,
             0x61,(byte)0xD8,0xC,0x24,
@@ -514,7 +525,8 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
     @Test
     public void mapRegister_cacheWithEidPrefixLcafTest() throws InterruptedException {
         byte[] eidPrefixAfi = new byte[] {
-            0x40, 0x03                  //eid-prefix-afi
+            //eid-prefix-afi
+            0x40, 0x03
         };
 
         //following lcaf prefixed variables are defined according to https://tools.ietf
@@ -531,13 +543,19 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
         byte[] eidPrefix = joinArrays(lcafRsvd1, lcafFlags, lcafType, lcafIIDMaskLength, lcafLength, lcafInstanceId,
                 lcafAfi, lcafAddress);
 
-        byte[] authenticationData = new byte[]{
-            0x00, 0x14,                 //authentication data length
-            0x68, 0x1d, (byte) 0x9e, 0x6e,    //auth data
-            0x5e, 0x32, (byte) 0x88, 0x1a,    //auth data
-            (byte) 0xae, 0x6b, (byte) 0xe3, 0x40,    //auth data
-            0x30, (byte) 0x0b, (byte) 0xb6, (byte) 0xa0,    //auth data
-            0x71, (byte) 0xf4, (byte) 0x8c, 0x5f    //auth data
+        byte[] authenticationData = new byte[] {
+            //authentication data length
+            0x00, 0x14,
+            //auth data
+            0x68, 0x1d, (byte) 0x9e, 0x6e,
+            //auth data
+            0x5e, 0x32, (byte) 0x88, 0x1a,
+            //auth data
+            (byte) 0xae, 0x6b, (byte) 0xe3, 0x40,
+            //auth data
+            0x30, (byte) 0x0b, (byte) 0xb6, (byte) 0xa0,
+            //auth data
+            0x71, (byte) 0xf4, (byte) 0x8c, 0x5f
         };
 
 
@@ -715,7 +733,7 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
         // Map-Reply Record: EID prefix: 2610:d0:ffff:192::1/128, TTL: 10,
         // Authoritative, No-Action
 
-        mapRequestPacket = extractWSUdpByteArray(new String(
+        mapRequestPacket = extractWSUdpByteArray(
                   "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 "
@@ -727,7 +745,7 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
                 + "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 "
-                + "00b0   00 01 01 64 ff 00 00 05 00 01 0a 00 3a 9c"));
+                + "00b0   00 01 01 64 ff 00 00 05 00 01 0a 00 3a 9c");
 
         ArgumentCaptor<RequestMapping> captor = ArgumentCaptor.forClass(RequestMapping.class);
         handleMapRequestAsByteArray(mapRequestPacket);
@@ -746,7 +764,7 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
         // (2610:d0:ffff:192::2)
         // encapsulated UDP source port: 4342
 
-        mapRequestPacket = extractWSUdpByteArray(new String(
+        mapRequestPacket = extractWSUdpByteArray(
                   "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 "
@@ -758,7 +776,7 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
                 + "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 "
-                + "00b0   00 01 01 64 ff 00 00 05 00 01 0a 00 3a 9c"));
+                + "00b0   00 01 01 64 ff 00 00 05 00 01 0a 00 3a 9c");
 
         ArgumentCaptor<RequestMapping> captor = ArgumentCaptor.forClass(RequestMapping.class);
         DatagramPacket replyPacket = handleMapRequestPacket(mapRequestPacket);
@@ -771,7 +789,7 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
         // encapsulated LISP packet
         // Source EID = 153.16.254.1
 
-        mapRequestPacket = extractWSUdpByteArray(new String(
+        mapRequestPacket = extractWSUdpByteArray(
                   "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 "
@@ -780,7 +798,7 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
                 + "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 "
-                + "0080   00 01 0a 00 01 26"));
+                + "0080   00 01 0a 00 01 26");
 
         ArgumentCaptor<RequestMapping> captor = ArgumentCaptor.forClass(RequestMapping.class);
         handleMapRequestAsByteArray(mapRequestPacket);
@@ -930,14 +948,14 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
         // UDP: 49289 -> 4342
         // LISP(Type = 14 UNKNOWN!!!, P=1, M=1
 
-        byte[] unknownTypePacket = extractWSUdpByteArray(new String(
+        byte[] unknownTypePacket = extractWSUdpByteArray(
                   "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 "
-                + "0060   ff 00 00 05 00 01 c0 a8 88 0a"));
+                + "0060   ff 00 00 05 00 01 c0 a8 88 0a");
         assertNull(handlePacket(unknownTypePacket));
     }
 
@@ -948,7 +966,7 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
         // ITR-RLOC 1: 10.1.0.111
         // ITR-RLOC 2: 192.168.136.51
         //
-        mapRequestPacket = extractWSUdpByteArray(new String(
+        mapRequestPacket = extractWSUdpByteArray(
                   "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 "
@@ -958,7 +976,7 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
                 + "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"));
+                + "0090   00 05 00 01 c0 a8 88 33");
 
         handleMapRequestAsByteArray(mapRequestPacket);
         Mockito.verify(mockLispSouthboundPlugin).sendNotificationIfPossible(Mockito.any(RequestMapping.class));
@@ -1033,12 +1051,16 @@ public class LispSouthboundHandlerTest extends BaseTestCase {
 
     @Test(expected = LispMalformedPacketException.class)
     public void mapRequest__NoIpItrRloc() throws Exception {
-        mapRequestPacket = hexToByteBuffer("10 00 " //
-                + "02 " // This means 3 ITR - RLOCs
-                + "01 3d 8d 2a cd 39 c8 d6 08 00 00 " //
-                + "40 05 c0 a8 88 0a 01 02 " // MAC (ITR-RLOC #1 of 3)
-                + "40 05 00 00 00 00 00 00 " // MAC (ITR-RLOC #2 of 3)
-                + "40 05 11 22 34 56 78 90 " // MAC (ITR-RLOC #3 of 3)
+        mapRequestPacket = hexToByteBuffer("10 00 "
+                // This means 3 ITR - RLOCs
+                + "02 "
+                + "01 3d 8d 2a cd 39 c8 d6 08 00 00 "
+                // MAC (ITR-RLOC #1 of 3)
+                + "40 05 c0 a8 88 0a 01 02 "
+                // MAC (ITR-RLOC #2 of 3)
+                + "40 05 00 00 00 00 00 00 "
+                // MAC (ITR-RLOC #3 of 3)
+                + "40 05 11 22 34 56 78 90 "
                 + "00 20 00 01 01 02 03 04").array();
         handleMapRequestPacket(mapRequestPacket);
     }
index 966441400a942ae6041f720173596b66355c5c0a..89838d3cdb91586154689c343ab986e006c5b45c 100644 (file)
@@ -24,49 +24,61 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.ma
 
 final class MapRegisterCacheTestUtil {
     static final byte[] DATA1 = new byte[] {
-        0x33, 0x00, 0x01, 0x01     //Type, P, I, R, Reserved, M, Record Count
+        //Type, P, I, R, Reserved, M, Record Count
+        0x33, 0x00, 0x01, 0x01
     };
 
     static final byte[] NONCE = new byte[] {
-        0x00, 0x00, 0x00, 0x00,    //nonce
-        0x00, 0x00, 0x00, 0x00     //nonce
+        0x00, 0x00, 0x00, 0x00,
+        0x00, 0x00, 0x00, 0x00
     };
 
     static final byte[] KEY_ID = new byte[] {
-        0x00, 0x01                 //key ID
+        0x00, 0x01
     };
 
-    static final byte[] AUTH_DATA = new byte[]{
-        0x00, 0x14,                //authentication data length
-        (byte)0xfa, 0x50, 0x1d, (byte)0xd6,    //auth data
-        0x63, 0x53, 0x67, 0x6c,    //auth data
-        0x00, 0x3c, 0x61, 0x67,    //auth data
-        0x35, (byte) 0xb8, (byte) 0xcf, 0x16,    //auth data
-        (byte) 0x91, (byte) 0xcd, 0x6b, (byte) 0x95    //auth data
+    static final byte[] AUTH_DATA = new byte[] {
+        //authentication data length
+        0x00, 0x14,
+        //auth data
+        (byte)0xfa, 0x50, 0x1d, (byte)0xd6,
+        //auth data
+        0x63, 0x53, 0x67, 0x6c,
+        //auth data
+        0x00, 0x3c, 0x61, 0x67,
+        //auth data
+        0x35, (byte) 0xb8, (byte) 0xcf, 0x16,
+        //auth data
+        (byte) 0x91, (byte) 0xcd, 0x6b, (byte) 0x95
     };
 
-    static final byte[] DATA2 = new byte[]{
-        0x00, 0x00, 0x00, 0x6f,    //TTL
+    static final byte[] DATA2 = new byte[] {
+        //TTL
+        0x00, 0x00, 0x00, 0x6f,
+        //Rsvd, Map-Version Number
         0x01, 0x08, 0x00, 0x00,
-        0x00, 0x01                //Rsvd, Map-Version Number
+        0x00, 0x01
     };
 
     static final byte[] DATA3 = new byte[] {
-        0x01, 0x0c, 0x0d, 0x0b,    //Priority, Weight, M Priority, M Weight
-        0x00, 0x00, 0x00, 0x01,    //Unused Flags, L, p, R, Loc-Afi
-        0x0c, 0x0c, 0x0c, 0x0c     //Locator
+        //Priority, Weight, M Priority, M Weight
+        0x01, 0x0c, 0x0d, 0x0b,
+        //Unused Flags, L, p, R, Loc-Afi
+        0x00, 0x00, 0x00, 0x01,
+        //Locator
+        0x0c, 0x0c, 0x0c, 0x0c
     };
 
-    static final byte[] XTR_ID = new byte[]{
-        0x53, 0x61, 0x6e, 0x20,    //xTR id
-        0x4a, 0x6f, 0x73, 0x65,    //xTR id
-        0x2c, 0x20, 0x32, 0x66,    //xTR id
-        0x33, 0x72, 0x32, 0x64     //xTR id
+    static final byte[] XTR_ID = new byte[] {
+        0x53, 0x61, 0x6e, 0x20,
+        0x4a, 0x6f, 0x73, 0x65,
+        0x2c, 0x20, 0x32, 0x66,
+        0x33, 0x72, 0x32, 0x64
     };
 
-    static final byte[] SITE_ID = new byte[]{
-        0x33, 0x2c, 0x31, 0x34,    //site id
-        0x31, 0x35, 0x39, 0x32     //site id
+    static final byte[] SITE_ID = new byte[] {
+        0x33, 0x2c, 0x31, 0x34,
+        0x31, 0x35, 0x39, 0x32
     };
 
 
@@ -90,7 +102,8 @@ final class MapRegisterCacheTestUtil {
         };
 
         final byte[] newAuthenticationData = new byte [] {
-            (byte) 0x00, (byte) 0x14,                            // authentication data length
+            // authentication data length
+            (byte) 0x00, (byte) 0x14,
             (byte) 0x7A, (byte) 0x53, (byte) 0x7F, (byte) 0xF6,
             (byte) 0xB8, (byte) 0x91, (byte) 0x33, (byte) 0x7F,
             (byte) 0xB1, (byte) 0x41, (byte) 0xC3, (byte) 0x51,