From 8810e828363e6ecb044e98215e5f4b546b795d00 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Fri, 20 Jul 2018 18:33:33 +0200 Subject: [PATCH] Migrate to stringValue() This eliminates the use of char[]-based instantiation and conversion. Change-Id: Ic9024531f138e52848fd0531c9a4d479b120af86 Signed-off-by: Robert Varga --- .../NeutronFirewallRuleInterface.java | 14 ++++++---- .../NeutronFloatingIpInterface.java | 11 ++++---- .../NeutronLoadBalancerInterface.java | 7 ++--- .../NeutronLoadBalancerPoolInterface.java | 5 ++-- .../NeutronMeteringLabelRuleInterface.java | 7 ++--- .../transcriber/NeutronPortInterface.java | 12 ++++----- .../transcriber/NeutronRouterInterface.java | 16 +++++------ .../NeutronSFCFlowClassifierInterface.java | 11 ++++---- .../NeutronSecurityRuleInterface.java | 8 +++--- .../transcriber/NeutronSubnetInterface.java | 27 ++++++++++--------- 10 files changed, 65 insertions(+), 53 deletions(-) diff --git a/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronFirewallRuleInterface.java b/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronFirewallRuleInterface.java index 12a649025..30c1ca458 100644 --- a/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronFirewallRuleInterface.java +++ b/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronFirewallRuleInterface.java @@ -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) { diff --git a/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronFloatingIpInterface.java b/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronFloatingIpInterface.java index f4aa79804..98264fc61 100644 --- a/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronFloatingIpInterface.java +++ b/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronFloatingIpInterface.java @@ -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())); diff --git a/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronLoadBalancerInterface.java b/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronLoadBalancerInterface.java index de4200224..af44344be 100644 --- a/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronLoadBalancerInterface.java +++ b/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronLoadBalancerInterface.java @@ -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())); diff --git a/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronLoadBalancerPoolInterface.java b/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronLoadBalancerPoolInterface.java index 1f1ee0608..d217a5d67 100644 --- a/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronLoadBalancerPoolInterface.java +++ b/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronLoadBalancerPoolInterface.java @@ -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) { diff --git a/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronMeteringLabelRuleInterface.java b/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronMeteringLabelRuleInterface.java index d9affc2d2..839c30dd0 100644 --- a/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronMeteringLabelRuleInterface.java +++ b/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronMeteringLabelRuleInterface.java @@ -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; diff --git a/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronPortInterface.java b/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronPortInterface.java index 2dfbcb617..66f9f121b 100644 --- a/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronPortInterface.java +++ b/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronPortInterface.java @@ -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 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 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 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()); } diff --git a/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronRouterInterface.java b/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronRouterInterface.java index f56aef457..f3b4e1f41 100644 --- a/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronRouterInterface.java +++ b/transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronRouterInterface.java @@ -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 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 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 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 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 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 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 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 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 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); -- 2.36.6