From eb3aafa87540b253725b63e8b9c50278819765bb Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Mon, 2 Nov 2015 14:52:01 +0100 Subject: [PATCH] Inline variables Change-Id: I7999f158b755eb9b0a71bd38d3e065cc766f45a7 Signed-off-by: Stephen Kitt --- .../opendaylight/ovsdb/openstack/netvirt/it/NetvirtIT.java | 6 ++---- .../netvirt/sfc/openflow13/NetvirtSfcOF13Provider.java | 6 ++---- .../ovsdb/openstack/netvirt/sfc/NetvirtSfcIT.java | 3 +-- .../ovsdb/openstack/netvirt/NeutronCacheUtils.java | 3 +-- .../ovsdb/openstack/netvirt/impl/SouthboundImpl.java | 3 +-- .../ovsdb/utils/mdsal/node/StringConvertor.java | 3 +-- .../ovsdb/utils/southbound/utils/SouthboundUtils.java | 3 +-- 7 files changed, 9 insertions(+), 18 deletions(-) diff --git a/openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/NetvirtIT.java b/openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/NetvirtIT.java index c791ead971..5d29699642 100644 --- a/openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/NetvirtIT.java +++ b/openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/NetvirtIT.java @@ -194,7 +194,7 @@ public class NetvirtIT extends AbstractMdsalTestBase { LOG.info("getPropertiesOptions: Using the following properties: mode= {}, ip:port= {}:{}", connectionType, addressStr, portStr); - Option[] options = new Option[] { + return new Option[] { editConfigurationFilePut(NetvirtITConstants.CUSTOM_PROPERTIES, NetvirtITConstants.SERVER_IPADDRESS, addressStr), editConfigurationFilePut(NetvirtITConstants.CUSTOM_PROPERTIES, @@ -202,7 +202,6 @@ public class NetvirtIT extends AbstractMdsalTestBase { editConfigurationFilePut(NetvirtITConstants.CUSTOM_PROPERTIES, NetvirtITConstants.CONNECTION_TYPE, connectionType), }; - return options; } @Before @@ -303,9 +302,8 @@ public class NetvirtIT extends AbstractMdsalTestBase { } private Node getOvsdbNode(final ConnectionInfo connectionInfo) { - Node node = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, + return mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, SouthboundMapper.createInstanceIdentifier(connectionInfo)); - return node; } private boolean deleteOvsdbNode(final ConnectionInfo connectionInfo) throws InterruptedException { diff --git a/openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/openflow13/NetvirtSfcOF13Provider.java b/openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/openflow13/NetvirtSfcOF13Provider.java index adbc4717ca..d5e89e5b70 100644 --- a/openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/openflow13/NetvirtSfcOF13Provider.java +++ b/openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/openflow13/NetvirtSfcOF13Provider.java @@ -288,8 +288,7 @@ public class NetvirtSfcOF13Provider implements INetvirtSfcOF13Provider{ AceIpv4 aceIpv4 = (AceIpv4) aceIp.getAceIpVersion(); if (aceIpv4.getDestinationIpv4Network() != null) { String ipAddrPrefix = aceIpv4.getDestinationIpv4Network().getValue(); - String ipAddr = new StringTokenizer(ipAddrPrefix, "/").nextToken(); - return ipAddr; + return new StringTokenizer(ipAddrPrefix, "/").nextToken(); } } } @@ -302,9 +301,8 @@ public class NetvirtSfcOF13Provider implements INetvirtSfcOF13Provider{ if (aceIp.getAceIpVersion() instanceof AceIpv4) { AceIpv4 aceIpv4 = (AceIpv4) aceIp.getAceIpVersion(); if (aceIpv4.getSourceIpv4Network() != null) { - String ipAddrPrefix = aceIpv4.getSourceIpv4Network().getValue(); //String ipAddr = new StringTokenizer(ipAddrPrefix, "/").nextToken(); - return ipAddrPrefix; + return aceIpv4.getSourceIpv4Network().getValue(); } } } diff --git a/openstack/net-virt-sfc/it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/NetvirtSfcIT.java b/openstack/net-virt-sfc/it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/NetvirtSfcIT.java index 641b4771d7..bdbc82540c 100644 --- a/openstack/net-virt-sfc/it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/NetvirtSfcIT.java +++ b/openstack/net-virt-sfc/it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/NetvirtSfcIT.java @@ -305,8 +305,7 @@ public class NetvirtSfcIT extends AbstractMdsalTestBase { } private SfcBuilder setSfc() { - SfcBuilder sfcBuilder = sfcUtils.createSfc(new SfcBuilder(), "sfc"); - return sfcBuilder; + return sfcUtils.createSfc(new SfcBuilder(), "sfc"); } @Test diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/NeutronCacheUtils.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/NeutronCacheUtils.java index ece4f28f6c..c0e48e37f5 100755 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/NeutronCacheUtils.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/NeutronCacheUtils.java @@ -78,9 +78,8 @@ public class NeutronCacheUtils { List allNetworks = neutronNetworkCache.getAllNetworks(); for (NeutronNetwork network: allNetworks) { if (network.getID().equals(networkID)) { - Map.Entry entry = new AbstractMap.SimpleEntry<>( + return new AbstractMap.SimpleEntry<>( network.getProviderNetworkType(), network.getProviderSegmentationID()); - return entry; } } return null; diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SouthboundImpl.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SouthboundImpl.java index 50edae0f3e..4e309a81b8 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SouthboundImpl.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SouthboundImpl.java @@ -697,8 +697,7 @@ public class SouthboundImpl implements Southbound { .create(NetworkTopology.class) .child(Topology.class, new TopologyKey(MdsalHelper.OVSDB_TOPOLOGY_ID)); - Topology topology = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, path); - return topology; + return mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, path); } public Long getOFPort(OvsdbTerminationPointAugmentation port) { diff --git a/utils/mdsal-node/src/main/java/org/opendaylight/ovsdb/utils/mdsal/node/StringConvertor.java b/utils/mdsal-node/src/main/java/org/opendaylight/ovsdb/utils/mdsal/node/StringConvertor.java index f593f18ca9..307ca23e15 100644 --- a/utils/mdsal-node/src/main/java/org/opendaylight/ovsdb/utils/mdsal/node/StringConvertor.java +++ b/utils/mdsal-node/src/main/java/org/opendaylight/ovsdb/utils/mdsal/node/StringConvertor.java @@ -13,8 +13,7 @@ import java.math.BigInteger; public class StringConvertor{ public static long dpidStringToLong(String values) { - long value = new BigInteger(values.replaceAll(":", ""), 16).longValue(); - return value; + return new BigInteger(values.replaceAll(":", ""), 16).longValue(); } } diff --git a/utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java b/utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java index 2b81064040..c3f57c74c7 100644 --- a/utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java +++ b/utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java @@ -148,9 +148,8 @@ public class SouthboundUtils { } public Node getOvsdbNode(final ConnectionInfo connectionInfo) { - Node node = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, + return mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, createInstanceIdentifier(connectionInfo)); - return node; } public boolean deleteOvsdbNode(final ConnectionInfo connectionInfo) { -- 2.36.6