Do not use char[]-based union access 14/74314/6
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 22 Jul 2018 21:09:42 +0000 (23:09 +0200)
committerSam Hague <shague@redhat.com>
Mon, 23 Jul 2018 19:58:03 +0000 (19:58 +0000)
Both the constructor and getValue() method are going away, do not
use them.

Change-Id: If0b2b7db98bfba090b437366e80f808e871ebbf5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
47 files changed:
aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/EgressAclServiceImpl.java
aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/IngressAclServiceImpl.java
aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/utils/AclServiceUtils.java
aclservice/impl/src/test/java/org/opendaylight/netvirt/aclservice/tests/AclServiceTestBase.java
aclservice/impl/src/test/java/org/opendaylight/netvirt/aclservice/utils/AclServiceUtilsTest.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/BgpConfigurationManager.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/BgpUtil.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/commands/Cache.java
coe/impl/src/main/java/org/opendaylight/netvirt/coe/listeners/PodListener.java
coe/impl/src/main/java/org/opendaylight/netvirt/coe/utils/CoeUtils.java
dhcpservice/impl/src/main/java/org/opendaylight/netvirt/dhcpservice/DhcpAllocationPoolManager.java
dhcpservice/impl/src/main/java/org/opendaylight/netvirt/dhcpservice/DhcpPktHandler.java
dhcpservice/impl/src/main/java/org/opendaylight/netvirt/dhcpservice/DhcpServiceUtils.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/internal/ElanInterfaceManager.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/listeners/HwvtepRemoteMcastMacListener.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/utils/ElanL2GatewayMulticastUtils.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/utils/ElanL2GatewayUtils.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/utils/TransportZoneNotificationUtil.java
elanmanager/impl/src/test/java/org/opendaylight/netvirt/elan/l2gw/nodehandlertest/NodeConnectedHandlerUtils.java
elanmanager/impl/src/test/java/org/opendaylight/netvirt/elan/l2gw/nodehandlertest/TestBuilders.java
elanmanager/impl/src/test/java/org/opendaylight/netvirt/elanmanager/tests/L2gwBuilders.java
fibmanager/impl/src/main/java/org/opendaylight/netvirt/fibmanager/FibUtil.java
fibmanager/impl/src/main/java/org/opendaylight/netvirt/fibmanager/NexthopManager.java
ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/Ipv6RouterAdvt.java
ipv6service/impl/src/test/java/org/opendaylight/netvirt/ipv6service/Ipv6PktHandlerTest.java
ipv6service/shell/src/main/java/org/opendaylight/netvirt/ipv6service/shell/ShowIpv6Command.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/ConntrackBasedSnatService.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NatTunnelInterfaceStateListener.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NatUtil.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/VxlanGreConntrackBasedSnatService.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/rpcservice/NatRpcServiceImpl.java
neutronvpn/api/src/main/java/org/opendaylight/netvirt/neutronvpn/api/l2gw/L2GatewayDevice.java
neutronvpn/impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronPortChangeListener.java
neutronvpn/impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronRouterChangeListener.java
neutronvpn/impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronSubnetChangeListener.java
neutronvpn/impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronvpnManager.java
neutronvpn/impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronvpnNatManager.java
neutronvpn/impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronvpnUtils.java
vpnmanager/api/src/main/java/org/opendaylight/netvirt/vpnmanager/api/InterfaceUtils.java
vpnmanager/impl/src/main/java/org/opendaylight/netvirt/vpnmanager/SubnetRoutePacketInHandler.java
vpnmanager/impl/src/main/java/org/opendaylight/netvirt/vpnmanager/TunnelInterfaceStateListener.java
vpnmanager/impl/src/main/java/org/opendaylight/netvirt/vpnmanager/VpnInterfaceManager.java
vpnmanager/impl/src/main/java/org/opendaylight/netvirt/vpnmanager/intervpnlink/IVpnLinkServiceImpl.java
vpnmanager/impl/src/main/java/org/opendaylight/netvirt/vpnmanager/iplearn/AbstractIpLearnNotificationHandler.java
vpnmanager/impl/src/main/java/org/opendaylight/netvirt/vpnmanager/iplearn/AlivenessMonitorUtils.java
vpnmanager/impl/src/main/java/org/opendaylight/netvirt/vpnmanager/iplearn/ipv4/ArpNotificationHandler.java
vpnmanager/impl/src/main/java/org/opendaylight/netvirt/vpnmanager/iplearn/ipv6/Ipv6NaNotificationHandler.java

index af3b265fb77733fef9c6ad36fbc4c126c8362532..1a4a1f1766de85a9f057737b724150cb106d6c2b 100644 (file)
@@ -157,7 +157,7 @@ public class EgressAclServiceImpl extends AbstractAclServiceImpl {
         flowMatches.addAll(AclServiceUtils.buildIpAndDstServiceMatch(aclTag, aap));
 
         List<InstructionInfo> instructions = AclServiceOFFlowBuilder.getGotoInstructionInfo(getAclCommitterTable());
-        String flowNameAdded = "Acl_Filter_Egress_" + String.valueOf(aap.getIpAddress().getValue()) + "_" + aclTag;
+        String flowNameAdded = "Acl_Filter_Egress_" + aap.getIpAddress().stringValue() + "_" + aclTag;
 
         syncFlow(dpId, getAclRemoteAclTable(), flowNameAdded, AclConstants.ACL_DEFAULT_PRIORITY, "ACL", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, flowMatches, instructions, addOrRemove);
@@ -180,7 +180,7 @@ public class EgressAclServiceImpl extends AbstractAclServiceImpl {
             gotoInstructions.add(new InstructionGotoTable(getAclConntrackClassifierTable()));
 
             String flowName = "Egress_Fixed_Goto_Classifier_" + dpId + "_" + lportTag + "_" + mac.getValue() + "_"
-                    + String.valueOf(attachIp.getValue());
+                    + attachIp.stringValue();
             syncFlow(dpId, getAclAntiSpoofingTable(), flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
                     AclConstants.COOKIE_ACL_BASE, matches, gotoInstructions, addOrRemove);
         }
@@ -296,7 +296,7 @@ public class EgressAclServiceImpl extends AbstractAclServiceImpl {
             LOG.debug("{} ARP Rule on DPID {}, lportTag {}",
                     addOrRemove == NwConstants.DEL_FLOW ? "Deleting" : "Adding", dpId, lportTag);
             String flowName = "Egress_ARP_" + dpId + "_" + lportTag + "_" + allowedAddress.getMacAddress().getValue()
-                    + String.valueOf(allowedAddressIp.getValue());
+                    + allowedAddressIp.stringValue();
             syncFlow(dpId, getAclAntiSpoofingTable(), flowName, AclConstants.PROTO_ARP_TRAFFIC_MATCH_PRIORITY, "ACL", 0,
                     0, AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
         }
index b7fc05a59aa1fa6ce0cadf772f3cd96f45df75e2..7ee5836b8d143e1804706d5c92e6700c3d6499bf 100644 (file)
@@ -37,7 +37,7 @@ import org.opendaylight.netvirt.aclservice.utils.AclConstants;
 import org.opendaylight.netvirt.aclservice.utils.AclDataUtil;
 import org.opendaylight.netvirt.aclservice.utils.AclServiceOFFlowBuilder;
 import org.opendaylight.netvirt.aclservice.utils.AclServiceUtils;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefixBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeEgress;
@@ -179,7 +179,7 @@ public class IngressAclServiceImpl extends AbstractAclServiceImpl {
             gotoInstructions.add(new InstructionGotoTable(getAclConntrackClassifierTable()));
 
             String flowName = "Ingress_Fixed_Goto_Classifier_" + dpId + "_" + lportTag + "_" + mac.getValue() + "_"
-                    + String.valueOf(attachIp.getValue());
+                    + attachIp.stringValue();
             syncFlow(dpId, getAclAntiSpoofingTable(), flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
                     AclConstants.COOKIE_ACL_BASE, matches, gotoInstructions, addOrRemove);
         }
@@ -192,7 +192,7 @@ public class IngressAclServiceImpl extends AbstractAclServiceImpl {
         flowMatches.addAll(AclServiceUtils.buildIpAndSrcServiceMatch(aclTag, aap));
 
         List<InstructionInfo> instructions = AclServiceOFFlowBuilder.getGotoInstructionInfo(getAclCommitterTable());
-        String flowNameAdded = "Acl_Filter_Ingress_" + String.valueOf(aap.getIpAddress().getValue()) + "_" + aclTag;
+        String flowNameAdded = "Acl_Filter_Ingress_" + aap.getIpAddress().stringValue() + "_" + aclTag;
 
         syncFlow(dpId, getAclRemoteAclTable(), flowNameAdded, AclConstants.ACL_DEFAULT_PRIORITY, "ACL", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, flowMatches, instructions, addOrRemove);
@@ -283,7 +283,7 @@ public class IngressAclServiceImpl extends AbstractAclServiceImpl {
                     AclServiceUtils.buildIcmpV6Matches(AclConstants.ICMPV6_TYPE_RA, 0,
                             port.getLPortTag(), serviceMode);
             matches.addAll(AclServiceUtils.buildIpMatches(
-                    new IpPrefixOrAddress(new IpPrefix(AclConstants.IPV6_LINK_LOCAL_PREFIX.toCharArray())),
+                    new IpPrefixOrAddress(IpPrefixBuilder.getDefaultInstance(AclConstants.IPV6_LINK_LOCAL_PREFIX)),
                     AclServiceManager.MatchCriteria.MATCH_SOURCE));
             String flowName = "Ingress_ICMPv6" + "_" + port.getDpId() + "_" + port.getLPortTag() + "_"
                     + AclConstants.ICMPV6_TYPE_RA + "_LinkLocal_Permit_";
index 0f6bba0614dd8237d0fc8d24a0c0a76885c30ead..712598d48a1dab34cfe768f2066afbc0e5c4fbcf 100644 (file)
@@ -35,7 +35,6 @@ import java.util.concurrent.Future;
 import javax.annotation.Nullable;
 import javax.inject.Inject;
 import javax.inject.Singleton;
-
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -128,6 +127,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev16060
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.DirectionBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.InterfaceAcl;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddressBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpVersionV6;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.PortSubnets;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.SecurityRuleAttr;
@@ -408,7 +408,7 @@ public final class AclServiceUtils {
     public static List<MatchInfoBase> buildBroadcastIpV4Matches(String ipAddr) {
         List<MatchInfoBase> matches = new ArrayList<>(2);
         matches.add(new MatchEthernetDestination(new MacAddress(AclConstants.BROADCAST_MAC)));
-        matches.addAll(AclServiceUtils.buildIpMatches(new IpPrefixOrAddress(ipAddr.toCharArray()),
+        matches.addAll(AclServiceUtils.buildIpMatches(IpPrefixOrAddressBuilder.getDefaultInstance(ipAddr),
                 MatchCriteria.MATCH_DESTINATION));
         return matches;
     }
@@ -829,7 +829,7 @@ public final class AclServiceUtils {
     }
 
     private static String getAapFlowId(AllowedAddressPairs aap) {
-        return aap.getMacAddress().getValue() + "_" + String.valueOf(aap.getIpAddress().getValue());
+        return aap.getMacAddress().getValue() + "_" + aap.getIpAddress().stringValue();
     }
 
     public static Long getElanIdFromInterface(String elanInterfaceName,DataBroker broker) {
@@ -1490,14 +1490,14 @@ public final class AclServiceUtils {
 
         IpPrefix ipPrefix = ipPrefixOrAddress.getIpPrefix();
         if (ipPrefix != null) {
-            addr = String.valueOf(ipPrefix.getValue()).split("/")[0];
+            addr = ipPrefix.stringValue().split("/")[0];
         } else {
             IpAddress ipAddress = ipPrefixOrAddress.getIpAddress();
             if (ipAddress == null) {
                 LOG.error("Invalid address : {}", ipPrefixOrAddress);
                 return null;
             } else {
-                addr = String.valueOf(ipAddress.getValue());
+                addr = ipAddress.stringValue();
             }
         }
         try {
index 678d081607f6e1c8e8ed7333d917bf4d0fc14c2b..966befa2ab6410de1164f5d5831a50fd447c30d5 100644 (file)
@@ -17,7 +17,6 @@ import java.util.Collections;
 import java.util.List;
 import java.util.stream.Collectors;
 import javax.inject.Inject;
-
 import org.eclipse.xtext.xbase.lib.Pair;
 import org.junit.Before;
 import org.junit.Rule;
@@ -42,8 +41,8 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.cont
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.MatchesBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIpBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.ace.ip.version.AceIpv4Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefixBuilder;
 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.inet.types.rev130715.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
@@ -53,6 +52,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.DirectionEgress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.DirectionIngress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddressBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpVersionBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpVersionV4;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs;
@@ -620,15 +620,15 @@ public abstract class AclServiceTestBase {
 
     protected static AllowedAddressPairs buildAap(String ipAddress, String macAddress) {
         return new AllowedAddressPairsBuilder()
-                .setIpAddress(new IpPrefixOrAddress(new IpPrefix(ipAddress.toCharArray())))
+                .setIpAddress(new IpPrefixOrAddress(IpPrefixBuilder.getDefaultInstance(ipAddress)))
                 .setMacAddress(new MacAddress(macAddress)).build();
     }
 
     protected static SubnetInfo buildSubnetInfo(Uuid subnetId, String ipPrefix,
             Class<? extends IpVersionBase> ipVersion, String gwIp) {
         return new SubnetInfoBuilder().withKey(new SubnetInfoKey(subnetId)).setIpVersion(ipVersion)
-                .setIpPrefix(new IpPrefixOrAddress(ipPrefix.toCharArray()))
-                .setGatewayIp(new IpAddress(gwIp.toCharArray())).build();
+                .setIpPrefix(IpPrefixOrAddressBuilder.getDefaultInstance(ipPrefix))
+                .setGatewayIp(IpAddressBuilder.getDefaultInstance(gwIp)).build();
     }
 
     protected void setUpData() throws Exception {
index 6b13b2620a45bc69150cc755258b31a1f1438e82..57f5c7385506019ba4f21352226f4ee24ded7998 100644 (file)
@@ -15,7 +15,7 @@ import java.util.ArrayList;
 import java.util.List;
 import org.junit.Test;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddressBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairsBuilder;
 
@@ -64,13 +64,13 @@ public class AclServiceUtilsTest {
         inputAAPs.clear();
     }
 
-    private void buildInputAAP(List<AllowedAddressPairs> inputAAPs, String addr) {
+    private static void buildInputAAP(List<AllowedAddressPairs> inputAAPs, String addr) {
         inputAAPs.add(buildAAp(addr));
     }
 
-    private AllowedAddressPairs buildAAp(String addr) {
+    private static AllowedAddressPairs buildAAp(String addr) {
         AllowedAddressPairsBuilder aapb = new AllowedAddressPairsBuilder();
-        aapb.setIpAddress(new IpPrefixOrAddress(addr.toCharArray()));
+        aapb.setIpAddress(IpPrefixOrAddressBuilder.getDefaultInstance(addr));
         aapb.setMacAddress(new MacAddress("AA:BB:CC:DD:EE:FF"));
         return aapb.build();
     }
index a971b14aa5892ed1c640fb7d4d16d86609d37043..44aa7385708cf47264fd270f45cd7d284e40144e 100755 (executable)
@@ -122,6 +122,7 @@ import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev1509
 import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.tcp.security.option.grouping.tcp.security.option.TcpMd5SignatureOption;
 import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.tcp.security.option.grouping.tcp.security.option.TcpMd5SignatureOptionBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.FibEntries;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTables;
@@ -2126,7 +2127,7 @@ public class BgpConfigurationManager {
         }
         long asNum = asId.getLocalAs();
         IpAddress routerId = asId.getRouterId();
-        String rid = routerId == null ? "" : new String(routerId.getValue());
+        String rid = routerId == null ? "" : routerId.stringValue();
         int stalepathTime = (int) getStalePathtime(RESTART_DEFAULT_GR, config.getAsId());
         boolean announceFbit = true;
         boolean replayDone = false;
@@ -2340,7 +2341,7 @@ public class BgpConfigurationManager {
     }
 
     public void startBgp(long as, String routerId, int spt, boolean fbit) {
-        IpAddress rid = routerId == null ? null : new IpAddress(routerId.toCharArray());
+        IpAddress rid = routerId == null ? null : IpAddressBuilder.getDefaultInstance(routerId);
         Long staleTime = (long) spt;
         InstanceIdentifier.InstanceIdentifierBuilder<AsId> iib =
                 InstanceIdentifier.builder(Bgp.class).child(AsId.class);
@@ -2593,9 +2594,10 @@ public class BgpConfigurationManager {
 
         InstanceIdentifier<Vrfs> iid = iib.build();
 
+        InstanceIdentifier.builder(Bgp.class).build()
+                .child(Multipath.class, new MultipathKey(adfBuilder.getAfi(), adfBuilder.getSafi()));
         @SuppressWarnings("static-access")
-        InstanceIdentifier<Bgp> iid6 =  iid.builder(Bgp.class).build()
-                .child(Multipath.class, new MultipathKey(adfBuilder.getAfi(), adfBuilder.getSafi())).create(Bgp.class);
+        InstanceIdentifier<Bgp> iid6 =  InstanceIdentifier.create(Bgp.class);
         InstanceIdentifierBuilder<Vrfs> iib3 = iid6.child(Vrfs.class, new VrfsKey(rd)).builder();
         InstanceIdentifier<Vrfs> iidFinal = iib3.build();
 
index 005b907f99aefacba86c41c473c26e03b72cff2f..f4e45a193664d30e59dfa85b210b1ab2c41488d6 100755 (executable)
@@ -36,6 +36,7 @@ import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev1509
 import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.VrfsKey;
 import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.vrfs.AddressFamiliesVrf;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInstances;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey;
@@ -241,7 +242,7 @@ public class BgpUtil implements AutoCloseable {
     }
 
     private static InstanceIdentifier<ExternalTeps> getExternalTepsIdentifier(String elanInstanceName, String tepIp) {
-        IpAddress tepAdress = tepIp == null ? null : new IpAddress(tepIp.toCharArray());
+        IpAddress tepAdress = tepIp == null ? null : IpAddressBuilder.getDefaultInstance(tepIp);
         return InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class,
                 new ElanInstanceKey(elanInstanceName)).child(ExternalTeps.class,
                 new ExternalTepsKey(tepAdress)).build();
index e68573a15758d7e5788643654683ac9e62be6055..1566f091107c5785cc5e16eb9a2b50d5794826d5 100644 (file)
@@ -153,7 +153,7 @@ public class Cache extends OsgiCommandSupport {
             IpAddress routerId = asId.getRouterId();
             Long spt = asId.getStalepathTime();
             Boolean afb = asId.isAnnounceFbit();
-            String rid = routerId == null ? "<n/a>" : new String(routerId.getValue());
+            String rid = routerId == null ? "<n/a>" : routerId.stringValue();
             //F-bit is always set to ON (hardcoded), in SDN even though the controller is down
             //forwarding state shall be retained.
             String bit = "ON";
index c5e94965dc7ecd608a7b932f6baca5f14cbc2448..37e6508c173c95bccba27078c1b1084658dbba33 100644 (file)
@@ -178,7 +178,7 @@ public class PodListener implements DataTreeChangeListener<Pods> {
             String interfaceName = CoeUtils.buildInterfaceName(pods.getNetworkNS(), pods.getName());
             List<ListenableFuture<Void>> futures = new ArrayList<>();
             futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, tx ->  {
-                String nodeIp = String.valueOf(pods.getHostIpAddress().getValue());
+                String nodeIp = pods.getHostIpAddress().stringValue();
                 ElanInstance elanInstance = CoeUtils.createElanInstanceForTheFirstPodInTheNetwork(
                         pods.getNetworkNS(), nodeIp, podInterface, tx);
                 LOG.info("interface creation for pod {}", interfaceName);
index 7ab9a31d8f9886cc85ea0cc7b939da5d5db8db47..3bb3c4ecbec29be8651d5ec056ec0c87c8b7422f 100644 (file)
@@ -425,7 +425,7 @@ public final class CoeUtils {
         IpAddress ip = pod.getInterface().get(0).getIpAddress();
         String ipValue = ip.getIpv4Address() != null ? ip.getIpv4Address().getValue() : ip.getIpv6Address().getValue();
         String ipPrefix = ip.getIpv4Address() != null ? ipValue + "/32" : ipValue + "/128";
-        String hostIp = new String(pod.getHostIpAddress().getValue());
+        String hostIp = pod.getHostIpAddress().stringValue();
         UUID subnetId = UUID.nameUUIDFromBytes(hostIp.getBytes(StandardCharsets.UTF_8));
         String gatewayIP = ipValue.replaceFirst("\\d+$", "1");
         Adjacency vmAdj = new AdjacencyBuilder().withKey(new AdjacencyKey(ipPrefix)).setIpAddress(ipPrefix)
index 42e8b29b137020acdf71ad024b3238f77714886e..1fd6ca5cb80e198770f4989463c1654b5390febf 100644 (file)
@@ -156,8 +156,8 @@ public class DhcpAllocationPoolManager implements AutoCloseable, EventListener {
         return elanInterface.getElanInstanceName();
     }
 
-    private String getPoolKeyIdByAllocationPool(String networkId, AllocationPool pool) {
-        return "dhcpAllocationPool." + networkId + "." + String.valueOf(pool.getSubnet().getValue());
+    private static String getPoolKeyIdByAllocationPool(String networkId, AllocationPool pool) {
+        return "dhcpAllocationPool." + networkId + "." + pool.getSubnet().stringValue();
     }
 
     private long createIdAllocation(String groupIdKey, String idKey) {
index 4f6bd8230f71dadee7b4ba8fe9ae2473f142d7b2..10934c49b922a505bd2164bcf17b6d407a9ec2d7 100644 (file)
@@ -340,26 +340,26 @@ public class DhcpPktHandler implements PacketProcessingListener {
             if (clientIp != null && serverIp != null) {
                 List<HostRoutes> subnetHostRoutes = new ArrayList<>(subnet.getHostRoutes().size());
                 for (HostRoutes hostRoute : subnet.getHostRoutes()) {
-                    if (!String.valueOf(hostRoute.getNexthop().getValue()).equals(clientIp)) {
+                    if (!hostRoute.getNexthop().stringValue().equals(clientIp)) {
                         subnetHostRoutes.add(hostRoute);
                     }
                 }
                 dhcpInfo.setClientIp(clientIp).setServerIp(serverIp)
-                        .setCidr(String.valueOf(subnet.getCidr().getValue())).setHostRoutes(subnetHostRoutes)
+                        .setCidr(subnet.getCidr().stringValue()).setHostRoutes(subnetHostRoutes)
                         .setDnsServersIpAddrs(dnsServers);
             }
         }
         return dhcpInfo;
     }
 
-    private DhcpInfo getApDhcpInfo(AllocationPool ap, IpAddress allocatedIp) {
+    private static DhcpInfo getApDhcpInfo(AllocationPool ap, IpAddress allocatedIp) {
         DhcpInfo dhcpInfo = null;
 
-        String clientIp = String.valueOf(allocatedIp.getValue());
-        String serverIp = String.valueOf(ap.getGateway().getValue());
+        String clientIp = allocatedIp.stringValue();
+        String serverIp = ap.getGateway().stringValue();
         List<IpAddress> dnsServers = ap.getDnsServers();
         dhcpInfo = new DhcpInfo();
-        dhcpInfo.setClientIp(clientIp).setServerIp(serverIp).setCidr(String.valueOf(ap.getSubnet().getValue()))
+        dhcpInfo.setClientIp(clientIp).setServerIp(serverIp).setCidr(ap.getSubnet().stringValue())
             .setHostRoutes(Collections.emptyList()).setDnsServersIpAddrs(dnsServers).setGatewayIp(serverIp);
 
         return dhcpInfo;
@@ -370,7 +370,7 @@ public class DhcpPktHandler implements PacketProcessingListener {
      * Many other modules use/need similar methods. Should
      * be refactored to a common NeutronUtils module.     *
      */
-    private String getIpv4Address(Port port) {
+    private static String getIpv4Address(Port port) {
 
         for (FixedIps fixedIp : port.getFixedIps()) {
             if (isIpv4Address(fixedIp.getIpAddress())) {
@@ -381,7 +381,7 @@ public class DhcpPktHandler implements PacketProcessingListener {
         return null;
     }
 
-    private boolean isIpv4Address(IpAddress ip) {
+    private static boolean isIpv4Address(IpAddress ip) {
         return ip != null && ip.getIpv4Address() != null;
     }
 
@@ -393,7 +393,7 @@ public class DhcpPktHandler implements PacketProcessingListener {
         return dhcpMgr.getNeutronPort(interfaceName);
     }
 
-    private DHCP getDhcpPktIn(Ethernet actualEthernetPacket) {
+    private static DHCP getDhcpPktIn(Ethernet actualEthernetPacket) {
         Ethernet ethPkt = actualEthernetPacket;
         if (ethPkt.getEtherType() == (short)NwConstants.ETHTYPE_802_1Q) {
             ethPkt = (Ethernet)ethPkt.getPayload();
@@ -565,7 +565,7 @@ public class DhcpPktHandler implements PacketProcessingListener {
         return rawPkt;
     }
 
-    private byte[] getServerMacAddress(String phyAddress) {
+    private static byte[] getServerMacAddress(String phyAddress) {
         // Should we return ControllerMac instead?
         return DHCPUtils.strMacAddrtoByteArray(phyAddress);
     }
index db0bec0f6db5976f4580e3bf05dd660695f37008..0ffdce200d22fa27679aa1a8c1c084f72590ec81 100644 (file)
@@ -64,6 +64,7 @@ import org.opendaylight.netvirt.dhcpservice.api.DhcpMConstants;
 import org.opendaylight.netvirt.elanmanager.api.ElanHelper;
 import org.opendaylight.netvirt.neutronvpn.api.utils.NeutronUtils;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
@@ -438,7 +439,7 @@ public final class DhcpServiceUtils {
                 .map(x -> ipn >> x & 0xFF).boxed() //
                 .map(String::valueOf) //
                 .toArray(String[]::new);
-        return new IpAddress(String.join(".", array).toCharArray());
+        return IpAddressBuilder.getDefaultInstance(String.join(".", array));
     }
 
     static IpAddress convertLongToIp(long ip) {
@@ -446,11 +447,11 @@ public final class DhcpServiceUtils {
                 .map(x -> ip >> x & 0xFF).boxed() //
                 .map(String::valueOf) //
                 .toArray(String[]::new);
-        return new IpAddress(String.join(".", array).toCharArray());
+        return IpAddressBuilder.getDefaultInstance(String.join(".", array));
     }
 
     static long convertIpToLong(IpAddress ipa) {
-        String[] splitIp = String.valueOf(ipa.getValue()).split("\\.");
+        String[] splitIp = ipa.stringValue().split("\\.");
         long result = 0;
         for (String part : splitIp) {
             result <<= 8;
index 8b191ad7c483e22e7c8502cd8840627324b2c040..0d0be420186737edbbd4df4c9b0fce9ad36b8dcb 100644 (file)
@@ -14,7 +14,6 @@ import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.ListenableFuture;
-
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.math.BigInteger;
 import java.util.ArrayList;
@@ -27,11 +26,9 @@ import java.util.Queue;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentLinkedQueue;
-
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 import javax.inject.Singleton;
-
 import org.apache.commons.lang3.StringUtils;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
@@ -288,7 +285,7 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
                 if (isVxlanNetworkOrVxlanSegment(elanInfo)) {
                     if (elanUtils.isOpenstackVniSemanticsEnforced()) {
                         elanUtils.removeTerminatingServiceAction(dpId,
-                                elanUtils.getVxlanSegmentationId(elanInfo).intValue());
+                                ElanUtils.getVxlanSegmentationId(elanInfo).intValue());
                     }
                     unsetExternalTunnelTable(dpId, elanInfo);
                 }
@@ -1027,7 +1024,7 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
                                 List<Action> remoteListActionInfo = elanItmUtils.getInternalTunnelItmEgressAction(
                                         dpnInterface.getDpId(), otherFes.getDpId(),
                                         elanUtils.isOpenstackVniSemanticsEnforced()
-                                                ? elanUtils.getVxlanSegmentationId(elanInfo) : elanTag);
+                                                ? ElanUtils.getVxlanSegmentationId(elanInfo) : elanTag);
                                 if (!remoteListActionInfo.isEmpty()) {
                                     remoteListBucketInfo.add(MDSALUtil.buildBucket(remoteListActionInfo, MDSALUtil
                                             .GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
@@ -1331,7 +1328,7 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
             listMatchInfoBase = ElanUtils.getTunnelMatchesForServiceId((int) elanTag);
             instructionInfos = getInstructionsForOutGroup(ElanUtils.getElanLocalBCGId(elanTag));
         } else {
-            serviceId = elanUtils.getVxlanSegmentationId(elanInfo);
+            serviceId = ElanUtils.getVxlanSegmentationId(elanInfo);
             listMatchInfoBase = buildMatchesForVni(serviceId);
             instructionInfos = getInstructionsIntOrExtTunnelTable(elanTag);
         }
@@ -1745,7 +1742,7 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
                 ElanL2GatewayUtils.checkIfPhyLocatorAlreadyExistsInRemoteMcastEntry(externalNodeId, remoteMcastMac,
                 dpnTepIp);
         LOG.debug("phyLocAlreadyExists = {} for locator [{}] in remote mcast entry for elan [{}], nodeId [{}]",
-                phyLocAlreadyExists, String.valueOf(dpnTepIp.getValue()), elanName, externalNodeId.getValue());
+                phyLocAlreadyExists, dpnTepIp.stringValue(), elanName, externalNodeId.getValue());
         List<PhysAddress> staticMacs = elanL2GatewayUtils.getElanDpnMacsFromInterfaces(lstElanInterfaceNames);
 
         if (phyLocAlreadyExists) {
index bed971a2bb69438b5c18dd278fa264041d9109ba..58e1864c4fd670861c170bfcbd362da93801013f 100644 (file)
@@ -107,7 +107,7 @@ public class HwvtepRemoteMcastMacListener
                 boolean ipExists = ElanL2GatewayUtils.checkIfPhyLocatorAlreadyExistsInRemoteMcastEntry(this.nodeId,
                         remoteMcastMac, ip);
                 if (!ipExists) {
-                    LOG.trace("IP [{}] not found in RemoteMcastMacs for node [{}]", String.valueOf(ip.getValue()),
+                    LOG.trace("IP [{}] not found in RemoteMcastMacs for node [{}]", ip.stringValue(),
                             this.nodeId.getValue());
                     return false;
                 }
index 91822101af87712d33eff8fce4cd18d7041e0e86..487f8fa6e941c569f8b638b913aa3f5e34aeb32c 100644 (file)
@@ -325,7 +325,7 @@ public class ElanL2GatewayMulticastUtils {
         if (isVxlanNetworkOrVxlanSegment(elanInfo)) {
             listBucketInfo.addAll(getRemoteBCGroupTunnelBuckets(elanDpns, dpnId, bucketId,
                     elanUtils.isOpenstackVniSemanticsEnforced()
-                            ? elanUtils.getVxlanSegmentationId(elanInfo) : elanTag));
+                            ? ElanUtils.getVxlanSegmentationId(elanInfo) : elanTag));
         }
         listBucketInfo.addAll(getRemoteBCGroupExternalPortBuckets(elanDpns, dpnInterfaces, dpnId,
                 getNextAvailableBucketId(listBucketInfo.size())));
@@ -383,7 +383,7 @@ public class ElanL2GatewayMulticastUtils {
                 continue;
             }
             List<Action> listActionInfo = elanItmUtils.buildTunnelItmEgressActions(interfaceName,
-                    elanUtils.getVxlanSegmentationId(elanInfo), false);
+                    ElanUtils.getVxlanSegmentationId(elanInfo), false);
             listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId,
                     MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
             bucketId++;
@@ -451,7 +451,7 @@ public class ElanL2GatewayMulticastUtils {
                 remoteTepIps.add(dhcpDesignatedSwitchTepIp);
 
                 HwvtepPhysicalLocatorAugmentation phyLocatorAug = HwvtepSouthboundUtils
-                        .createHwvtepPhysicalLocatorAugmentation(String.valueOf(dhcpDesignatedSwitchTepIp.getValue()));
+                        .createHwvtepPhysicalLocatorAugmentation(dhcpDesignatedSwitchTepIp.stringValue());
                 InstanceIdentifier<TerminationPoint> iid =
                         HwvtepSouthboundUtils.createPhysicalLocatorInstanceIdentifier(nodeId, phyLocatorAug);
                 TerminationPoint terminationPoint = new TerminationPointBuilder()
@@ -461,7 +461,7 @@ public class ElanL2GatewayMulticastUtils {
                         iid, terminationPoint);
                 LOG.info("Adding PhysicalLocator for node: {} with Dhcp designated switch Tep Ip {} "
                         + "as physical locator, elan {}", device.getHwvtepNodeId(),
-                        String.valueOf(dhcpDesignatedSwitchTepIp.getValue()), elanName);
+                        dhcpDesignatedSwitchTepIp.stringValue(), elanName);
             } else {
                 LOG.warn("Dhcp designated switch Tep Ip not found for l2 gw node {} and elan {}",
                         device.getHwvtepNodeId(), elanName);
@@ -491,7 +491,7 @@ public class ElanL2GatewayMulticastUtils {
         List<LocatorSet> locators = new ArrayList<>();
         for (IpAddress tepIp : tepIps) {
             HwvtepPhysicalLocatorAugmentation phyLocatorAug = HwvtepSouthboundUtils
-                    .createHwvtepPhysicalLocatorAugmentation(String.valueOf(tepIp.getValue()));
+                    .createHwvtepPhysicalLocatorAugmentation(tepIp.stringValue());
             HwvtepPhysicalLocatorRef phyLocRef = new HwvtepPhysicalLocatorRef(
                     HwvtepSouthboundUtils.createPhysicalLocatorInstanceIdentifier(nodeId, phyLocatorAug));
             locators.add(new LocatorSetBuilder().setLocatorRef(phyLocRef).build());
index 3aab5e93e8a60995edad6a6d2d0888222fed9b73..89a1a54d4a80d83fde9e5911a078883a1e765beb 100644 (file)
@@ -203,7 +203,7 @@ public class ElanL2GatewayUtils {
             RemoteMcastMacs remoteMcastMac, IpAddress expectedPhyLocatorIp) {
         if (remoteMcastMac != null) {
             HwvtepPhysicalLocatorAugmentation expectedPhyLocatorAug = HwvtepSouthboundUtils
-                    .createHwvtepPhysicalLocatorAugmentation(String.valueOf(expectedPhyLocatorIp.getValue()));
+                    .createHwvtepPhysicalLocatorAugmentation(expectedPhyLocatorIp.stringValue());
             HwvtepPhysicalLocatorRef expectedPhyLocRef = new HwvtepPhysicalLocatorRef(
                     HwvtepSouthboundUtils.createPhysicalLocatorInstanceIdentifier(nodeId, expectedPhyLocatorAug));
             if (remoteMcastMac.getLocatorSet() != null) {
@@ -693,8 +693,7 @@ public class ElanL2GatewayUtils {
                 if (!areMLAGDevices(l2GatewayDeviceToBeConfigured, otherDevice)) {
                     for (LocalUcastMacs localUcastMac : otherDevice.getUcastLocalMacs()) {
                         HwvtepPhysicalLocatorAugmentation physLocatorAug = HwvtepSouthboundUtils
-                                .createHwvtepPhysicalLocatorAugmentation(
-                                        String.valueOf(otherDevice.getTunnelIp().getValue()));
+                                .createHwvtepPhysicalLocatorAugmentation(otherDevice.getTunnelIp().stringValue());
                         RemoteUcastMacs remoteUcastMac = HwvtepSouthboundUtils.createRemoteUcastMac(hwVtepNodeId,
                                 localUcastMac.getMacEntryKey().getValue().toLowerCase(Locale.getDefault()),
                                 localUcastMac.getIpaddr(), logicalSwitchName, physLocatorAug);
@@ -758,7 +757,7 @@ public class ElanL2GatewayUtils {
                 continue;
             }
             HwvtepPhysicalLocatorAugmentation physLocatorAug = HwvtepSouthboundUtils
-                    .createHwvtepPhysicalLocatorAugmentation(String.valueOf(dpnTepIp.getValue()));
+                    .createHwvtepPhysicalLocatorAugmentation(dpnTepIp.stringValue());
             // TODO: Query ARP cache to get IP address corresponding to the
             // MAC
             RemoteUcastMacs remoteUcastMac = HwvtepSouthboundUtils.createRemoteUcastMac(hwVtepNodeId,
index ad0435f409c720fb7b98188eda22acd91e51605f..aa196121d8bdb9abf7842fd7b570b52fef7254ad 100644 (file)
@@ -39,7 +39,9 @@ import org.opendaylight.netvirt.elanmanager.api.IElanService;
 import org.opendaylight.ovsdb.utils.mdsal.utils.MdsalUtils;
 import org.opendaylight.ovsdb.utils.southbound.utils.SouthboundUtils;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefixBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.BridgeRefInfo;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntryKey;
@@ -269,7 +271,7 @@ public class TransportZoneNotificationUtil {
 
             Set<String> zonePrefixes = new HashSet<>();
             Map<String, List<String>> tepTzMap = tunnelEndPoints.stream().collect(Collectors
-                    .toMap(tep -> String.valueOf(tep.getIpAddress().getValue()), this::getTepTransportZoneNames));
+                    .toMap(tep -> tep.getIpAddress().stringValue(), this::getTepTransportZoneNames));
             LOG.trace("Transport zone prefixes {}", tepTzMap);
 
             handleRemovedLocalIps(mapDiff.entriesOnlyOnLeft(), dpId, zonePrefixes, tepTzMap, tx);
@@ -351,7 +353,7 @@ public class TransportZoneNotificationUtil {
     private List<String> getTepTransportZoneNames(TunnelEndPoints tep) {
         List<TzMembership> tzMembershipList = tep.getTzMembership();
         if (tzMembershipList == null) {
-            LOG.debug("No TZ membership exist for TEP ip {}", tep.getIpAddress().getValue());
+            LOG.debug("No TZ membership exist for TEP ip {}", tep.getIpAddress().stringValue());
             return Collections.emptyList();
         }
 
@@ -389,7 +391,7 @@ public class TransportZoneNotificationUtil {
         }
 
         if (localIp != null) {
-            IpAddress nodeIp = new IpAddress(localIp.toCharArray());
+            IpAddress nodeIp = IpAddressBuilder.getDefaultInstance(localIp);
             VtepsBuilder vtepsBuilder = new VtepsBuilder().setDpnId(dpnId).setIpAddress(nodeIp)
                     .setPortname(TUNNEL_PORT).setOptionOfTunnel(elanConfig.isUseOfTunnels());
             subnets.getVteps().add(vtepsBuilder.build());
@@ -402,7 +404,7 @@ public class TransportZoneNotificationUtil {
     private void removeVtep(String zoneName, BigInteger dpId, @Nonnull WriteTransaction tx) {
         InstanceIdentifier<Vteps> path = InstanceIdentifier.builder(TransportZones.class)
                 .child(TransportZone.class, new TransportZoneKey(zoneName))
-                .child(Subnets.class, new SubnetsKey(new IpPrefix(ALL_SUBNETS.toCharArray())))
+                .child(Subnets.class, new SubnetsKey(IpPrefixBuilder.getDefaultInstance(ALL_SUBNETS)))
                 .child(Vteps.class, new VtepsKey(dpId, TUNNEL_PORT)).build();
         tx.delete(LogicalDatastoreType.CONFIGURATION, path);
     }
@@ -410,7 +412,7 @@ public class TransportZoneNotificationUtil {
     // search for relevant subnets for the given subnetIP, add one if it is
     // necessary
     private Subnets getOrAddSubnet(@Nonnull List<Subnets> subnets, @Nonnull String subnetIp) {
-        IpPrefix subnetPrefix = new IpPrefix(subnetIp.toCharArray());
+        IpPrefix subnetPrefix = IpPrefixBuilder.getDefaultInstance(subnetIp);
 
         for (Subnets subnet : subnets) {
             if (subnet.getPrefix().equals(subnetPrefix)) {
@@ -426,8 +428,8 @@ public class TransportZoneNotificationUtil {
 
     private Subnets buildSubnets(String subnetIp) {
         SubnetsBuilder subnetsBuilder = new SubnetsBuilder().setDeviceVteps(new ArrayList<>())
-                .setGatewayIp(new IpAddress(ALL_SUBNETS_GW.toCharArray()))
-                .withKey(new SubnetsKey(new IpPrefix(subnetIp.toCharArray()))).setVlanId(0)
+                .setGatewayIp(IpAddressBuilder.getDefaultInstance(ALL_SUBNETS_GW))
+                .withKey(new SubnetsKey(IpPrefixBuilder.getDefaultInstance(subnetIp))).setVlanId(0)
                 .setVteps(new ArrayList<>());
         return subnetsBuilder.build();
     }
index 37ac6ee41ec84e1bb7179b840391b1e76c7c11f2..440e16482c4cdd6b0d690535606d9450a72780b6 100644 (file)
@@ -17,6 +17,7 @@ import java.util.UUID;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+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.yang.types.rev130715.Uuid;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentationBuilder;
@@ -77,7 +78,7 @@ public class NodeConnectedHandlerUtils {
         physicalSwitchAugmentationBuilder.setHwvtepNodeDescription("description");
 
         List<TunnelIps> tunnelIps = new ArrayList<>();
-        IpAddress ip = new IpAddress("192.168.122.30".toCharArray());
+        IpAddress ip = new IpAddress(new Ipv4Address("192.168.122.30"));
         tunnelIps.add(new TunnelIpsBuilder().withKey(new TunnelIpsKey(ip)).setTunnelIpsKey(ip).build());
         physicalSwitchAugmentationBuilder.setTunnelIps(tunnelIps);
 
index 11b092e1a17c5c754a96aa29e8fbaab1c58b424b..e971d7867902f395b0b396b37799495bf2845497 100644 (file)
@@ -10,13 +10,11 @@ package org.opendaylight.netvirt.elan.l2gw.nodehandlertest;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableBiMap;
 import com.google.common.collect.ImmutableList;
-
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.UUID;
-
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
@@ -71,7 +69,7 @@ public final class TestBuilders {
     public static LocalUcastMacs buildLocalUcastMacs(InstanceIdentifier<Node> nodeIid, String vmMac,
                                                      String vmip, String tepIp, String logicalSwitchName) {
         LocalUcastMacsBuilder ucmlBuilder = new LocalUcastMacsBuilder();
-        ucmlBuilder.setIpaddr(new IpAddress(vmip.toCharArray()));
+        ucmlBuilder.setIpaddr(IpAddressBuilder.getDefaultInstance(vmip));
         ucmlBuilder.setMacEntryKey(new MacAddress(vmMac));
         ucmlBuilder.setMacEntryUuid(getUUid(vmMac));
         ucmlBuilder.setLocatorRef(buildLocatorRef(nodeIid, tepIp));
@@ -82,7 +80,7 @@ public final class TestBuilders {
     public static RemoteUcastMacs buildRemoteUcastMacs(InstanceIdentifier<Node> nodeIid, String vmMac,
                                                        String vmip, String tepIp, String logicalSwitchName) {
         RemoteUcastMacsBuilder ucmlBuilder = new RemoteUcastMacsBuilder();
-        ucmlBuilder.setIpaddr(new IpAddress(vmip.toCharArray()));
+        ucmlBuilder.setIpaddr(IpAddressBuilder.getDefaultInstance(vmip));
         ucmlBuilder.setMacEntryKey(new MacAddress(vmMac));
         ucmlBuilder.setMacEntryUuid(getUUid(vmMac));
         ucmlBuilder.setLocatorRef(buildLocatorRef(nodeIid, tepIp));
@@ -102,7 +100,7 @@ public final class TestBuilders {
                     new HwvtepPhysicalLocatorAugmentationBuilder();
             tpAugmentationBuilder.setPhysicalLocatorUuid(getUUid(ip));
             tpAugmentationBuilder.setEncapsulationType(createEncapsulationType("vxlan_over_ipv4"));
-            tpAugmentationBuilder.setDstIp(new IpAddress(ip.toCharArray()));
+            tpAugmentationBuilder.setDstIp(IpAddressBuilder.getDefaultInstance(ip));
             tpBuilder.addAugmentation(HwvtepPhysicalLocatorAugmentation.class, tpAugmentationBuilder.build());
         }
         return tpBuilder.build();
index 9da17a36c1f168e06aae7cb6274deed71d7a240d..e0d1dcd143f94264b1405eae82819b7b6e9ab98b 100644 (file)
@@ -12,13 +12,13 @@ import static org.opendaylight.netvirt.elan.l2gw.nodehandlertest.NodeConnectedHa
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
-
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
 import org.opendaylight.netvirt.elan.l2gw.nodehandlertest.GlobalAugmentationHelper;
 import org.opendaylight.netvirt.elan.l2gw.nodehandlertest.TestBuilders;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
@@ -56,7 +56,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 public class L2gwBuilders {
 
-    private SingleTransactionDataBroker singleTransactionDataBroker;
+    private final SingleTransactionDataBroker singleTransactionDataBroker;
 
     public L2gwBuilders(SingleTransactionDataBroker singleTransactionDataBroker) {
         this.singleTransactionDataBroker = singleTransactionDataBroker;
@@ -156,7 +156,7 @@ public class L2gwBuilders {
         physicalSwitchAugmentationBuilder.setHwvtepNodeName(new HwvtepNodeName(deviceName));
         physicalSwitchAugmentationBuilder.setHwvtepNodeDescription("torNode");
         List<TunnelIps> tunnelIps = new ArrayList<>();
-        IpAddress ip = new IpAddress(tepIp.toCharArray());
+        IpAddress ip = IpAddressBuilder.getDefaultInstance(tepIp);
         tunnelIps.add(new TunnelIpsBuilder().withKey(new TunnelIpsKey(ip)).setTunnelIpsKey(ip).build());
         physicalSwitchAugmentationBuilder.setTunnelIps(tunnelIps);
         nodeBuilder.addAugmentation(PhysicalSwitchAugmentation.class, physicalSwitchAugmentationBuilder.build());
@@ -179,7 +179,7 @@ public class L2gwBuilders {
         nodeBuilder.setNodeId(nodeId.firstKeyOf(Node.class).getNodeId());
         final List<LocalUcastMacs> localUcastMacses = new ArrayList<>();
         LocalUcastMacsBuilder localUcastMacsBuilder = new LocalUcastMacsBuilder();
-        localUcastMacsBuilder.setIpaddr(new IpAddress(ipAddr.toCharArray()));
+        localUcastMacsBuilder.setIpaddr(IpAddressBuilder.getDefaultInstance(ipAddr));
         localUcastMacsBuilder.setMacEntryKey(new MacAddress(mac));
         localUcastMacsBuilder.setMacEntryUuid(getUUid(mac));
         localUcastMacsBuilder.setLocatorRef(TestBuilders.buildLocatorRef(nodeId, tepIp));
index 7fb4da33aaa50b67fdd4aaab2296dc53a1eacfdd..42067f4ae969a50b248f7b8caead321e4fd38c06 100644 (file)
@@ -23,7 +23,6 @@ import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import javax.inject.Inject;
 import javax.inject.Singleton;
-
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -629,7 +628,7 @@ public class FibUtil {
         if (tunnelInfo.isPresent()) {
             List<TunnelEndPoints> nexthopIpList = tunnelInfo.get().getTunnelEndPoints();
             if (nexthopIpList != null && !nexthopIpList.isEmpty()) {
-                nextHopIp = String.valueOf(nexthopIpList.get(0).getIpAddress().getValue());
+                nextHopIp = nexthopIpList.get(0).getIpAddress().stringValue();
             }
         }
         return nextHopIp;
index 1b6434570aed97fd57c7660702827678f83438a3..07d77ca12e75679103aafc663c3bcaee06caef8c 100644 (file)
@@ -54,7 +54,7 @@ import org.opendaylight.netvirt.fibmanager.api.L3VPNTransportTypes;
 import org.opendaylight.netvirt.vpnmanager.api.VpnExtraRouteHelper;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus;
@@ -334,7 +334,7 @@ public class NexthopManager implements AutoCloseable {
         Future<RpcResult<GetInternalOrExternalInterfaceNameOutput>> result;
         try {
             LOG.debug("Trying to fetch tunnel interface name for source dpn {} destIp {} tunType {}", srcDpId,
-                    dstIp.getValue(), tunnelType.getName());
+                    dstIp.stringValue(), tunnelType.getName());
             result = itmManager.getInternalOrExternalInterfaceName(new GetInternalOrExternalInterfaceNameInputBuilder()
                 .setSourceDpid(srcDpId)
                 .setDestinationIp(dstIp)
@@ -1128,7 +1128,8 @@ public class NexthopManager implements AutoCloseable {
         listAction.add(new ActionPushMpls().buildAction());
         listAction.add(new ActionRegMove(actionKey++, FibConstants.NXM_REG_MAPPING
                 .get(index), 0, 19).buildAction());
-        String tunnelInterfaceName = getTunnelInterfaceName(dpnId, new IpAddress(ipAddress.toCharArray()), tunnelType);
+        String tunnelInterfaceName = getTunnelInterfaceName(dpnId, IpAddressBuilder.getDefaultInstance(ipAddress),
+            tunnelType);
         List<Action> egressActions = getEgressActions(tunnelInterfaceName, actionKey++);
         if (!egressActions.isEmpty()) {
             listAction.addAll(getEgressActions(tunnelInterfaceName, actionKey++));
index ea22d761b5105ec59631fa9995ba16099ea6a58a..3efa575a63e85b8d6161f9214b1d8e7aa9c3c152 100644 (file)
@@ -84,9 +84,9 @@ public class Ipv6RouterAdvt {
         return true;
     }
 
-    private void updateRAResponse(Ipv6RouterAdvertisementType raType, RouterSolicitationPacket pdu,
-                                  RouterAdvertisementPacketBuilder raPacket,
-                                  VirtualPort routerPort) {
+    private static void updateRAResponse(Ipv6RouterAdvertisementType raType, RouterSolicitationPacket pdu,
+                                         RouterAdvertisementPacketBuilder raPacket,
+                                         VirtualPort routerPort) {
         short icmpv6RaFlags = 0;
         String gatewayMac = null;
         IpAddress gatewayIp;
@@ -102,11 +102,11 @@ public class Ipv6RouterAdvt {
 
             if (!subnet.getIpv6RAMode().isEmpty()) {
                 if (Ipv6ServiceConstants.IPV6_AUTO_ADDRESS_SUBNETS.contains(subnet.getIpv6RAMode())) {
-                    autoConfigPrefixList.add(String.valueOf(subnet.getSubnetCidr().getValue()));
+                    autoConfigPrefixList.add(subnet.getSubnetCidr().stringValue());
                 }
 
                 if (subnet.getIpv6RAMode().equalsIgnoreCase(Ipv6ServiceConstants.IPV6_DHCPV6_STATEFUL)) {
-                    statefulConfigPrefixList.add(String.valueOf(subnet.getSubnetCidr().getValue()));
+                    statefulConfigPrefixList.add(subnet.getSubnetCidr().stringValue());
                 }
             }
 
index b956f3649cef5ccb5ab05a6fd827060d773593e6..a7d4593efaa76218415b9459a11d40d3594dfe45 100644 (file)
@@ -28,6 +28,7 @@ import org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceConstants;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
@@ -308,7 +309,7 @@ public class Ipv6PktHandlerTest {
         when(gwIpAddress.getIpv6Address()).thenReturn(new Ipv6Address("2001:db8::1"));
 
         VirtualSubnet v6Subnet = VirtualSubnet.builder().gatewayIp(gwIpAddress)
-                .subnetCidr(new IpPrefix("2001:db8::/64".toCharArray()))
+                .subnetCidr(new IpPrefix(new Ipv6Prefix("2001:db8::/64")))
                 .ipv6AddressMode(Ipv6ServiceConstants.IPV6_SLAAC).ipv6RAMode(Ipv6ServiceConstants.IPV6_SLAAC).build();
 
         VirtualRouter virtualRouter = VirtualRouter.builder().build();
@@ -399,19 +400,19 @@ public class Ipv6PktHandlerTest {
         when(gwIpAddress.getIpv6Address()).thenReturn(new Ipv6Address("2001:db8:1111::1"));
 
         VirtualSubnet v6Subnet1 = VirtualSubnet.builder().gatewayIp(gwIpAddress)
-                .subnetCidr(new IpPrefix("2001:db8:1111::/64".toCharArray()))
+                .subnetCidr(new IpPrefix(new Ipv6Prefix("2001:db8:1111::/64")))
                 .ipv6AddressMode(Ipv6ServiceConstants.IPV6_SLAAC).ipv6RAMode(Ipv6ServiceConstants.IPV6_SLAAC).build();
         VirtualRouter virtualRouter = VirtualRouter.builder().build();
         v6Subnet1.setRouter(virtualRouter);
 
         VirtualSubnet v6Subnet2 = VirtualSubnet.builder().gatewayIp(gwIpAddress)
-                .subnetCidr(new IpPrefix("2001:db8:2222::/64".toCharArray()))
+                .subnetCidr(new IpPrefix(new Ipv6Prefix("2001:db8:2222::/64")))
                 .ipv6AddressMode(Ipv6ServiceConstants.IPV6_DHCPV6_STATELESS)
                 .ipv6RAMode(Ipv6ServiceConstants.IPV6_DHCPV6_STATELESS).build();
         v6Subnet2.setRouter(virtualRouter);
 
         VirtualSubnet v6Subnet3 = VirtualSubnet.builder().gatewayIp(gwIpAddress)
-                .subnetCidr(new IpPrefix("2001:db8:3333::/64".toCharArray()))
+                .subnetCidr(new IpPrefix(new Ipv6Prefix("2001:db8:3333::/64")))
                 .ipv6AddressMode(Ipv6ServiceConstants.IPV6_DHCPV6_STATEFUL)
                 .ipv6RAMode(Ipv6ServiceConstants.IPV6_DHCPV6_STATEFUL).build();
         v6Subnet3.setRouter(virtualRouter);
index a266db189542417d39ad31d4aff1c3f00a0d91c6..7838841a133ddafa44e96b92ab758a74c130ea92 100644 (file)
@@ -32,7 +32,7 @@ public class ShowIpv6Command extends OsgiCommandSupport {
         this.elementCache = elementCache;
     }
 
-    private String getPortIpv6Addresses(IVirtualPort vport) {
+    private static String getPortIpv6Addresses(IVirtualPort vport) {
         List<Ipv6Address> ipv6Addresses = vport.getIpv6Addresses();
         return ipv6Addresses.stream().map(Ipv6Address::getValue).collect(Collectors.joining("  "));
     }
@@ -59,9 +59,8 @@ public class ShowIpv6Command extends OsgiCommandSupport {
                 int count = 1;
                 List<IVirtualSubnet> vsubnets = elementCache.getSubnetCache();
                 for (IVirtualSubnet vsubnet : vsubnets) {
-                    tp.addRow(count++,   String.valueOf(vsubnet.getSubnetUUID().getValue()),
-                            String.valueOf(vsubnet.getSubnetCidr().getValue()),
-                            vsubnet.getIpVersion());
+                    tp.addRow(count++, String.valueOf(vsubnet.getSubnetUUID().getValue()),
+                            vsubnet.getSubnetCidr().stringValue(), vsubnet.getIpVersion());
                 }
                 session.getConsole().print(tp.toString());
             } else if (listResource.equalsIgnoreCase("routers")
index 65608d17e9063954fdec4f7ecd5dae6d5d2227ce..c334240dbc27e8dc700b62d45a3a1637b1b66365 100644 (file)
@@ -49,7 +49,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.Routers;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.routers.ExternalIps;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.subnets.Subnets;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddressBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.NxActionNatFlags;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.NxActionNatRangePresent;
 import org.slf4j.Logger;
@@ -280,8 +280,7 @@ public abstract class ConntrackBasedSnatService extends AbstractSnatService {
         int rangePresent = NxActionNatRangePresent.NXNATRANGEIPV4MIN.getIntValue();
         int flags = NxActionNatFlags.NXNATFSRC.getIntValue();
         NxCtAction nxCtActionCommit = new ActionNxConntrack.NxNat(0, flags, rangePresent,
-            new IpPrefixOrAddress(externalIp.toCharArray()).getIpAddress(),
-            null,0, 0);
+            IpPrefixOrAddressBuilder.getDefaultInstance(externalIp).getIpAddress(), null,0, 0);
         ctActionsListCommit.add(nxCtActionCommit);
         int ctCommitFlag = 1;
         ActionNxConntrack actionNxConntrackSubmit = new ActionNxConntrack(ctCommitFlag, 0, elanId,
index 0abce428a950ccd8e6a43868c34f831270594e21..5df13fae3272151caff18614ac93b5bf113ff1d9 100644 (file)
@@ -324,8 +324,8 @@ public class NatTunnelInterfaceStateListener
 
     private void hndlTepEvntsForDpn(StateTunnelList stateTunnelList, TunnelAction tunnelAction) {
         final BigInteger srcDpnId = new BigInteger(stateTunnelList.getSrcInfo().getTepDeviceId());
-        final String srcTepIp = String.valueOf(stateTunnelList.getSrcInfo().getTepIp().getValue());
-        final String destTepIp = String.valueOf(stateTunnelList.getDstInfo().getTepIp().getValue());
+        final String srcTepIp = stateTunnelList.getSrcInfo().getTepIp().stringValue();
+        final String destTepIp = stateTunnelList.getDstInfo().getTepIp().stringValue();
         LOG.trace("hndlTepEvntsForDpn : Handle tunnel event for srcDpn {} SrcTepIp {} DestTepIp {} ",
                 srcDpnId, srcTepIp, destTepIp);
         int tunTypeVal = getTunnelType(stateTunnelList);
index 3384cf5c25c5013828aa58e047f0915901421fe6..996c87ad1f587900891893c07dcd62214cc2c81e 100644 (file)
@@ -80,7 +80,7 @@ import org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev14081
 import org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.VpnInterface;
 import org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.VpnInterfaceKey;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefixBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase;
@@ -1542,7 +1542,7 @@ public final class NatUtil {
     }
 
     public static boolean isIPv6Subnet(String prefix) {
-        return new IpPrefix(prefix.toCharArray()).getIpv6Prefix() != null;
+        return IpPrefixBuilder.getDefaultInstance(prefix).getIpv6Prefix() != null;
     }
 
     static InstanceIdentifier<DpnRoutersList> getDpnRoutersId(BigInteger dpnId) {
index fa75cbeebf6a3411cec57e70d257ac77c6b98655..9cc0298dc9969bc57f1aefffb0ce5e69820f2bd2 100644 (file)
@@ -11,7 +11,6 @@ import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.genius.datastoreutils.listeners.DataTreeEventCallbackRegistrar;
 import org.opendaylight.genius.infra.Datastore.Configuration;
@@ -53,7 +52,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ProviderTypes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.Routers;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.routers.ExternalIps;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddressBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.NxActionNatFlags;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.NxActionNatRangePresent;
 import org.slf4j.Logger;
@@ -265,8 +264,7 @@ public class VxlanGreConntrackBasedSnatService extends ConntrackBasedSnatService
         int rangePresent = NxActionNatRangePresent.NXNATRANGEIPV4MIN.getIntValue();
         int flags = NxActionNatFlags.NXNATFSRC.getIntValue();
         ActionNxConntrack.NxCtAction nxCtActionCommit = new ActionNxConntrack.NxNat(0, flags, rangePresent,
-                new IpPrefixOrAddress(externalIp.toCharArray()).getIpAddress(),
-                null,0, 0);
+            IpPrefixOrAddressBuilder.getDefaultInstance(externalIp).getIpAddress(), null,0, 0);
         ctActionsListCommit.add(nxCtActionCommit);
         int ctCommitFlag = 1;
         ActionNxConntrack actionNxConntrackSubmit = new ActionNxConntrack(ctCommitFlag, 0, elanId,
index 1e828a0c4bd7b884b3f6e956efb62ac7281173ba..1e64f03205d0ee7e7ad3c1e6dd4b8d73c1716c29 100644 (file)
@@ -117,7 +117,7 @@ public class NatRpcServiceImpl implements OdlNatRpcService {
     public ListenableFuture<RpcResult<GetNatTranslationsForNetworkAndIpaddressOutput>>
             getNatTranslationsForNetworkAndIpaddress(GetNatTranslationsForNetworkAndIpaddressInput input) {
 
-        String ipAddress = String.valueOf(input.getIpAddress().getValue());
+        String ipAddress = input.getIpAddress().stringValue();
         RpcResultBuilder<GetNatTranslationsForNetworkAndIpaddressOutput> rpcResultBuilder = null;
         GetNatTranslationsForNetworkAndIpaddressOutputBuilder output = null;
 
@@ -136,8 +136,8 @@ public class NatRpcServiceImpl implements OdlNatRpcService {
             subNet = nvpnManager.getNeutronSubnet(subnetUuid);
             for (AllocationPools allocationPool : subNet.getAllocationPools()) {
                 if (NatUtil.isIpInSubnet(ipAddress,
-                        String.valueOf(allocationPool.getStart().getValue()),
-                        String.valueOf(allocationPool.getEnd().getValue()))) {
+                        allocationPool.getStart().stringValue(),
+                        allocationPool.getEnd().stringValue())) {
                     LOG.debug("getNatTranslationsForNetworkAndIpaddress : IP Adderess {} falls within the Subnet {}",
                             ipAddress, subNet.getUuid().getValue());
                     isIpInSubnet = Boolean.TRUE;
index 8f686b2bb89134a2fea4735199f0a024c7580845..988f626dbac966686335b15ba715d75d9073d68a 100644 (file)
@@ -271,7 +271,7 @@ public class L2GatewayDevice {
     public String toString() {
         List<String> lstTunnelIps = new ArrayList<>();
         for (IpAddress ip : this.tunnelIps) {
-            lstTunnelIps.add(String.valueOf(ip.getValue()));
+            lstTunnelIps.add(ip.stringValue());
         }
 
         List<String> lstMacs =
index 2c5fd96567eabe99b49564aa1d469e4d1c030f5e..f313e1921db67dc463328c05b339dbc9c5bdfc0a 100644 (file)
@@ -15,7 +15,6 @@ import com.google.gson.Gson;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
-
 import java.time.Duration;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -302,7 +301,7 @@ public class NeutronPortChangeListener extends AsyncDataTreeChangeListenerBase<P
                         && portIP.getIpAddress().getIpv6Address() != null) {
                         portIsIpv6 = true;
                     }
-                    String ipValue = String.valueOf(portIP.getIpAddress().getValue());
+                    String ipValue = portIP.getIpAddress().stringValue();
                     Uuid subnetId = portIP.getSubnetId();
                     nvpnManager.updateSubnetNodeWithFixedIp(subnetId, routerId,
                             routerPort.getUuid(), ipValue, routerPort.getMacAddress().getValue(), vpnId);
@@ -322,8 +321,8 @@ public class NeutronPortChangeListener extends AsyncDataTreeChangeListenerBase<P
                     nvpnManager.createVpnInterface(listVpnIds, routerPort, null);
                 }
                 for (FixedIps portIP : routerPort.getFixedIps()) {
-                    String ipValue = String.valueOf(portIP.getIpAddress().getValue());
-                    IpVersionChoice version = neutronvpnUtils.getIpVersionFromString(ipValue);
+                    String ipValue = portIP.getIpAddress().stringValue();
+                    IpVersionChoice version = NeutronvpnUtils.getIpVersionFromString(ipValue);
                     if (neutronvpnUtils.shouldVpnHandleIpVersionChoiceChangeToAdd(version, vpnId)) {
                         neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnId.getValue(),
                                version, true);
@@ -393,9 +392,9 @@ public class NeutronPortChangeListener extends AsyncDataTreeChangeListenerBase<P
                         // router Port have either IPv4 or IPv6, never both
                         if (neutronvpnUtils.shouldVpnHandleIpVersionChangeToRemove(sn, vpnId)) {
                             vpnInstanceIpVersionRemoved = true;
-                            vpnInstanceIpVersionToRemove = neutronvpnUtils.getIpVersionFromString(sn.getSubnetIp());
+                            vpnInstanceIpVersionToRemove = NeutronvpnUtils.getIpVersionFromString(sn.getSubnetIp());
                         }
-                        String ipValue = String.valueOf(portIP.getIpAddress().getValue());
+                        String ipValue = portIP.getIpAddress().stringValue();
                         neutronvpnUtils.removeVpnPortFixedIpToPort(vpnId.getValue(), ipValue, confTx);
                         // NOTE:  Please donot change the order of calls to removeSubnetFromVpn and
                         // and updateSubnetNodeWithFixedIP
@@ -428,7 +427,7 @@ public class NeutronPortChangeListener extends AsyncDataTreeChangeListenerBase<P
         if (network == null) {
             return;
         }
-        boolean isExternal = neutronvpnUtils.getIsExternal(network);
+        boolean isExternal = NeutronvpnUtils.getIsExternal(network);
         if (isExternal) {
             Uuid vpnInternetId = neutronvpnUtils.getVpnForNetwork(networkId);
             if (vpnInternetId != null) {
@@ -437,7 +436,7 @@ public class NeutronPortChangeListener extends AsyncDataTreeChangeListenerBase<P
                     if (sn.getNetworkId() == networkId) {
                         continue;
                     }
-                    if (neutronvpnUtils.getIpVersionFromString(sn.getSubnetIp()) != IpVersionChoice.IPV6) {
+                    if (NeutronvpnUtils.getIpVersionFromString(sn.getSubnetIp()) != IpVersionChoice.IPV6) {
                         continue;
                     }
                     nvpnManager.addSubnetToVpn(null, sn.getId(), vpnInternetId);
@@ -588,8 +587,8 @@ public class NeutronPortChangeListener extends AsyncDataTreeChangeListenerBase<P
         jobCoordinator.enqueueJob("PORT- " + portName, () -> {
             // add direct port to subnetMaps config DS
             if (!(NeutronUtils.isPortVnicTypeNormal(port)
-                || (isPortTypeSwitchdev(port)
-                && isSupportedVnicTypeByHost(port, NeutronConstants.VNIC_TYPE_DIRECT)))) {
+                || isPortTypeSwitchdev(port)
+                && isSupportedVnicTypeByHost(port, NeutronConstants.VNIC_TYPE_DIRECT))) {
                 for (FixedIps ip: portIpAddrsList) {
                     nvpnManager.updateSubnetmapNodeWithPorts(ip.getSubnetId(), null, portId);
                 }
@@ -674,7 +673,7 @@ public class NeutronPortChangeListener extends AsyncDataTreeChangeListenerBase<P
 
                     if (NeutronConstants.DEVICE_OWNER_GATEWAY_INF.equals(port.getDeviceOwner())
                         || NeutronConstants.DEVICE_OWNER_FLOATING_IP.equals(port.getDeviceOwner())) {
-                        String ipAddress = String.valueOf(ip.getIpAddress().getValue());
+                        String ipAddress = ip.getIpAddress().stringValue();
                         if (vpnId != null) {
                             neutronvpnUtils.removeVpnPortFixedIpToPort(vpnId.getValue(), ipAddress, confTx);
                         }
@@ -741,7 +740,7 @@ public class NeutronPortChangeListener extends AsyncDataTreeChangeListenerBase<P
                         }
                     }
                 }
-                Set<Uuid> newVpnIds = new HashSet();
+                Set<Uuid> newVpnIds = new HashSet<>();
                 Set<Uuid> newRouterIds = new HashSet<>();
                 for (Uuid snId: updateSnMapsIds) {
                     Subnetmap subnetMapNew = nvpnManager.updateSubnetmapNodeWithPorts(snId, portupdate.getUuid(), null);
index e30555f17a55858666948e6aab98967a5bba8b71..e054a855f78789a504db73334591b0fe37cb2afe 100644 (file)
@@ -146,7 +146,7 @@ public class NeutronRouterChangeListener extends AsyncDataTreeChangeListenerBase
         List<Routes> otherRoutes = new ArrayList<>();
         HashMap<String, InterVpnLink> nexthopsXinterVpnLinks = new HashMap<>();
         for (Routes route : routes) {
-            String nextHop = String.valueOf(route.getNexthop().getValue());
+            String nextHop = route.getNexthop().stringValue();
             // Nexthop is another VPN?
             Optional<InterVpnLink> interVpnLink = neutronvpnUtils.getInterVpnLinkByEndpointIp(nextHop);
             if (interVpnLink.isPresent()) {
@@ -158,7 +158,7 @@ public class NeutronRouterChangeListener extends AsyncDataTreeChangeListenerBase
                     nexthopsXinterVpnLinks.put(nextHop, interVpnLink.get());
                 } else {
                     LOG.error("Failed installing route to {}. Reason: InterVPNLink {} is not Active",
-                            String.valueOf(route.getDestination().getValue()), interVpnLink.get().getName());
+                            route.getDestination().stringValue(), interVpnLink.get().getName());
                 }
             } else {
                 otherRoutes.add(route);
index ba6758f77c6414b53b17120de41c778ba0f08329..d618f171266c6628604aa14321cef97afad7c9a4 100644 (file)
@@ -105,7 +105,7 @@ public class NeutronSubnetChangeListener extends AsyncDataTreeChangeListenerBase
                     subnetId.getValue(), network);
             return;
         }
-        handleNeutronSubnetDeleted(subnetId, networkId, String.valueOf(input.getCidr().getValue()));
+        handleNeutronSubnetDeleted(subnetId, networkId, input.getCidr().stringValue());
         externalSubnetHandler.handleExternalSubnetRemoved(network, subnetId);
         neutronvpnUtils.removeFromSubnetCache(input);
     }
@@ -121,8 +121,7 @@ public class NeutronSubnetChangeListener extends AsyncDataTreeChangeListenerBase
         Uuid subnetId = subnet.getUuid();
         ProviderTypes providerType = NeutronvpnUtils.getProviderNetworkType(network);
         String segmentationId = NeutronvpnUtils.getSegmentationIdFromNeutronNetwork(network);
-        nvpnManager.createSubnetmapNode(subnetId, String.valueOf(subnet.getCidr().getValue()),
-                subnet.getTenantId(), networkId,
+        nvpnManager.createSubnetmapNode(subnetId, subnet.getCidr().stringValue(), subnet.getTenantId(), networkId,
                 providerType != null ? NetworkAttributes.NetworkType.valueOf(providerType.getName()) : null,
                 segmentationId != null ? Long.parseLong(segmentationId) : 0L);
         createSubnetToNetworkMapping(subnetId, networkId);
index 1619d5f9bf3331a6afcab412cfd47f5a8a24d3a6..ebf370d56d84599eeeb0d2e9065c6a3006de172e 100644 (file)
@@ -798,7 +798,7 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
         String infName = port.getUuid().getValue();
         LOG.trace("neutronVpnManager: create config adjacencies for Port: {}", infName);
         for (FixedIps ip : port.getFixedIps()) {
-            String ipValue = String.valueOf(ip.getIpAddress().getValue());
+            String ipValue = ip.getIpAddress().stringValue();
             String ipPrefix = ip.getIpAddress().getIpv4Address() != null ? ipValue + "/32" : ipValue + "/128";
             if (sn != null && !FibHelper.doesPrefixBelongToSubnet(ipPrefix, sn.getSubnetIp(), false)) {
                 continue;
@@ -1028,7 +1028,7 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
                 }
                 List<FixedIps> ips = port.getFixedIps();
                 for (FixedIps ip : ips) {
-                    String ipValue = String.valueOf(ip.getIpAddress().getValue());
+                    String ipValue = ip.getIpAddress().stringValue();
                     neutronvpnUtils.removeVpnPortFixedIpToPort(vpnId.getValue(),
                             ipValue, writeConfigTxn);
                 }
@@ -1106,7 +1106,7 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
                 }
                 List<FixedIps> ips = port.getFixedIps();
                 for (FixedIps ip : ips) {
-                    String ipValue = String.valueOf(ip.getIpAddress().getValue());
+                    String ipValue = ip.getIpAddress().stringValue();
                     if (oldVpnId != null) {
                         neutronvpnUtils.removeVpnPortFixedIpToPort(oldVpnId.getValue(),
                                 ipValue, writeConfigTxn);
@@ -1406,8 +1406,8 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
                                 vpnIdentifier);
                 // eliminating implicitly created (router or VLAN provider external network specific) VPN from
                 // getL3VPN output
-                if (optionalVpn.isPresent() && (optionalVpn.get().getIpv4Family().getRouteDistinguisher() != null)
-                        || (optionalVpn.get().getIpv6Family().getRouteDistinguisher() != null)) {
+                if (optionalVpn.isPresent() && optionalVpn.get().getIpv4Family().getRouteDistinguisher() != null
+                        || optionalVpn.get().getIpv6Family().getRouteDistinguisher() != null) {
                     vpns.add(optionalVpn.get());
                 } else {
                     result.set(
@@ -1888,8 +1888,8 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
     public void addInterVpnRoutes(Uuid vpnName, List<Routes> interVpnLinkRoutes,
                                   HashMap<String, InterVpnLink> nexthopsXinterVpnLinks) {
         for (Routes route : interVpnLinkRoutes) {
-            String nexthop = String.valueOf(route.getNexthop().getValue());
-            String destination = String.valueOf(route.getDestination().getValue());
+            String nexthop = route.getNexthop().stringValue();
+            String destination = route.getDestination().stringValue();
             InterVpnLink interVpnLink = nexthopsXinterVpnLinks.get(nexthop);
             if (isNexthopTheOtherVpnLinkEndpoint(nexthop, vpnName.getValue(), interVpnLink)) {
                 AddStaticRouteInput rpcInput =
@@ -1914,7 +1914,7 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
             } else {
                 // Any other case is a fault.
                 LOG.warn("route with destination {} and nexthop {} does not apply to any InterVpnLink",
-                        String.valueOf(route.getDestination().getValue()), nexthop);
+                        route.getDestination().stringValue(), nexthop);
                 continue;
             }
         }
@@ -1931,8 +1931,8 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
     public void removeInterVpnRoutes(Uuid vpnName, List<Routes> interVpnLinkRoutes,
                                      HashMap<String, InterVpnLink> nexthopsXinterVpnLinks) {
         for (Routes route : interVpnLinkRoutes) {
-            String nexthop = String.valueOf(route.getNexthop().getValue());
-            String destination = String.valueOf(route.getDestination().getValue());
+            String nexthop = route.getNexthop().stringValue();
+            String destination = route.getDestination().stringValue();
             InterVpnLink interVpnLink = nexthopsXinterVpnLinks.get(nexthop);
             if (isNexthopTheOtherVpnLinkEndpoint(nexthop, vpnName.getValue(), interVpnLink)) {
                 RemoveStaticRouteInput rpcInput =
@@ -1945,7 +1945,7 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
             } else {
                 // Any other case is a fault.
                 LOG.warn("route with destination {} and nexthop {} does not apply to any InterVpnLink",
-                        String.valueOf(route.getDestination().getValue()), nexthop);
+                        route.getDestination().stringValue(), nexthop);
                 continue;
             }
         }
@@ -1972,8 +1972,8 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
             if (route == null || route.getNexthop() == null || route.getDestination() == null) {
                 LOG.error("Incorrect input received for extra route. {}", route);
             } else {
-                String nextHop = String.valueOf(route.getNexthop().getValue());
-                String destination = String.valueOf(route.getDestination().getValue());
+                String nextHop = route.getNexthop().stringValue();
+                String destination = route.getDestination().stringValue();
                 if (!nextHop.equals(fixedIp)) {
                     LOG.trace("FixedIP {} is not extra route nexthop for destination {}", fixedIp, destination);
                     continue;
@@ -2005,8 +2005,8 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
             if (route == null || route.getNexthop() == null || route.getDestination() == null) {
                 LOG.error("Incorrect input received for extra route. {}", route);
             } else {
-                String nextHop = String.valueOf(route.getNexthop().getValue());
-                String destination = String.valueOf(route.getDestination().getValue());
+                String nextHop = route.getNexthop().stringValue();
+                String destination = route.getDestination().stringValue();
                 String infName = neutronvpnUtils.getNeutronPortNameFromVpnPortFixedIp(vpnId.getValue(),
                         nextHop);
                 if (infName != null) {
@@ -2079,22 +2079,22 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
         }
         for (Routes route : routeList) {
             // count  the number of nexthops for each same route.getDestingation().getValue()
-            String destination = String.valueOf(route.getDestination().getValue());
-            String nextHop = String.valueOf(route.getNexthop().getValue());
-            List<String> nextHopList = new ArrayList();
+            String destination = route.getDestination().stringValue();
+            String nextHop = route.getNexthop().stringValue();
+            List<String> nextHopList = new ArrayList<>();
             nextHopList.add(nextHop);
             int nbNextHops = 0;
             for (Routes routeTmp : routeList) {
-                String routeDest = String.valueOf(routeTmp.getDestination().getValue());
+                String routeDest = routeTmp.getDestination().stringValue();
                 if (!destination.equals(routeDest)) {
                     continue;
                 }
-                String routeNextH = String.valueOf(routeTmp.getNexthop().getValue());
+                String routeNextH = routeTmp.getNexthop().stringValue();
                 if (nextHop.equals(routeNextH)) {
                     continue;
                 }
                 nbNextHops++;
-                nextHopList.add(new String(routeTmp.getNexthop().getValue()));
+                nextHopList.add(routeTmp.getNexthop().stringValue());
             }
             final List<String> rdList = new ArrayList<>();
             if (vpnInstance.getIpv4Family() != null
@@ -2130,7 +2130,7 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
 
             // 4. Prefix in question
             detailsAlarm.append(" for prefix: ");
-            detailsAlarm.append(route.getDestination().getValue());
+            detailsAlarm.append(route.getDestination().stringValue());
 
             // 5. List of NHs for the prefix
             detailsAlarm.append(" for nextHops: ");
@@ -2153,8 +2153,8 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
         for (Routes route : routeList) {
             if (route != null && route.getNexthop() != null && route.getDestination() != null) {
                 boolean isLockAcquired = false;
-                String nextHop = String.valueOf(route.getNexthop().getValue());
-                String destination = String.valueOf(route.getDestination().getValue());
+                String nextHop = route.getNexthop().stringValue();
+                String destination = route.getDestination().stringValue();
                 String infName = neutronvpnUtils.getNeutronPortNameFromVpnPortFixedIp(vpnId.getValue(),
                         nextHop);
                 if (infName == null) {
@@ -2383,7 +2383,7 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
                                                    + "another VPN %s", nw.getValue(), networkVpnId.getValue()));
                     continue;
                 }
-                if (neutronvpnUtils.getIsExternal(network) && !associateExtNetworkToVpn(vpnId, network)) {
+                if (NeutronvpnUtils.getIsExternal(network) && !associateExtNetworkToVpn(vpnId, network)) {
                     LOG.error("associateNetworksToVpn: Failed to associate Provider Network {} with VPN {}",
                             nw.getValue(), vpnId.getValue());
                     failedNwList.add(String.format("Failed to associate Provider Network %s with VPN %s",
@@ -2412,7 +2412,7 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
                         neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnId.getValue(),
                                 NeutronvpnUtils.getIpVersionFromString(subnetmap.getSubnetIp()), true);
                     }
-                    if (!neutronvpnUtils.getIsExternal(network)) {
+                    if (!NeutronvpnUtils.getIsExternal(network)) {
                         LOG.debug("associateNetworksToVpn: Add subnet {} to VPN {}", subnetId.getValue(),
                                 vpnId.getValue());
                         addSubnetToVpn(vpnId, subnetId, null);
@@ -2525,7 +2525,7 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
                 Subnetmap subnetmap = neutronvpnUtils.getSubnetmap(subnet);
                 if (neutronvpnUtils.shouldVpnHandleIpVersionChangeToRemove(subnetmap, vpnId)) {
                     IpVersionChoice ipVersionsToRemove = IpVersionChoice.UNDEFINED;
-                    IpVersionChoice ipVersion = neutronvpnUtils.getIpVersionFromString(subnetmap.getSubnetIp());
+                    IpVersionChoice ipVersion = NeutronvpnUtils.getIpVersionFromString(subnetmap.getSubnetIp());
                     neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnId.getValue(),
                         ipVersionsToRemove.addVersion(ipVersion), false);
                 }
@@ -2688,7 +2688,7 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
             if (port != null) {
                 List<FixedIps> fixedIPs = port.getFixedIps();
                 for (FixedIps ip : fixedIPs) {
-                    fixedIPList.add(String.valueOf(ip.getIpAddress().getValue()));
+                    fixedIPList.add(ip.getIpAddress().stringValue());
                 }
             } else {
                 returnMsg.append("neutron port: ").append(portId.getValue()).append(" not found");
index c1c766274586c02b2a8ffac22851254ed35c0d40..12f039d05932d3cb2b52435765dc54b81fc4bb9a 100644 (file)
@@ -136,7 +136,7 @@ public class NeutronvpnNatManager implements AutoCloseable {
         }
     }
 
-    private int externalNetworkChanged(Router original, Router update) {
+    private static int externalNetworkChanged(Router original, Router update) {
         String origExtNet = null;
         String newExtNet = null;
         if (original != null && original.getExternalGatewayInfo() != null) {
@@ -163,7 +163,7 @@ public class NeutronvpnNatManager implements AutoCloseable {
         }
     }
 
-    private boolean snatSettingChanged(Router orig, Router update) {
+    private static boolean snatSettingChanged(Router orig, Router update) {
         ExternalGatewayInfo origExtGw = null;
         ExternalGatewayInfo newExtGw = null;
         if (orig != null && orig.getExternalGatewayInfo() != null) {
@@ -184,7 +184,7 @@ public class NeutronvpnNatManager implements AutoCloseable {
         return false;
     }
 
-    private boolean externalFixedIpsChanged(Router orig, Router update) {
+    private static boolean externalFixedIpsChanged(Router orig, Router update) {
         ExternalGatewayInfo origExtGw = null;
         ExternalGatewayInfo newExtGw = null;
         if (orig != null && orig.getExternalGatewayInfo() != null) {
@@ -212,12 +212,12 @@ public class NeutronvpnNatManager implements AutoCloseable {
                         List<ExternalFixedIps> origExtFixedIps = origExtGw.getExternalFixedIps();
                         HashSet<String> origFixedIpSet = new HashSet<>();
                         for (ExternalFixedIps fixedIps : origExtFixedIps) {
-                            origFixedIpSet.add(String.valueOf(fixedIps.getIpAddress().getValue()));
+                            origFixedIpSet.add(fixedIps.getIpAddress().stringValue());
                         }
                         List<ExternalFixedIps> newExtFixedIps = newExtGw.getExternalFixedIps();
                         HashSet<String> updFixedIpSet = new HashSet<>();
                         for (ExternalFixedIps fixedIps : newExtFixedIps) {
-                            updFixedIpSet.add(String.valueOf(fixedIps.getIpAddress().getValue()));
+                            updFixedIpSet.add(fixedIps.getIpAddress().stringValue());
                         }
                         // returns true if external subnets have changed
                         return !origFixedIpSet.equals(updFixedIpSet) ? true : false;
@@ -357,7 +357,7 @@ public class NeutronvpnNatManager implements AutoCloseable {
                 if (sn.getInternetVpnId() == null) {
                     continue;
                 }
-                IpVersionChoice ipVers = neutronvpnUtils.getIpVersionFromString(sn.getSubnetIp());
+                IpVersionChoice ipVers = NeutronvpnUtils.getIpVersionFromString(sn.getSubnetIp());
                 if (ipVers == IpVersionChoice.IPV6) {
                     LOG.debug("addExternalNetworkToRouter : setup vpnInternet IPv6 for vpnExternal {} subnetmap {}",
                             vpnExternal, sn);
@@ -423,7 +423,7 @@ public class NeutronvpnNatManager implements AutoCloseable {
         List<Uuid> submapIds = neutronvpnUtils.getPrivateSubnetsToExport(net);
         for (Uuid snId : submapIds) {
             Subnetmap subnetMap = neutronvpnUtils.getSubnetmap(snId);
-            if ((subnetMap == null) || (subnetMap.getInternetVpnId() == null)) {
+            if (subnetMap == null || subnetMap.getInternetVpnId() == null) {
                 LOG.error("removeExternalNetworkFromRouter: Can not find Subnetmap for SubnetId {} in ConfigDS",
                           snId.getValue());
                 continue;
@@ -701,7 +701,7 @@ public class NeutronvpnNatManager implements AutoCloseable {
         }
     }
 
-    private Subnets createSubnets(Uuid subnetId, Uuid networkId, List<Uuid> routerIds) {
+    private static Subnets createSubnets(Uuid subnetId, Uuid networkId, List<Uuid> routerIds) {
         SubnetsBuilder subnetsBuilder = new SubnetsBuilder();
         subnetsBuilder.withKey(new SubnetsKey(subnetId));
         subnetsBuilder.setId(subnetId);
@@ -746,7 +746,7 @@ public class NeutronvpnNatManager implements AutoCloseable {
         }
     }
 
-    private Set<Uuid> getExternalSubnetsUuidsSetForFixedIps(List<ExternalFixedIps> externalFixedIps) {
+    private static Set<Uuid> getExternalSubnetsUuidsSetForFixedIps(List<ExternalFixedIps> externalFixedIps) {
         Set<Uuid> subnetsUuidsSet = new HashSet<>();
         for (ExternalFixedIps externalFixedIp : externalFixedIps) {
             subnetsUuidsSet.add(externalFixedIp.getSubnetId());
@@ -767,9 +767,9 @@ public class NeutronvpnNatManager implements AutoCloseable {
         return subnetsList;
     }
 
-    private void addExternalFixedIpToExternalIpsList(List<ExternalIps> externalIps, ExternalFixedIps fixedIps) {
+    private static void addExternalFixedIpToExternalIpsList(List<ExternalIps> externalIps, ExternalFixedIps fixedIps) {
         Uuid subnetId = fixedIps.getSubnetId();
-        String ip = String.valueOf(fixedIps.getIpAddress().getValue());
+        String ip = fixedIps.getIpAddress().stringValue();
         ExternalIpsBuilder externalIpsBuilder = new ExternalIpsBuilder();
         externalIpsBuilder.withKey(new ExternalIpsKey(ip, subnetId));
         externalIpsBuilder.setIpAddress(ip);
index 877f8877fbd1319271dc6c700260d077e594cacf..ecc3e76cd6e7f7913106023144ba2915e7c35b67 100644 (file)
@@ -32,11 +32,9 @@ import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.stream.Collectors;
-
 import javax.annotation.Nonnull;
 import javax.inject.Inject;
 import javax.inject.Singleton;
-
 import org.apache.commons.lang3.StringUtils;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -561,7 +559,7 @@ public class NeutronvpnUtils {
             org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddress ipAddress) {
         AllowedAddressPairsBuilder aclAllowedAdressPairBuilder = new AllowedAddressPairsBuilder();
         aclAllowedAdressPairBuilder.setMacAddress(macAddress);
-        if (ipAddress != null && ipAddress.getValue() != null) {
+        if (ipAddress != null && ipAddress.stringValue() != null) {
             if (ipAddress.getIpPrefix() != null) {
                 aclAllowedAdressPairBuilder.setIpAddress(new IpPrefixOrAddress(ipAddress.getIpPrefix()));
             } else {
@@ -583,8 +581,8 @@ public class NeutronvpnUtils {
         List<AllowedAddressPairs> aclAllowedAddressPairs = new ArrayList<>();
         for (FixedIps fixedIp : fixedIps) {
             aclAllowedAddressPairs.add(getAclAllowedAddressPairs(macAddress,
-                    new org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddress(
-                            fixedIp.getIpAddress().getValue())));
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddressBuilder
+                    .getDefaultInstance(fixedIp.getIpAddress().stringValue())));
         }
         return aclAllowedAddressPairs;
     }
@@ -616,8 +614,9 @@ public class NeutronvpnUtils {
     protected static AllowedAddressPairs updateIPv6LinkLocalAddressForAclService(MacAddress macAddress) {
         IpAddress ipv6LinkLocalAddress = getIpv6LinkLocalAddressFromMac(macAddress);
         return getAclAllowedAddressPairs(macAddress,
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddress(
-                        ipv6LinkLocalAddress.getValue()));
+                org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddressBuilder
+                .getDefaultInstance(
+                        ipv6LinkLocalAddress.stringValue()));
     }
 
     /**
@@ -808,7 +807,7 @@ public class NeutronvpnUtils {
                     .class).child(Subnet.class, subnetkey);
             Optional<Subnet> subnet = read(LogicalDatastoreType.CONFIGURATION, subnetidentifier);
             if (subnet.isPresent()) {
-                String cidr = String.valueOf(subnet.get().getCidr().getValue());
+                String cidr = subnet.get().getCidr().stringValue();
                 // Extract the prefix length from cidr
                 String[] parts = cidr.split("/");
                 if (parts.length == 2) {
@@ -1238,7 +1237,7 @@ public class NeutronvpnUtils {
         interfaceID.append(StringUtils.leftPad(Integer.toHexString(0xFF & octets[5]), 2, "0"));
 
         Ipv6Address ipv6LLA = new Ipv6Address("fe80:0:0:0:" + interfaceID.toString());
-        IpAddress ipAddress = new IpAddress(ipv6LLA.getValue().toCharArray());
+        IpAddress ipAddress = new IpAddress(ipv6LLA);
         return ipAddress;
     }
 
@@ -1635,7 +1634,7 @@ public class NeutronvpnUtils {
         }
         Long vpnId = vpnInstanceOpDataEntry.getVpnId();
         List<Uuid> routerIds = getRouterIdsfromVpnInstance(vpnInstanceOpDataEntry.getVrfId());
-        if ((routerIds == null) || (routerIds.isEmpty())) {
+        if (routerIds == null || routerIds.isEmpty()) {
             LOG.error("updateVpnInstanceWithFallback: router not found for vpn {}", vpnName);
             return;
         }
index fc9e3519d1b7eabb9398522d5d748ec3f41102ed..46a127573e2a75797ba2fd8bf97335627089358e 100644 (file)
@@ -83,7 +83,7 @@ public final class InterfaceUtils {
         if (tunnelInfo.isPresent()) {
             List<TunnelEndPoints> nexthopIpList = tunnelInfo.get().getTunnelEndPoints();
             if (nexthopIpList != null && !nexthopIpList.isEmpty()) {
-                nextHopIp = new String(nexthopIpList.get(0).getIpAddress().getValue());
+                nextHopIp = nexthopIpList.get(0).getIpAddress().stringValue();
             }
         }
         return nextHopIp;
index a0317a0b8fa8b89da0c4a30e4d13304530e06d97..0047c96283dfa81e29b8c0d192a0dc5b81b69433 100644 (file)
@@ -38,8 +38,9 @@ import org.opendaylight.openflowplugin.libraries.liblldp.NetUtils;
 import org.opendaylight.openflowplugin.libraries.liblldp.Packet;
 import org.opendaylight.openflowplugin.libraries.liblldp.PacketException;
 import org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.VpnInterface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefixBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
@@ -413,8 +414,8 @@ public class SubnetRoutePacketInHandler implements PacketProcessingListener {
                 SubnetOpDataEntry subOpEntry = optionalSubs.get();
                 if (subOpEntry.getNhDpnId() != null) {
                     LOG.trace("{} getTargetDpnForPacketOut: Viewing Subnet {}", LOGGING_PREFIX, subnetId.getValue());
-                    IpPrefix cidr = new IpPrefix(subOpEntry.getSubnetCidr().toCharArray());
-                    boolean match = NWUtil.isIpAddressInRange(new IpAddress(ipAddress.toCharArray()), cidr);
+                    IpPrefix cidr = IpPrefixBuilder.getDefaultInstance(subOpEntry.getSubnetCidr());
+                    boolean match = NWUtil.isIpAddressInRange(IpAddressBuilder.getDefaultInstance(ipAddress), cidr);
                     LOG.trace("{} getTargetDpnForPacketOut: Viewing Subnet {} matching {}", LOGGING_PREFIX,
                             subnetId.getValue(), match);
                     if (match) {
index cdae7499f0b2073a7f9dd0140b3e6fb169164957..6bc22a80eba1b6da6e86b13def642e756df85adc 100644 (file)
@@ -176,7 +176,7 @@ public class TunnelInterfaceStateListener extends AsyncDataTreeChangeListenerBas
 
         //Remove the corresponding nexthop from the routepath under extraroute in fibentries.
         BigInteger srcDpnId = new BigInteger(update.getSrcInfo().getTepDeviceId());
-        String srcTepIp = String.valueOf(update.getSrcInfo().getTepIp().getValue());
+        String srcTepIp = update.getSrcInfo().getTepIp().stringValue();
         List<VpnInstanceOpDataEntry> vpnInstanceOpData = vpnUtil.getAllVpnInstanceOpData();
         if (vpnInstanceOpData == null) {
             LOG.trace("update: No vpnInstanceOpdata present");
@@ -251,8 +251,8 @@ public class TunnelInterfaceStateListener extends AsyncDataTreeChangeListenerBas
     @SuppressWarnings("checkstyle:IllegalCatch")
     private void handleTunnelEventForDPN(StateTunnelList stateTunnelList, TunnelAction tunnelAction) {
         final BigInteger srcDpnId = new BigInteger(stateTunnelList.getSrcInfo().getTepDeviceId());
-        final String srcTepIp = String.valueOf(stateTunnelList.getSrcInfo().getTepIp().getValue());
-        String destTepIp = String.valueOf(stateTunnelList.getDstInfo().getTepIp().getValue());
+        final String srcTepIp = stateTunnelList.getSrcInfo().getTepIp().stringValue();
+        String destTepIp = stateTunnelList.getDstInfo().getTepIp().stringValue();
         String rd;
         BigInteger remoteDpnId = null;
         boolean isTepDeletedOnDpn = false;
@@ -425,8 +425,8 @@ public class TunnelInterfaceStateListener extends AsyncDataTreeChangeListenerBas
         String rd;
         String intfName = cfgVpnInterface.getName();
         final BigInteger srcDpnId = new BigInteger(stateTunnelList.getSrcInfo().getTepDeviceId());
-        String destTepIp = String.valueOf(stateTunnelList.getDstInfo().getTepIp().getValue());
-        String srcTepIp = String.valueOf(stateTunnelList.getSrcInfo().getTepIp().getValue());
+        String destTepIp = stateTunnelList.getDstInfo().getTepIp().stringValue();
+        String srcTepIp = stateTunnelList.getSrcInfo().getTepIp().stringValue();
         int tunTypeVal = getTunnelType(stateTunnelList);
         BigInteger remoteDpnId = null;
         if (tunTypeVal == VpnConstants.ITMTunnelLocType.Internal.getValue()) {
@@ -566,7 +566,7 @@ public class TunnelInterfaceStateListener extends AsyncDataTreeChangeListenerBas
 
     private void programDcGwLoadBalancingGroup(StateTunnelList tunnelState, int addOrRemove) {
         IpAddress dcGwIp = tunnelState.getDstInfo().getTepIp();
-        String dcGwIpAddress = String.valueOf(dcGwIp.getValue());
+        String dcGwIpAddress = dcGwIp.stringValue();
         List<String> availableDcGws = getDcGwIps();
         BigInteger dpId = new BigInteger(tunnelState.getSrcInfo().getTepDeviceId());
         boolean isTunnelUp = TunnelOperStatus.Up == tunnelState.getOperState();
@@ -585,7 +585,7 @@ public class TunnelInterfaceStateListener extends AsyncDataTreeChangeListenerBas
         return dcGatewayIpListConfig.getDcGatewayIp()
                 .stream()
                 .filter(dcGwIp -> dcGwIp.getTunnnelType().equals(TunnelTypeMplsOverGre.class))
-                .map(dcGwIp -> String.valueOf(dcGwIp.getIpAddress().getValue())).sorted()
+                .map(dcGwIp -> dcGwIp.getIpAddress().stringValue()).sorted()
                 .collect(toList());
     }
 
index 52cf84de83108d62202e4233461c3d25f7ef8c1f..be53435b8e66263cf869f83c40f4a0574e1342d4 100755 (executable)
@@ -908,7 +908,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                                            WriteTransaction writeConfigTxn,
                                            WriteTransaction writeOperTxn) {
 
-        String srcTepIp = String.valueOf(stateTunnelList.getSrcInfo().getTepIp().getValue());
+        String srcTepIp = stateTunnelList.getSrcInfo().getTepIp().stringValue();
         BigInteger srcDpnId = new BigInteger(stateTunnelList.getSrcInfo().getTepDeviceId());
         AdjacenciesOp adjacencies = vpnInterface.augmentation(AdjacenciesOp.class);
         List<Adjacency> adjList = adjacencies != null ? adjacencies.getAdjacency() : new ArrayList<>();
@@ -1023,7 +1023,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
         String prefix = null;
         long label = 0;
         boolean isNextHopRemoveReqd = false;
-        String srcTepIp = String.valueOf(stateTunnelList.getSrcInfo().getTepIp().getValue());
+        String srcTepIp = stateTunnelList.getSrcInfo().getTepIp().stringValue();
         BigInteger srcDpnId = new BigInteger(stateTunnelList.getSrcInfo().getTepDeviceId());
         String vpnName = vpnInterface.getVpnInstanceName();
         long vpnId = vpnUtil.getVpnId(vpnName);
index 97fd69b418fad684328b4e28b54d40d4eb05dcc7..8a056bf1dab3e9fbc834c28f11336dc9ba66e0fc 100755 (executable)
@@ -352,7 +352,7 @@ public class IVpnLinkServiceImpl implements IVpnLinkService, AutoCloseable {
             LOG.info("Could not retrieve VpnMaps object from Configurational DS");
             return new HashMap<>();
         }
-        Map<String,String> vmap = new HashMap<String,String>();
+        Map<String,String> vmap = new HashMap<>();
         final List<VpnMap> VpnMapList = optVpnMaps.get().getVpnMap();
         for (VpnMap map : VpnMapList) {
             if (map.getRouterIds() == null) {
@@ -420,7 +420,7 @@ public class IVpnLinkServiceImpl implements IVpnLinkService, AutoCloseable {
         IpAddress nhIpAddr = route.getNexthop();
         String routeNextHop = nhIpAddr.getIpv4Address() != null ? nhIpAddr.getIpv4Address().getValue()
                                                                   : nhIpAddr.getIpv6Address().getValue();
-        String destination = String.valueOf(route.getDestination().getValue());
+        String destination = route.getDestination().stringValue();
 
         // is nexthop the other endpoint's IP
         String otherEndpoint = ivpnLink.getOtherEndpoint(vpnId);
index 15346f5eb21725ee3a449848e1b17ad9471cadfd..33d13e1169f5cdce26f0e3ca786d12983fac4f30 100644 (file)
@@ -23,6 +23,7 @@ import org.opendaylight.genius.mdsalutil.NWUtil;
 import org.opendaylight.netvirt.vpnmanager.VpnUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefixBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.LearntVpnVipToPortEventAction;
@@ -66,7 +67,7 @@ public abstract class AbstractIpLearnNotificationHandler {
         List<Adjacency> adjacencies = vpnUtil.getAdjacenciesForVpnInterfaceFromConfig(srcInterface);
         if (adjacencies != null) {
             for (Adjacency adj : adjacencies) {
-                IpPrefix ipPrefix = new IpPrefix(adj.getIpAddress().toCharArray());
+                IpPrefix ipPrefix = IpPrefixBuilder.getDefaultInstance(adj.getIpAddress());
                 if (NWUtil.isIpAddressInRange(srcIP, ipPrefix)) {
                     return;
                 }
@@ -74,7 +75,7 @@ public abstract class AbstractIpLearnNotificationHandler {
         }
 
         LOG.trace("ARP/NA Notification Response Received from interface {} and IP {} having MAC {}, learning MAC",
-                srcInterface, String.valueOf(srcIP.getValue()), srcMac.getValue());
+                srcInterface, srcIP.stringValue(), srcMac.getValue());
         processIpLearning(srcInterface, srcIP, srcMac, metadata, targetIP);
     }
 
@@ -83,8 +84,8 @@ public abstract class AbstractIpLearnNotificationHandler {
         if (metadata != null && !Objects.equals(metadata, BigInteger.ZERO)) {
             Optional<List<String>> vpnList = vpnUtil.getVpnHandlingIpv4AssociatedWithInterface(srcInterface);
             if (vpnList.isPresent()) {
-                String srcIpToQuery = String.valueOf(srcIP.getValue());
-                String destIpToQuery = String.valueOf(dstIP.getValue());
+                String srcIpToQuery = srcIP.stringValue();
+                String destIpToQuery = dstIP.stringValue();
                 for (String vpnName : vpnList.get()) {
                     LOG.info("Received ARP/NA for sender MAC {} and sender IP {} via interface {}",
                               srcMac.getValue(), srcIpToQuery, srcInterface);
@@ -125,8 +126,8 @@ public abstract class AbstractIpLearnNotificationHandler {
 
     private void learnMacFromIncomingPacket(String vpnName, String srcInterface, IpAddress srcIP, MacAddress srcMac,
             IpAddress dstIP) {
-        String srcIpToQuery = String.valueOf(srcIP.getValue());
-        String destIpToQuery = String.valueOf(dstIP.getValue());
+        String srcIpToQuery = srcIP.stringValue();
+        String destIpToQuery = dstIP.stringValue();
         synchronized ((vpnName + srcIpToQuery).intern()) {
             vpnUtil.createLearntVpnVipToPortEvent(vpnName, srcIpToQuery, destIpToQuery, srcInterface,
                     srcMac.getValue(), LearntVpnVipToPortEventAction.Add, null);
index 46b6bca0888d788926ad81750690fb0353e7d742..995979a2eb9ff75206df86c1c1eaf7e54312adfe 100644 (file)
@@ -12,10 +12,8 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
-
 import javax.inject.Inject;
 import javax.inject.Singleton;
-
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.genius.arputil.api.ArpConstants;
 import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
@@ -23,6 +21,7 @@ import org.opendaylight.infrautils.utils.concurrent.JdkFutures;
 import org.opendaylight.netvirt.neutronvpn.interfaces.INeutronVpnManager;
 import org.opendaylight.netvirt.vpnmanager.VpnUtil;
 import org.opendaylight.netvirt.vpnmanager.iplearn.model.MacEntry;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.AlivenessMonitorService;
@@ -95,7 +94,7 @@ public final class AlivenessMonitorUtils {
             return;
         }
 
-        final IpAddress targetIp = new IpAddress(macEntry.getIpAddress().getHostAddress().toCharArray());
+        final IpAddress targetIp = IetfInetUtil.INSTANCE.ipAddressFor(macEntry.getIpAddress());
         if (ipMonitorProfileId == null || ipMonitorProfileId.equals(0L)) {
             Optional<Long> profileIdOptional = allocateIpMonitorProfile(targetIp);
             if (!profileIdOptional.isPresent()) {
index 8b8c92f2c9423827488c8ac15c5db74ca890048e..c36fad20be59da85a893409fc3bed15d24f6f8a7 100644 (file)
@@ -53,14 +53,13 @@ public class ArpNotificationHandler extends AbstractIpLearnNotificationHandler i
             LOG.info(
                     "ArpNotification Non-Gratuitous Request Received from "
                             + "interface {} and IP {} having MAC {} target destination {}, ignoring..",
-                    srcInterface, String.valueOf(srcIP.getValue()), srcMac.getValue(),
-                    String.valueOf(targetIP.getValue()));
+                    srcInterface, srcIP.stringValue(), srcMac.getValue(), targetIP.stringValue());
             return;
         }
         LOG.info(
                 "ArpNotification Gratuitous Request Received from interface {} and IP {} having MAC {} "
                         + "target destination {}, learning MAC",
-                srcInterface, String.valueOf(srcIP.getValue()), srcMac.getValue(), String.valueOf(targetIP.getValue()));
+                srcInterface, srcIP.stringValue(), srcMac.getValue(), targetIP.stringValue());
 
         processIpLearning(srcInterface, srcIP, srcMac, metadata, targetIP);
     }
@@ -73,7 +72,7 @@ public class ArpNotificationHandler extends AbstractIpLearnNotificationHandler i
         BigInteger metadata = notification.getMetadata();
         IpAddress targetIP = notification.getDstIpaddress();
         LOG.info("ArpNotification Response Received from interface {} and IP {} having MAC {}, learning MAC",
-                srcInterface, String.valueOf(srcIP.getValue()), srcMac.getValue());
+                srcInterface, srcIP.stringValue(), srcMac.getValue());
 
         validateAndProcessIpLearning(srcInterface, srcIP, srcMac, targetIP, metadata);
     }
index f01c336febf24f0dfea6f899a2fc4fb259eb3c26..cbc67ec47fa72ee128ee831b29e80f04d716dfe1 100644 (file)
@@ -43,7 +43,7 @@ public class Ipv6NaNotificationHandler extends AbstractIpLearnNotificationHandle
         IpAddress targetIP = new IpAddress(naPacket.getTargetAddress());
         BigInteger metadata = naPacket.getMetadata();
         LOG.debug("NA notification received from interface {} and IP {} having MAC {}, targetIP={}", srcInterface,
-                String.valueOf(srcIP.getValue()), srcMac.getValue(), String.valueOf(targetIP.getValue()));
+                srcIP.stringValue(), srcMac.getValue(), targetIP.stringValue());
 
         validateAndProcessIpLearning(srcInterface, srcIP, srcMac, targetIP, metadata);
     }