Use Uint32 for tableId in ArpUtilImpl 65/92765/4
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 29 Sep 2020 10:24:06 +0000 (12:24 +0200)
committerChetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
Fri, 30 Oct 2020 02:33:20 +0000 (02:33 +0000)
We are using Uint8->int->long->Uint32 conversions here, incurring
two warnings in the process. Use straight Uint8->Uint32 conversion.

Change-Id: I545a4dcf11d1a6d43aba786419290e212a34ee54
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
arputil/arputil-impl/src/main/java/org/opendaylight/genius/arputil/internal/ArpUtilImpl.java

index c074ffc7d595e84eab6c2312df151054c9a449c0..683a8d77ee9336ab002bf7b1bdf0212416c1d28e 100644 (file)
@@ -98,6 +98,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.common.Uint64;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -392,7 +393,7 @@ public class ArpUtilImpl extends AbstractLifecycle implements OdlArputilService,
         if (pktInReason == SendToController.class) {
             try {
                 Uint64 dpnId = extractDpnId(packetReceived);
-                int tableId = packetReceived.getTableId().getValue().toJava();
+                Uint32 tableId = packetReceived.getTableId().getValue().toUint32();
 
                 byte[] data = packetReceived.getPayload();
                 Ethernet ethernet = new Ethernet();
@@ -500,7 +501,7 @@ public class ArpUtilImpl extends AbstractLifecycle implements OdlArputilService,
     }
 
     private void fireArpRespRecvdNotification(String interfaceName, InetAddress srcInetAddr, byte[] srcMacAddressBytes,
-            Uint64 dpnId, int tableId, Uint64 metadata, InetAddress dstInetAddr, byte[] dstMacAddressBytes)
+            Uint64 dpnId, Uint32 tableId, Uint64 metadata, InetAddress dstInetAddr, byte[] dstMacAddressBytes)
                     throws InterruptedException {
         arpRespRecvd.mark();
 
@@ -514,7 +515,7 @@ public class ArpUtilImpl extends AbstractLifecycle implements OdlArputilService,
         builder.setInterface(interfaceName);
         builder.setSrcIpaddress(srcIp);
         builder.setDpnId(dpnId);
-        builder.setOfTableId((long) tableId);
+        builder.setOfTableId(tableId);
         builder.setSrcMac(srcMac);
         builder.setMetadata(metadata);
         builder.setDstIpaddress(dstIp);
@@ -529,13 +530,13 @@ public class ArpUtilImpl extends AbstractLifecycle implements OdlArputilService,
     }
 
     private void fireArpReqRecvdNotification(String interfaceName, InetAddress srcInetAddr, byte[] srcMac,
-            InetAddress dstInetAddr, Uint64 dpnId, int tableId, Uint64 metadata) throws InterruptedException {
+            InetAddress dstInetAddr, Uint64 dpnId, Uint32 tableId, Uint64 metadata) throws InterruptedException {
         arpReqRecvd.mark();
         String macAddress = NWUtil.toStringMacAddress(srcMac);
         ArpRequestReceivedBuilder builder = new ArpRequestReceivedBuilder();
         builder.setInterface(interfaceName);
         builder.setDpnId(dpnId);
-        builder.setOfTableId((long) tableId);
+        builder.setOfTableId(tableId);
         builder.setSrcIpaddress(IetfInetUtil.INSTANCE.ipAddressFor(srcInetAddr));
         builder.setDstIpaddress(IetfInetUtil.INSTANCE.ipAddressFor(dstInetAddr));
         builder.setSrcMac(new PhysAddress(macAddress));