Migrate to stringValue() 97/74297/2
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 20 Jul 2018 16:33:33 +0000 (18:33 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 20 Jul 2018 16:40:04 +0000 (18:40 +0200)
This eliminates the use of char[]-based instantiation and conversion.

Change-Id: Ic9024531f138e52848fd0531c9a4d479b120af86
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronFirewallRuleInterface.java
transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronFloatingIpInterface.java
transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronLoadBalancerInterface.java
transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronLoadBalancerPoolInterface.java
transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronMeteringLabelRuleInterface.java
transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronPortInterface.java
transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronRouterInterface.java
transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronSFCFlowClassifierInterface.java
transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronSecurityRuleInterface.java
transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronSubnetInterface.java

index 12a64902568d3625f21924475c6071286e4f5f08..30c1ca45877050469391b21b293a6c7ec9d29a67 100644 (file)
@@ -23,11 +23,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.fwaas.rev150712.Act
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.fwaas.rev150712.ActionBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.fwaas.rev150712.ActionDeny;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.fwaas.rev150712.FirewallRuleAttributes.Protocol;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.fwaas.rev150712.FirewallRuleAttributesProtocolBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.fwaas.rev150712.rules.attributes.FirewallRules;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.fwaas.rev150712.rules.attributes.firewall.rules.FirewallRule;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.fwaas.rev150712.rules.attributes.firewall.rules.FirewallRuleBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.fwaas.rev150712.rules.attributes.firewall.rules.FirewallRuleKey;
 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.ops4j.pax.cdi.api.OsgiServiceProvider;
 
 @Singleton
@@ -81,10 +83,10 @@ public final class NeutronFirewallRuleInterface
             answer.setFirewallRuleIpVer(IP_VERSION_MAP.get(rule.getIpVersion()));
         }
         if (rule.getSourceIpAddr() != null) {
-            answer.setFirewallRuleSrcIpAddr(String.valueOf(rule.getSourceIpAddr().getValue()));
+            answer.setFirewallRuleSrcIpAddr(rule.getSourceIpAddr().stringValue());
         }
         if (rule.getDestinationIpAddr() != null) {
-            answer.setFirewallRuleDstIpAddr(String.valueOf(rule.getDestinationIpAddr().getValue()));
+            answer.setFirewallRuleDstIpAddr(rule.getDestinationIpAddr().stringValue());
         }
         if (rule.getSourcePortRangeMin() != null) {
             answer.setFirewallRuleSrcPortRangeMin(rule.getSourcePortRangeMin());
@@ -124,7 +126,7 @@ public final class NeutronFirewallRuleInterface
         if (rule.getFirewallRuleProtocol() != null) {
             final String protocolString = rule.getFirewallRuleProtocol();
             try {
-                final Protocol protocol = new Protocol(protocolString.toCharArray());
+                final Protocol protocol = FirewallRuleAttributesProtocolBuilder.getDefaultInstance(protocolString);
                 ruleBuilder.setProtocol(protocol);
             } catch (NumberFormatException e) {
                 throw new BadRequestException("Protocol {" + rule.getFirewallRuleProtocol() + "} is not supported");
@@ -135,11 +137,13 @@ public final class NeutronFirewallRuleInterface
             ruleBuilder.setIpVersion(mapper.get(rule.getFirewallRuleIpVer()));
         }
         if (rule.getFirewallRuleSrcIpAddr() != null) {
-            final IpPrefixOrAddress ipAddress = new IpPrefixOrAddress(rule.getFirewallRuleSrcIpAddr().toCharArray());
+            final IpPrefixOrAddress ipAddress = IpPrefixOrAddressBuilder.getDefaultInstance(
+                rule.getFirewallRuleSrcIpAddr());
             ruleBuilder.setSourceIpAddr(ipAddress);
         }
         if (rule.getFirewallRuleDstIpAddr() != null) {
-            final IpPrefixOrAddress ipAddress = new IpPrefixOrAddress(rule.getFirewallRuleDstIpAddr().toCharArray());
+            final IpPrefixOrAddress ipAddress = IpPrefixOrAddressBuilder.getDefaultInstance(
+                rule.getFirewallRuleDstIpAddr());
             ruleBuilder.setDestinationIpAddr(ipAddress);
         }
         if (rule.getFirewallRuleSrcPortRangeMin() != null) {
index f4aa79804a56b3b01fa921fea2c0f7fb83df8f62..98264fc61960d48ee96a914dabf6a72d16bd494c 100644 (file)
@@ -13,7 +13,7 @@ import javax.inject.Singleton;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.neutron.spi.INeutronFloatingIpCRUD;
 import org.opendaylight.neutron.spi.NeutronFloatingIp;
-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.neutron.l3.rev150712.floatingips.attributes.Floatingips;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.floatingips.attributes.floatingips.Floatingip;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.floatingips.attributes.floatingips.FloatingipBuilder;
@@ -43,10 +43,11 @@ public final class NeutronFloatingIpInterface
         final FloatingipBuilder floatingipBuilder = new FloatingipBuilder();
         toMdIds(floatingIp, floatingipBuilder);
         if (floatingIp.getFixedIpAddress() != null) {
-            floatingipBuilder.setFixedIpAddress(new IpAddress(floatingIp.getFixedIpAddress().toCharArray()));
+            floatingipBuilder.setFixedIpAddress(IpAddressBuilder.getDefaultInstance(floatingIp.getFixedIpAddress()));
         }
         if (floatingIp.getFloatingIpAddress() != null) {
-            floatingipBuilder.setFloatingIpAddress(new IpAddress(floatingIp.getFloatingIpAddress().toCharArray()));
+            floatingipBuilder.setFloatingIpAddress(IpAddressBuilder.getDefaultInstance(
+                floatingIp.getFloatingIpAddress()));
         }
         if (floatingIp.getFloatingNetworkUUID() != null) {
             floatingipBuilder.setFloatingNetworkId(toUuid(floatingIp.getFloatingNetworkUUID()));
@@ -74,10 +75,10 @@ public final class NeutronFloatingIpInterface
             result.setPortUUID(String.valueOf(fip.getPortId().getValue()));
         }
         if (fip.getFixedIpAddress() != null) {
-            result.setFixedIpAddress(String.valueOf(fip.getFixedIpAddress().getValue()));
+            result.setFixedIpAddress(fip.getFixedIpAddress().stringValue());
         }
         if (fip.getFloatingIpAddress() != null) {
-            result.setFloatingIpAddress(String.valueOf(fip.getFloatingIpAddress().getValue()));
+            result.setFloatingIpAddress(fip.getFloatingIpAddress().stringValue());
         }
         if (fip.getRouterId() != null) {
             result.setRouterUUID(String.valueOf(fip.getRouterId().getValue()));
index de42002240d0eeda2154670f34d770a2a80ed6dd..af44344be88bab03382d2d3933f6b4b983e58003 100644 (file)
@@ -13,7 +13,7 @@ import javax.inject.Singleton;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.neutron.spi.INeutronLoadBalancerCRUD;
 import org.opendaylight.neutron.spi.NeutronLoadBalancer;
-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.neutron.lbaasv2.rev150712.lbaas.attributes.Loadbalancers;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.loadbalancers.Loadbalancer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.lbaasv2.rev150712.lbaas.attributes.loadbalancers.LoadbalancerBuilder;
@@ -41,7 +41,7 @@ public final class NeutronLoadBalancerInterface
         final NeutronLoadBalancer answer = new NeutronLoadBalancer();
         fromMdAdminAttributes(loadBalancer, answer);
         if (loadBalancer.getVipAddress() != null) {
-            answer.setLoadBalancerVipAddress(String.valueOf(loadBalancer.getVipAddress().getValue()));
+            answer.setLoadBalancerVipAddress(String.valueOf(loadBalancer.getVipAddress().stringValue()));
         }
         if (loadBalancer.getVipSubnetId() != null) {
             answer.setLoadBalancerVipSubnetID(loadBalancer.getVipSubnetId().getValue());
@@ -54,7 +54,8 @@ public final class NeutronLoadBalancerInterface
         final LoadbalancerBuilder loadBalancerBuilder = new LoadbalancerBuilder();
         toMdAdminAttributes(loadBalancer, loadBalancerBuilder);
         if (loadBalancer.getLoadBalancerVipAddress() != null) {
-            loadBalancerBuilder.setVipAddress(new IpAddress(loadBalancer.getLoadBalancerVipAddress().toCharArray()));
+            loadBalancerBuilder.setVipAddress(IpAddressBuilder.getDefaultInstance(
+                loadBalancer.getLoadBalancerVipAddress()));
         }
         if (loadBalancer.getLoadBalancerVipSubnetID() != null) {
             loadBalancerBuilder.setVipSubnetId(toUuid(loadBalancer.getLoadBalancerVipSubnetID()));
index 1f1ee0608ab0d42a15b29158742cd30337096ac5..d217a5d67bdc212489b97f658e2133d4cd778469 100644 (file)
@@ -28,6 +28,7 @@ import org.opendaylight.neutron.spi.NeutronLoadBalancerPool;
 import org.opendaylight.neutron.spi.NeutronLoadBalancerPoolMember;
 import org.opendaylight.neutron.spi.NeutronLoadBalancerSessionPersistence;
 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.yang.types.rev130715.Uuid;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.ProtocolHttp;
@@ -236,7 +237,7 @@ public final class NeutronLoadBalancerPoolInterface
             answer.setPoolMemberAdminStateIsUp(member.isAdminStateUp());
         }
         if (member.getAddress() != null) {
-            answer.setPoolMemberAddress(String.valueOf(member.getAddress().getValue()));
+            answer.setPoolMemberAddress(member.getAddress().stringValue());
         }
         if (member.getProtocolPort() != null) {
             answer.setPoolMemberProtoPort(member.getProtocolPort());
@@ -254,7 +255,7 @@ public final class NeutronLoadBalancerPoolInterface
         final MemberBuilder memberBuilder = toMdIds(member, MemberBuilder.class);
         memberBuilder.setAdminStateUp(member.getPoolMemberAdminStateIsUp());
         if (member.getPoolMemberAddress() != null) {
-            final IpAddress ipAddress = new IpAddress(member.getPoolMemberAddress().toCharArray());
+            final IpAddress ipAddress = IpAddressBuilder.getDefaultInstance(member.getPoolMemberAddress());
             memberBuilder.setAddress(ipAddress);
         }
         if (member.getPoolMemberProtoPort() != null) {
index d9affc2d2657d963a8b2b93e7c51a41e89d38e55..839c30dd011bfb8bf1b305c737c507d15f714f97 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.neutron.spi.INeutronMeteringLabelRuleCRUD;
 import org.opendaylight.neutron.spi.NeutronMeteringLabelRule;
 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.neutron.constants.rev150712.NeutronUtils.DirectionMapper;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.metering.rev150712.metering.rules.attributes.MeteringRules;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.metering.rev150712.metering.rules.attributes.metering.rules.MeteringRule;
@@ -50,8 +51,8 @@ public final class NeutronMeteringLabelRuleInterface
                     DirectionMapper.get(meteringLabelRule.getMeteringLabelRuleDirection()));
         }
         if (meteringLabelRule.getMeteringLabelRuleRemoteIpPrefix() != null) {
-            final IpPrefix ipPrefix = new IpPrefix(
-                    meteringLabelRule.getMeteringLabelRuleRemoteIpPrefix().toCharArray());
+            final IpPrefix ipPrefix = IpPrefixBuilder.getDefaultInstance(
+                    meteringLabelRule.getMeteringLabelRuleRemoteIpPrefix());
             meteringRuleBuilder.setRemoteIpPrefix(ipPrefix);
         }
         meteringRuleBuilder.setExcluded(meteringLabelRule.getMeteringLabelRuleExcluded());
@@ -69,7 +70,7 @@ public final class NeutronMeteringLabelRuleInterface
             answer.setMeteringLabelRuleDirection(DirectionMapper.getDirectionString(rule.getDirection()));
         }
         if (rule.getRemoteIpPrefix() != null) {
-            answer.setMeteringLabelRuleRemoteIpPrefix(new String(rule.getRemoteIpPrefix().getValue()));
+            answer.setMeteringLabelRuleRemoteIpPrefix(rule.getRemoteIpPrefix().stringValue());
         }
         answer.setMeteringLabelRuleExcluded(rule.isExcluded());
         return answer;
index 2dfbcb6172a087f5d9a2b4e0f4d87965277d8d54..66f9f121b49c711925acaedbcc08ffc14b6e1344 100644 (file)
@@ -23,7 +23,7 @@ import org.opendaylight.neutron.spi.NeutronPort;
 import org.opendaylight.neutron.spi.NeutronPortAllowedAddressPairs;
 import org.opendaylight.neutron.spi.NeutronPortExtraDHCPOption;
 import org.opendaylight.neutron.spi.NeutronSecurityGroup;
-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.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.neutron.binding.rev150712.PortBindingExtension;
@@ -47,7 +47,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.portsecurity.rev150
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.portsecurity.rev150712.PortSecurityExtensionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosPortExtension;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosPortExtensionBuilder;
-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.ops4j.pax.cdi.api.OsgiServiceProvider;
 
 @Singleton
@@ -108,7 +108,7 @@ public final class NeutronPortInterface extends AbstractNeutronInterface<Port, P
             final List<NeutronPortAllowedAddressPairs> pairs = new ArrayList<>();
             for (final AllowedAddressPairs mdPair : port.getAllowedAddressPairs()) {
                 final NeutronPortAllowedAddressPairs pair = new NeutronPortAllowedAddressPairs();
-                pair.setIpAddress(String.valueOf(mdPair.getIpAddress().getValue()));
+                pair.setIpAddress(mdPair.getIpAddress().stringValue());
                 pair.setMacAddress(mdPair.getMacAddress().getValue());
                 pairs.add(pair);
             }
@@ -131,7 +131,7 @@ public final class NeutronPortInterface extends AbstractNeutronInterface<Port, P
             final List<NeutronIps> ips = new ArrayList<>();
             for (final FixedIps mdIp : port.getFixedIps()) {
                 final NeutronIps ip = new NeutronIps();
-                ip.setIpAddress(String.valueOf(mdIp.getIpAddress().getValue()));
+                ip.setIpAddress(mdIp.getIpAddress().stringValue());
                 ip.setSubnetUUID(mdIp.getSubnetId().getValue());
                 ips.add(ip);
             }
@@ -201,7 +201,7 @@ public final class NeutronPortInterface extends AbstractNeutronInterface<Port, P
             for (final NeutronPortAllowedAddressPairs allowedAddressPairs : neutronPort.getAllowedAddressPairs()) {
                 final AllowedAddressPairsBuilder allowedAddressPairsBuilder = new AllowedAddressPairsBuilder();
                 allowedAddressPairsBuilder
-                        .setIpAddress(new IpPrefixOrAddress(allowedAddressPairs.getIpAddress().toCharArray()));
+                        .setIpAddress(IpPrefixOrAddressBuilder.getDefaultInstance(allowedAddressPairs.getIpAddress()));
                 allowedAddressPairsBuilder.setMacAddress(new MacAddress(allowedAddressPairs.getMacAddress()));
                 listAllowedAddressPairs.add(allowedAddressPairsBuilder.build());
             }
@@ -234,7 +234,7 @@ public final class NeutronPortInterface extends AbstractNeutronInterface<Port, P
             final List<FixedIps> listNeutronIps = new ArrayList<>();
             for (final NeutronIps neutronIPs : neutronPort.getFixedIps()) {
                 final FixedIpsBuilder fixedIpsBuilder = new FixedIpsBuilder();
-                fixedIpsBuilder.setIpAddress(new IpAddress(neutronIPs.getIpAddress().toCharArray()));
+                fixedIpsBuilder.setIpAddress(IpAddressBuilder.getDefaultInstance(neutronIPs.getIpAddress()));
                 fixedIpsBuilder.setSubnetId(toUuid(neutronIPs.getSubnetUUID()));
                 listNeutronIps.add(fixedIpsBuilder.build());
             }
index f56aef457a9cc2047cee7d0f21553f035b6c59ee..f3b4e1f41e9df4ccf94ce9f4e671b8b4415f4d2f 100644 (file)
@@ -17,8 +17,8 @@ import org.opendaylight.neutron.spi.NeutronIps;
 import org.opendaylight.neutron.spi.NeutronRoute;
 import org.opendaylight.neutron.spi.NeutronRouter;
 import org.opendaylight.neutron.spi.NeutronRouterNetworkReference;
-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.opendaylight.neutron.l3.rev150712.l3.attributes.Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.l3.attributes.RoutesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.Routers;
@@ -61,8 +61,8 @@ public final class NeutronRouterInterface extends AbstractNeutronInterface<Route
             final List<Routes> routes = new ArrayList<>();
             for (final NeutronRoute route : router.getRoutes()) {
                 final RoutesBuilder routeBuilder = new RoutesBuilder();
-                routeBuilder.setDestination(new IpPrefix(route.getDestination().toCharArray()));
-                routeBuilder.setNexthop(new IpAddress(route.getNextHop().toCharArray()));
+                routeBuilder.setDestination(IpPrefixBuilder.getDefaultInstance(route.getDestination()));
+                routeBuilder.setNexthop(IpAddressBuilder.getDefaultInstance(route.getNextHop()));
                 routes.add(routeBuilder.build());
             }
             routerBuilder.setRoutes(routes);
@@ -79,7 +79,7 @@ public final class NeutronRouterInterface extends AbstractNeutronInterface<Route
                     final List<ExternalFixedIps> externalFixedIps = new ArrayList<>();
                     for (final NeutronIps externalIp : externalGatewayInfos.getExternalFixedIps()) {
                         final ExternalFixedIpsBuilder eFixedIpBuilder = new ExternalFixedIpsBuilder();
-                        eFixedIpBuilder.setIpAddress(new IpAddress(externalIp.getIpAddress().toCharArray()));
+                        eFixedIpBuilder.setIpAddress(IpAddressBuilder.getDefaultInstance(externalIp.getIpAddress()));
                         eFixedIpBuilder.setSubnetId(toUuid(externalIp.getSubnetUUID()));
                         externalFixedIps.add(eFixedIpBuilder.build());
                     }
@@ -104,8 +104,8 @@ public final class NeutronRouterInterface extends AbstractNeutronInterface<Route
             final List<NeutronRoute> routes = new ArrayList<>();
             for (final Routes route : router.getRoutes()) {
                 final NeutronRoute routerRoute = new NeutronRoute();
-                routerRoute.setDestination(String.valueOf(route.getDestination().getValue()));
-                routerRoute.setNextHop(String.valueOf(route.getNexthop().getValue()));
+                routerRoute.setDestination(route.getDestination().stringValue());
+                routerRoute.setNextHop(route.getNexthop().stringValue());
                 routes.add(routerRoute);
             }
             result.setRoutes(routes);
@@ -120,7 +120,7 @@ public final class NeutronRouterInterface extends AbstractNeutronInterface<Route
                 for (final ExternalFixedIps mdFixedIp : router.getExternalGatewayInfo().getExternalFixedIps()) {
                     final NeutronIps fixedIp = new NeutronIps();
                     fixedIp.setSubnetUUID(String.valueOf(mdFixedIp.getSubnetId().getValue()));
-                    fixedIp.setIpAddress(String.valueOf(mdFixedIp.getIpAddress().getValue()));
+                    fixedIp.setIpAddress(mdFixedIp.getIpAddress().stringValue());
                     fixedIps.add(fixedIp);
                 }
                 extGwInfo.setExternalFixedIps(fixedIps);
index fa1d03d3ed13d2015786ecabec77dc665a673ece..2d809cebf65c77ff934122807589365463fab29e 100644 (file)
@@ -17,7 +17,7 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.neutron.northbound.api.BadRequestException;
 import org.opendaylight.neutron.spi.INeutronSFCFlowClassifierCRUD;
 import org.opendaylight.neutron.spi.NeutronSFCFlowClassifier;
-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.Uuid;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.EthertypeBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.EthertypeV4;
@@ -101,10 +101,11 @@ public final class NeutronSFCFlowClassifierInterface
             result.setDestinationPortRangeMax(neutronClassifier.getDestinationPortRangeMax());
         }
         if (neutronClassifier.getSourceIpPrefix() != null) {
-            result.setSourceIpPrefix(new IpPrefix(neutronClassifier.getSourceIpPrefix().toCharArray()));
+            result.setSourceIpPrefix(IpPrefixBuilder.getDefaultInstance(neutronClassifier.getSourceIpPrefix()));
         }
         if (neutronClassifier.getDestinationIpPrefix() != null) {
-            result.setDestinationIpPrefix(new IpPrefix(neutronClassifier.getDestinationIpPrefix().toCharArray()));
+            result.setDestinationIpPrefix(IpPrefixBuilder.getDefaultInstance(
+                neutronClassifier.getDestinationIpPrefix()));
         }
         if (neutronClassifier.getLogicalSourcePortUUID() != null) {
             result.setLogicalSourcePort(new Uuid(neutronClassifier.getLogicalSourcePortUUID()));
@@ -151,10 +152,10 @@ public final class NeutronSFCFlowClassifierInterface
             result.setDestinationPortRangeMax(mdClassifier.getDestinationPortRangeMax());
         }
         if (mdClassifier.getSourceIpPrefix() != null) {
-            result.setSourceIpPrefix(String.valueOf(mdClassifier.getSourceIpPrefix().getValue()));
+            result.setSourceIpPrefix(mdClassifier.getSourceIpPrefix().stringValue());
         }
         if (mdClassifier.getDestinationIpPrefix() != null) {
-            result.setDestinationIpPrefix(String.valueOf(mdClassifier.getDestinationIpPrefix().getValue()));
+            result.setDestinationIpPrefix(mdClassifier.getDestinationIpPrefix().stringValue());
         }
         if (mdClassifier.getLogicalSourcePort() != null) {
             result.setLogicalSourcePortUUID(mdClassifier.getLogicalSourcePort().getValue());
index 73015be0ae250d3d9f26a2c9b44b3f12da6c4c57..a26bc3c53c14365269248f83327bb40c551fba28 100644 (file)
@@ -19,12 +19,14 @@ import org.opendaylight.neutron.northbound.api.BadRequestException;
 import org.opendaylight.neutron.spi.INeutronSecurityRuleCRUD;
 import org.opendaylight.neutron.spi.NeutronSecurityRule;
 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.neutron.constants.rev150712.EthertypeBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.EthertypeV4;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.EthertypeV6;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.NeutronUtils.DirectionMapper;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.NeutronUtils.ProtocolMapper;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.SecurityRuleAttributes.Protocol;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.SecurityRuleAttributesProtocolBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.rules.attributes.SecurityRules;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.rules.attributes.security.rules.SecurityRule;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.rules.attributes.security.rules.SecurityRuleBuilder;
@@ -68,7 +70,7 @@ public final class NeutronSecurityRuleInterface extends
             answer.setSecurityRemoteGroupID(rule.getRemoteGroupId().getValue());
         }
         if (rule.getRemoteIpPrefix() != null) {
-            answer.setSecurityRuleRemoteIpPrefix(new String(rule.getRemoteIpPrefix().getValue()));
+            answer.setSecurityRuleRemoteIpPrefix(rule.getRemoteIpPrefix().stringValue());
         }
         if (rule.getProtocol() != null) {
             final Protocol protocol = rule.getProtocol();
@@ -108,13 +110,13 @@ public final class NeutronSecurityRuleInterface extends
             securityRuleBuilder.setRemoteGroupId(toUuid(securityRule.getSecurityRemoteGroupID()));
         }
         if (securityRule.getSecurityRuleRemoteIpPrefix() != null) {
-            final IpPrefix ipPrefix = new IpPrefix(securityRule.getSecurityRuleRemoteIpPrefix().toCharArray());
+            final IpPrefix ipPrefix = IpPrefixBuilder.getDefaultInstance(securityRule.getSecurityRuleRemoteIpPrefix());
             securityRuleBuilder.setRemoteIpPrefix(ipPrefix);
         }
         if (securityRule.getSecurityRuleProtocol() != null) {
             final String protocolString = securityRule.getSecurityRuleProtocol();
             try {
-                final Protocol protocol = new Protocol(protocolString.toCharArray());
+                final Protocol protocol = SecurityRuleAttributesProtocolBuilder.getDefaultInstance(protocolString);
                 securityRuleBuilder.setProtocol(protocol);
             } catch (NumberFormatException e) {
                 throw new BadRequestException("Protocol {" + securityRule.getSecurityRuleProtocol()
index 136f6447a5e081b8bfb035884b1adb0278e0ee77..49d7e546b3217eac46fdf69610c595f8debb0074 100644 (file)
@@ -18,6 +18,7 @@ import org.opendaylight.neutron.spi.NeutronRoute;
 import org.opendaylight.neutron.spi.NeutronSubnet;
 import org.opendaylight.neutron.spi.NeutronSubnetIpAllocationPool;
 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.neutron.constants.rev150712.Dhcpv6Base;
@@ -74,9 +75,9 @@ public final class NeutronSubnetInterface extends AbstractNeutronInterface<Subne
         fromMdBaseAttributes(subnet, result);
         result.setNetworkUUID(subnet.getNetworkId().getValue());
         result.setIpVersion(IPV_MAP.get(subnet.getIpVersion()));
-        result.setCidr(String.valueOf(subnet.getCidr().getValue()));
+        result.setCidr(subnet.getCidr().stringValue());
         if (subnet.getGatewayIp() != null) {
-            result.setGatewayIp(String.valueOf(subnet.getGatewayIp().getValue()));
+            result.setGatewayIp(subnet.getGatewayIp().stringValue());
         }
         if (subnet.getIpv6RaMode() != null) {
             result.setIpV6RaMode(DHCPV6_MAP.get(subnet.getIpv6RaMode()));
@@ -89,8 +90,8 @@ public final class NeutronSubnetInterface extends AbstractNeutronInterface<Subne
             final List<NeutronSubnetIpAllocationPool> allocationPools = new ArrayList<>();
             for (final AllocationPools allocationPool : subnet.getAllocationPools()) {
                 final NeutronSubnetIpAllocationPool pool = new NeutronSubnetIpAllocationPool();
-                pool.setPoolStart(String.valueOf(allocationPool.getStart().getValue()));
-                pool.setPoolEnd(String.valueOf(allocationPool.getEnd().getValue()));
+                pool.setPoolStart(allocationPool.getStart().stringValue());
+                pool.setPoolEnd(allocationPool.getEnd().stringValue());
                 allocationPools.add(pool);
             }
             result.setAllocationPools(allocationPools);
@@ -98,7 +99,7 @@ public final class NeutronSubnetInterface extends AbstractNeutronInterface<Subne
         if (subnet.getDnsNameservers() != null) {
             final List<String> dnsNameServers = new ArrayList<>();
             for (final IpAddress dnsNameServer : subnet.getDnsNameservers()) {
-                dnsNameServers.add(String.valueOf(dnsNameServer.getValue()));
+                dnsNameServers.add(dnsNameServer.stringValue());
             }
             result.setDnsNameservers(dnsNameServers);
         }
@@ -106,8 +107,8 @@ public final class NeutronSubnetInterface extends AbstractNeutronInterface<Subne
             final List<NeutronRoute> hostRoutes = new ArrayList<>();
             for (final HostRoutes hostRoute : subnet.getHostRoutes()) {
                 final NeutronRoute nsHostRoute = new NeutronRoute();
-                nsHostRoute.setDestination(String.valueOf(hostRoute.getDestination().getValue()));
-                nsHostRoute.setNextHop(String.valueOf(hostRoute.getNexthop().getValue()));
+                nsHostRoute.setDestination(hostRoute.getDestination().stringValue());
+                nsHostRoute.setNextHop(hostRoute.getNexthop().stringValue());
                 hostRoutes.add(nsHostRoute);
             }
             result.setHostRoutes(hostRoutes);
@@ -131,7 +132,7 @@ public final class NeutronSubnetInterface extends AbstractNeutronInterface<Subne
             subnetBuilder.setCidr(ipPrefix);
         }
         if (subnet.getGatewayIp() != null) {
-            final IpAddress ipAddress = new IpAddress(subnet.getGatewayIp().toCharArray());
+            final IpAddress ipAddress = IpAddressBuilder.getDefaultInstance(subnet.getGatewayIp());
             subnetBuilder.setGatewayIp(ipAddress);
         }
         if (subnet.getIpV6RaMode() != null) {
@@ -147,8 +148,8 @@ public final class NeutronSubnetInterface extends AbstractNeutronInterface<Subne
             final List<AllocationPools> allocationPools = new ArrayList<>();
             for (final NeutronSubnetIpAllocationPool allocationPool : subnet.getAllocationPools()) {
                 final AllocationPoolsBuilder builder = new AllocationPoolsBuilder();
-                builder.setStart(new IpAddress(allocationPool.getPoolStart().toCharArray()));
-                builder.setEnd(new IpAddress(allocationPool.getPoolEnd().toCharArray()));
+                builder.setStart(IpAddressBuilder.getDefaultInstance(allocationPool.getPoolStart()));
+                builder.setEnd(IpAddressBuilder.getDefaultInstance(allocationPool.getPoolEnd()));
                 final AllocationPools temp = builder.build();
                 allocationPools.add(temp);
             }
@@ -157,7 +158,7 @@ public final class NeutronSubnetInterface extends AbstractNeutronInterface<Subne
         if (subnet.getDnsNameservers() != null) {
             final List<IpAddress> dnsNameServers = new ArrayList<>();
             for (final String dnsNameServer : subnet.getDnsNameservers()) {
-                final IpAddress ipAddress = new IpAddress(dnsNameServer.toCharArray());
+                final IpAddress ipAddress = IpAddressBuilder.getDefaultInstance(dnsNameServer);
                 dnsNameServers.add(ipAddress);
             }
             subnetBuilder.setDnsNameservers(dnsNameServers);
@@ -166,8 +167,8 @@ public final class NeutronSubnetInterface extends AbstractNeutronInterface<Subne
             final List<HostRoutes> hostRoutes = new ArrayList<>();
             for (final NeutronRoute hostRoute : subnet.getHostRoutes()) {
                 final HostRoutesBuilder hrBuilder = new HostRoutesBuilder();
-                hrBuilder.setDestination(new IpPrefix(hostRoute.getDestination().toCharArray()));
-                hrBuilder.setNexthop(new IpAddress(hostRoute.getNextHop().toCharArray()));
+                hrBuilder.setDestination(IpPrefixBuilder.getDefaultInstance(hostRoute.getDestination()));
+                hrBuilder.setNexthop(IpAddressBuilder.getDefaultInstance(hostRoute.getNextHop()));
                 hostRoutes.add(hrBuilder.build());
             }
             subnetBuilder.setHostRoutes(hostRoutes);