X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=southbound%2Fsouthbound-it%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fovsdb%2Fsouthbound%2Fit%2FSouthboundIT.java;h=435efbf16a0eafb40783d87ca4d0e1c7d7570cfc;hb=47d11e4b27a3b25104efb0a1e4d835b76370c767;hp=57e5996fcd6568d4d060f261a90973cc6d3b7011;hpb=abed5697526843141bd1e7885d21b54baa127a6e;p=ovsdb.git diff --git a/southbound/southbound-it/src/test/java/org/opendaylight/ovsdb/southbound/it/SouthboundIT.java b/southbound/southbound-it/src/test/java/org/opendaylight/ovsdb/southbound/it/SouthboundIT.java index 57e5996fc..435efbf16 100644 --- a/southbound/southbound-it/src/test/java/org/opendaylight/ovsdb/southbound/it/SouthboundIT.java +++ b/southbound/southbound-it/src/test/java/org/opendaylight/ovsdb/southbound/it/SouthboundIT.java @@ -7,9 +7,13 @@ */ package org.opendaylight.ovsdb.southbound.it; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import static org.junit.Assume.assumeFalse; import static org.ops4j.pax.exam.CoreOptions.composite; import static org.ops4j.pax.exam.CoreOptions.maven; import static org.ops4j.pax.exam.CoreOptions.propagateSystemProperties; @@ -18,7 +22,6 @@ import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfi import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder; import com.google.common.collect.ImmutableBiMap; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.Sets; @@ -35,11 +38,9 @@ import java.util.Map; import java.util.Properties; import java.util.Set; import javax.inject.Inject; -import jersey.repackaged.com.google.common.collect.Maps; +import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import org.junit.After; -import org.junit.Assert; -import org.junit.Assume; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; @@ -56,7 +57,7 @@ import org.opendaylight.ovsdb.lib.notation.Version; import org.opendaylight.ovsdb.southbound.SouthboundConstants; import org.opendaylight.ovsdb.southbound.SouthboundMapper; import org.opendaylight.ovsdb.southbound.SouthboundUtil; -import org.opendaylight.ovsdb.utils.mdsal.utils.ControllerMdsalUtils; +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.PortNumber; @@ -85,8 +86,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.re import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.BridgeOtherConfigsKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ControllerEntry; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ControllerEntryBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ControllerEntryKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ProtocolEntry; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ProtocolEntryBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ProtocolEntryKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.Autoattach; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.AutoattachBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.AutoattachKey; @@ -162,7 +165,10 @@ import org.opendaylight.yangtools.yang.binding.Identifiable; import org.opendaylight.yangtools.yang.binding.Identifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; +import org.opendaylight.yangtools.yang.binding.util.BindingMap; +import org.opendaylight.yangtools.yang.common.Uint16; import org.opendaylight.yangtools.yang.common.Uint32; +import org.opendaylight.yangtools.yang.common.Uint8; import org.ops4j.pax.exam.Configuration; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.junit.PaxExam; @@ -190,13 +196,13 @@ public class SouthboundIT extends AbstractMdsalTestBase { private static final String FORMAT_STR = "%s_%s_%d"; private static final Version AUTOATTACH_FROM_VERSION = Version.fromString("7.11.2"); private static final Version IF_INDEX_FROM_VERSION = Version.fromString("7.2.1"); - private static final Long MAX_BACKOFF = 10000L; - private static final Long INACTIVITY_PROBE = 30000L; + private static final Uint32 MAX_BACKOFF = Uint32.valueOf(10000); + private static final Uint32 INACTIVITY_PROBE = Uint32.valueOf(30000); private static String addressStr; - private static int portNumber; + private static Uint16 portNumber; private static String connectionType; private static boolean setup = false; - private static ControllerMdsalUtils mdsalUtils = null; + private static MdsalUtils mdsalUtils = null; private static Node ovsdbNode; private static int testMethodsRemaining; private static Version schemaVersion; @@ -221,18 +227,18 @@ public class SouthboundIT extends AbstractMdsalTestBase { private final Set> updatedIids = new HashSet<>(); private final InstanceIdentifier iid; - private NotifyingDataChangeListener(LogicalDatastoreType type) { + private NotifyingDataChangeListener(final LogicalDatastoreType type) { this.type = type; this.iid = null; } - private NotifyingDataChangeListener(LogicalDatastoreType type, InstanceIdentifier iid) { + private NotifyingDataChangeListener(final LogicalDatastoreType type, final InstanceIdentifier iid) { this.type = type; this.iid = iid; } @Override - public void onDataTreeChanged(Collection> changes) { + public void onDataTreeChanged(final Collection> changes) { for (DataTreeModification change: changes) { DataObjectModification rootNode = change.getRootNode(); final InstanceIdentifier identifier = change.getRootPath().getRootIdentifier(); @@ -269,15 +275,15 @@ public class SouthboundIT extends AbstractMdsalTestBase { } } - public boolean isCreated(InstanceIdentifier path) { + public boolean isCreated(final InstanceIdentifier path) { return createdIids.remove(path); } - public boolean isRemoved(InstanceIdentifier path) { + public boolean isRemoved(final InstanceIdentifier path) { return removedIids.remove(path); } - public boolean isUpdated(InstanceIdentifier path) { + public boolean isUpdated(final InstanceIdentifier path) { return updatedIids.remove(path); } @@ -292,7 +298,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { (InstanceIdentifier)iid), this); } - public void waitForCreation(long timeout) throws InterruptedException { + public void waitForCreation(final long timeout) throws InterruptedException { synchronized (this) { long start = System.currentTimeMillis(); LOG.info("Waiting for {} DataChanged creation on {}", type, iid); @@ -303,7 +309,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { } } - public void waitForDeletion(long timeout) throws InterruptedException { + public void waitForDeletion(final long timeout) throws InterruptedException { synchronized (this) { long start = System.currentTimeMillis(); LOG.info("Waiting for {} DataChanged deletion on {}", type, iid); @@ -314,7 +320,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { } } - public void waitForUpdate(long timeout) throws InterruptedException { + public void waitForUpdate(final long timeout) throws InterruptedException { synchronized (this) { long start = System.currentTimeMillis(); LOG.info("Waiting for {} DataChanged update on {}", type, iid); @@ -340,7 +346,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { return combinedOptions; } - private Option[] getOtherOptions() { + private static Option[] getOtherOptions() { return new Option[] { vmOption("-javaagent:../jars/org.jacoco.agent.jar=destfile=../../jacoco-it.exec"), keepRuntimeFolder() @@ -387,7 +393,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { super.getLoggingOption()); } - private Option[] getPropertiesOptions() { + private static Option[] getPropertiesOptions() { Properties props = new Properties(System.getProperties()); String ipAddressStr = props.getProperty(SouthboundITConstants.SERVER_IPADDRESS, SouthboundITConstants.DEFAULT_SERVER_IPADDRESS); @@ -422,7 +428,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { } super.setup(); - Assert.assertNotNull("db should not be null", dataBroker); + assertNotNull("db should not be null", dataBroker); LOG.info("sleeping for 10s to let the features finish installing"); Thread.sleep(10000); @@ -430,8 +436,8 @@ public class SouthboundIT extends AbstractMdsalTestBase { addressStr = bundleContext.getProperty(SouthboundITConstants.SERVER_IPADDRESS); String portStr = bundleContext.getProperty(SouthboundITConstants.SERVER_PORT); try { - portNumber = Integer.parseInt(portStr); - } catch (NumberFormatException e) { + portNumber = Uint16.valueOf(portStr); + } catch (IllegalArgumentException e) { fail("Invalid port number " + portStr + System.lineSeparator() + usage()); } connectionType = bundleContext.getProperty(SouthboundITConstants.CONNECTION_TYPE); @@ -444,7 +450,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { } } - mdsalUtils = new ControllerMdsalUtils(dataBroker); + mdsalUtils = new MdsalUtils(dataBroker); assertTrue("Did not find " + SouthboundUtils.OVSDB_TOPOLOGY_ID.getValue(), getOvsdbTopology()); final ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portNumber); final InstanceIdentifier iid = SouthboundUtils.createInstanceIdentifier(connectionInfo); @@ -494,7 +500,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { } } - private Boolean getOvsdbTopology() { + private static Boolean getOvsdbTopology() { LOG.info("getOvsdbTopology: looking for {}...", SouthboundUtils.OVSDB_TOPOLOGY_ID.getValue()); Boolean found = false; final TopologyId topologyId = SouthboundUtils.OVSDB_TOPOLOGY_ID; @@ -530,7 +536,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { } } - private static ConnectionInfo getConnectionInfo(final String ipAddressStr, final int portNum) { + private static ConnectionInfo getConnectionInfo(final String ipAddressStr, final Uint16 portNum) { InetAddress inetAddress = null; try { inetAddress = InetAddress.getByName(ipAddressStr); @@ -553,13 +559,11 @@ public class SouthboundIT extends AbstractMdsalTestBase { public void testNetworkTopology() throws InterruptedException { NetworkTopology networkTopology = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(NetworkTopology.class)); - Assert.assertNotNull("NetworkTopology could not be found in " + LogicalDatastoreType.CONFIGURATION, - networkTopology); + assertNotNull("NetworkTopology could not be found in " + LogicalDatastoreType.CONFIGURATION, networkTopology); networkTopology = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(NetworkTopology.class)); - Assert.assertNotNull("NetworkTopology could not be found in " + LogicalDatastoreType.OPERATIONAL, - networkTopology); + assertNotNull("NetworkTopology could not be found in " + LogicalDatastoreType.OPERATIONAL, networkTopology); } @Test @@ -569,27 +573,25 @@ public class SouthboundIT extends AbstractMdsalTestBase { .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID)); Topology topology = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, path); - Assert.assertNotNull("Topology could not be found in " + LogicalDatastoreType.CONFIGURATION, - topology); + assertNotNull("Topology could not be found in " + LogicalDatastoreType.CONFIGURATION, topology); topology = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, path); - Assert.assertNotNull("Topology could not be found in " + LogicalDatastoreType.OPERATIONAL, - topology); + assertNotNull("Topology could not be found in " + LogicalDatastoreType.OPERATIONAL, topology); } - private Node connectOvsdbNode(final ConnectionInfo connectionInfo) throws InterruptedException { + private static Node connectOvsdbNode(final ConnectionInfo connectionInfo) throws InterruptedException { final InstanceIdentifier iid = SouthboundUtils.createInstanceIdentifier(connectionInfo); - Assert.assertTrue( + assertTrue( mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, iid, SouthboundUtils.createNode(connectionInfo))); waitForOperationalCreation(iid); Node node = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, iid); - Assert.assertNotNull(node); + assertNotNull(node); LOG.info("Connected to {}", SouthboundUtils.connectionInfoToString(connectionInfo)); return node; } - private void waitForOperationalCreation(InstanceIdentifier iid) throws InterruptedException { + private static void waitForOperationalCreation(final InstanceIdentifier iid) throws InterruptedException { synchronized (OPERATIONAL_LISTENER) { long start = System.currentTimeMillis(); LOG.info("Waiting for OPERATIONAL DataChanged creation on {}", iid); @@ -601,7 +603,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { } } - private static void waitForOperationalDeletion(InstanceIdentifier iid) throws InterruptedException { + private static void waitForOperationalDeletion(final InstanceIdentifier iid) throws InterruptedException { synchronized (OPERATIONAL_LISTENER) { long start = System.currentTimeMillis(); LOG.info("Waiting for OPERATIONAL DataChanged deletion on {}", iid); @@ -613,7 +615,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { } } - private void waitForOperationalUpdate(InstanceIdentifier iid) throws InterruptedException { + private static void waitForOperationalUpdate(final InstanceIdentifier iid) throws InterruptedException { synchronized (OPERATIONAL_LISTENER) { long start = System.currentTimeMillis(); LOG.info("Waiting for OPERATIONAL DataChanged update on {}", iid); @@ -627,10 +629,10 @@ public class SouthboundIT extends AbstractMdsalTestBase { private static void disconnectOvsdbNode(final ConnectionInfo connectionInfo) throws InterruptedException { final InstanceIdentifier iid = SouthboundUtils.createInstanceIdentifier(connectionInfo); - Assert.assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, iid)); + assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, iid)); waitForOperationalDeletion(iid); Node node = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, iid); - Assert.assertNull(node); + assertNull(node); LOG.info("Disconnected from {}", SouthboundUtils.connectionInfoToString(connectionInfo)); } @@ -664,8 +666,8 @@ public class SouthboundIT extends AbstractMdsalTestBase { null)) { // Verify that the device is netdev OvsdbBridgeAugmentation bridge = getBridge(connectionInfo); - Assert.assertNotNull(bridge); - Assert.assertEquals(dpType, bridge.getDatapathType()); + assertNotNull(bridge); + assertEquals(dpType, bridge.getDatapathType()); // Add port for all dpdk interface types (dpdkvhost not supported in existing dpdk ovs) List dpdkTypes = new ArrayList<>(); @@ -677,20 +679,17 @@ public class SouthboundIT extends AbstractMdsalTestBase { for (String dpdkType : dpdkTypes) { String testPortname = "test" + dpdkType + "port"; LOG.info("DPDK portname and type is {}, {}", testPortname, dpdkType); - Class dpdkIfType = SouthboundConstants.OVSDB_INTERFACE_TYPE_MAP - .get(dpdkType); OvsdbTerminationPointAugmentationBuilder ovsdbTerminationpointBuilder = createSpecificDpdkOvsdbTerminationPointAugmentationBuilder(testPortname, - dpdkIfType); - Assert.assertTrue( - addTerminationPoint(bridgeNodeId, testPortname, ovsdbTerminationpointBuilder)); + SouthboundConstants.OVSDB_INTERFACE_TYPE_MAP.get(dpdkType)); + assertTrue(addTerminationPoint(bridgeNodeId, testPortname, ovsdbTerminationpointBuilder)); } // Verify that all DPDK ports are created InstanceIdentifier terminationPointIid = getTpIid(connectionInfo, bridge); Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid); - Assert.assertNotNull(terminationPointNode); + assertNotNull(terminationPointNode); // Verify that each termination point has the specific DPDK ifType for (String dpdkType : dpdkTypes) { @@ -702,9 +701,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = terminationPoint .augmentation(OvsdbTerminationPointAugmentation.class); if (ovsdbTerminationPointAugmentation.getName().equals(testPortname)) { - Class opPort = ovsdbTerminationPointAugmentation - .getInterfaceType(); - Assert.assertEquals(dpdkIfType, opPort); + assertEquals(dpdkIfType, ovsdbTerminationPointAugmentation.getInterfaceType()); } } } @@ -718,21 +715,21 @@ public class SouthboundIT extends AbstractMdsalTestBase { @Test public void testOvsdbNodeOvsVersion() throws InterruptedException { OvsdbNodeAugmentation ovsdbNodeAugmentation = ovsdbNode.augmentation(OvsdbNodeAugmentation.class); - Assert.assertNotNull(ovsdbNodeAugmentation); + assertNotNull(ovsdbNodeAugmentation); assertNotNull(ovsdbNodeAugmentation.getOvsVersion()); } @Test public void testOvsdbNodeDbVersion() throws InterruptedException { OvsdbNodeAugmentation ovsdbNodeAugmentation = ovsdbNode.augmentation(OvsdbNodeAugmentation.class); - Assert.assertNotNull(ovsdbNodeAugmentation); + assertNotNull(ovsdbNodeAugmentation); assertNotNull(ovsdbNodeAugmentation.getDbVersion()); } @Test public void testOpenVSwitchOtherConfig() throws InterruptedException { OvsdbNodeAugmentation ovsdbNodeAugmentation = ovsdbNode.augmentation(OvsdbNodeAugmentation.class); - Assert.assertNotNull(ovsdbNodeAugmentation); + assertNotNull(ovsdbNodeAugmentation); Map otherConfigsList = ovsdbNodeAugmentation.getOpenvswitchOtherConfigs(); if (otherConfigsList != null) { @@ -754,37 +751,34 @@ public class SouthboundIT extends AbstractMdsalTestBase { ConnectionInfo connectionInfo = getConnectionInfo(addressStr,portNumber); String controllerTarget = SouthboundUtil.getControllerTarget(ovsdbNode); assertNotNull("Failed to get controller target", controllerTarget); - List setControllerEntry = createControllerEntry(controllerTarget); + ControllerEntry setControllerEntry = createControllerEntry(controllerTarget); Uri setUri = new Uri(controllerTarget); try (TestBridge testBridge = new TestBridge(connectionInfo, null, SouthboundITConstants.BRIDGE_NAME,null, true, SouthboundConstants.OVSDB_FAIL_MODE_MAP.inverse().get("secure"), true, null, null, - setControllerEntry, null)) { + BindingMap.of(setControllerEntry), null)) { OvsdbBridgeAugmentation bridge = getBridge(connectionInfo); - Assert.assertNotNull("bridge was not found: " + SouthboundITConstants.BRIDGE_NAME, bridge); - Assert.assertNotNull("ControllerEntry was not found: " + setControllerEntry.iterator().next(), - bridge.getControllerEntry()); + assertNotNull("bridge was not found: " + SouthboundITConstants.BRIDGE_NAME, bridge); + assertNotNull("ControllerEntry was not found: " + setControllerEntry, bridge.getControllerEntry()); for (ControllerEntry entry : bridge.getControllerEntry().values()) { if (entry.getTarget() != null) { - Assert.assertEquals(setUri.toString(), entry.getTarget().toString()); + assertEquals(setUri.toString(), entry.getTarget().toString()); } if (entry.getMaxBackoff() != null) { - Assert.assertEquals(entry.getMaxBackoff(), MAX_BACKOFF); + assertEquals(MAX_BACKOFF, entry.getMaxBackoff()); } if (entry.getInactivityProbe() != null) { - Assert.assertEquals(entry.getInactivityProbe(),INACTIVITY_PROBE); + assertEquals(INACTIVITY_PROBE, entry.getInactivityProbe()); } } } } - private List createControllerEntry(String controllerTarget) { - List controllerEntriesList = new ArrayList<>(); - controllerEntriesList.add(new ControllerEntryBuilder() + private static @NonNull ControllerEntry createControllerEntry(final String controllerTarget) { + return new ControllerEntryBuilder() .setTarget(new Uri(controllerTarget)) .setMaxBackoff(MAX_BACKOFF) .setInactivityProbe(INACTIVITY_PROBE) - .build()); - return controllerEntriesList; + .build(); } private static void setManagedBy(final OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder, @@ -793,15 +787,13 @@ public class SouthboundIT extends AbstractMdsalTestBase { ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath)); } - private static List createMdsalProtocols() { - List protocolList = new ArrayList<>(); + private static Map createMdsalProtocols() { ImmutableBiMap> mapper = SouthboundConstants.OVSDB_PROTOCOL_MAP.inverse(); - protocolList.add(new ProtocolEntryBuilder().setProtocol(mapper.get("OpenFlow13")).build()); - return protocolList; + return BindingMap.of(new ProtocolEntryBuilder().setProtocol(mapper.get("OpenFlow13")).build()); } - private OvsdbTerminationPointAugmentationBuilder createGenericOvsdbTerminationPointAugmentationBuilder() { + private static OvsdbTerminationPointAugmentationBuilder createGenericOvsdbTerminationPointAugmentationBuilder() { OvsdbTerminationPointAugmentationBuilder ovsdbTerminationPointAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder(); ovsdbTerminationPointAugmentationBuilder.setInterfaceType( @@ -812,7 +804,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { return ovsdbTerminationPointAugmentationBuilder; } - private OvsdbTerminationPointAugmentationBuilder createGenericDpdkOvsdbTerminationPointAugmentationBuilder( + private static OvsdbTerminationPointAugmentationBuilder createGenericDpdkOvsdbTerminationPointAugmentationBuilder( final String portName) { OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder = createGenericOvsdbTerminationPointAugmentationBuilder(); @@ -823,32 +815,27 @@ public class SouthboundIT extends AbstractMdsalTestBase { return ovsdbTerminationBuilder; } - private OvsdbTerminationPointAugmentationBuilder createSpecificDpdkOvsdbTerminationPointAugmentationBuilder( - String testPortname,Class dpdkIfType) { - OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder = - createGenericOvsdbTerminationPointAugmentationBuilder(); - ovsdbTerminationBuilder.setName(testPortname); - ovsdbTerminationBuilder.setInterfaceType(dpdkIfType); - return ovsdbTerminationBuilder; + private static OvsdbTerminationPointAugmentationBuilder createSpecificDpdkOvsdbTerminationPointAugmentationBuilder( + final String testPortname, final Class dpdkIfType) { + return createGenericOvsdbTerminationPointAugmentationBuilder() + .setName(testPortname) + .setInterfaceType(dpdkIfType); } - private boolean addTerminationPoint(final NodeId bridgeNodeId, final String portName, - final OvsdbTerminationPointAugmentationBuilder - ovsdbTerminationPointAugmentationBuilder) + private static boolean addTerminationPoint(final NodeId bridgeNodeId, final String portName, + final OvsdbTerminationPointAugmentationBuilder + ovsdbTerminationPointAugmentationBuilder) throws InterruptedException { InstanceIdentifier portIid = SouthboundMapper.createInstanceIdentifier(bridgeNodeId); NodeBuilder portNodeBuilder = new NodeBuilder(); NodeId portNodeId = SouthboundMapper.createManagedNodeId(portIid); portNodeBuilder.setNodeId(portNodeId); - TerminationPointBuilder entry = new TerminationPointBuilder(); - entry.withKey(new TerminationPointKey(new TpId(portName))); - entry.addAugmentation( - OvsdbTerminationPointAugmentation.class, - ovsdbTerminationPointAugmentationBuilder.build()); - portNodeBuilder.setTerminationPoint(Collections.singletonList(entry.build())); - boolean result = mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, - portIid, portNodeBuilder.build()); + TerminationPointBuilder entry = new TerminationPointBuilder() + .withKey(new TerminationPointKey(new TpId(portName))) + .addAugmentation(ovsdbTerminationPointAugmentationBuilder.build()); + portNodeBuilder.setTerminationPoint(BindingMap.of(entry.build())); + boolean result = mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, portIid, portNodeBuilder.build()); Thread.sleep(OVSDB_UPDATE_TIMEOUT); return result; } @@ -875,9 +862,9 @@ public class SouthboundIT extends AbstractMdsalTestBase { final String bridgeName, NodeId bridgeNodeId, final boolean setProtocolEntries, final Class failMode, final boolean setManagedBy, @Nullable final Class dpType, - @Nullable final List externalIds, - @Nullable final List controllerEntries, - @Nullable final List otherConfigs) { + @Nullable final Map externalIds, + @Nullable final Map controllerEntries, + @Nullable final Map otherConfigs) { this.connectionInfo = connectionInfo; this.bridgeName = bridgeName; NodeBuilder bridgeNodeBuilder = new NodeBuilder(); @@ -901,10 +888,9 @@ public class SouthboundIT extends AbstractMdsalTestBase { ovsdbBridgeAugmentationBuilder.setBridgeExternalIds(externalIds); ovsdbBridgeAugmentationBuilder.setControllerEntry(controllerEntries); ovsdbBridgeAugmentationBuilder.setBridgeOtherConfigs(otherConfigs); - bridgeNodeBuilder.addAugmentation(OvsdbBridgeAugmentation.class, ovsdbBridgeAugmentationBuilder.build()); + bridgeNodeBuilder.addAugmentation(ovsdbBridgeAugmentationBuilder.build()); LOG.debug("Built with the intent to store bridge data {}", ovsdbBridgeAugmentationBuilder); - Assert.assertTrue( - mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, bridgeIid, bridgeNodeBuilder.build())); + assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, bridgeIid, bridgeNodeBuilder.build())); try { Thread.sleep(OVSDB_UPDATE_TIMEOUT); } catch (InterruptedException e) { @@ -921,7 +907,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { public void close() { final InstanceIdentifier iid = SouthboundUtils.createInstanceIdentifier(connectionInfo, new OvsdbBridgeName(bridgeName)); - Assert.assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, iid)); + assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, iid)); try { Thread.sleep(OVSDB_UPDATE_TIMEOUT); } catch (InterruptedException e) { @@ -940,8 +926,8 @@ public class SouthboundIT extends AbstractMdsalTestBase { final Uri bridgeId, @Nullable final String systemName, @Nullable final String systemDescription, - @Nullable final List mappings, - @Nullable final List externalIds) { + @Nullable final Map mappings, + @Nullable final Map externalIds) { this.connectionInfo = connectionInfo; this.autoattachId = autoattachId; this.bridgeId = bridgeId; @@ -961,7 +947,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { new NotifyingDataChangeListener(LogicalDatastoreType.OPERATIONAL, iid); aaOperationalListener.registerDataChangeListener(); - Assert.assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, iid, aaEntry)); + assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, iid, aaEntry)); try { aaOperationalListener.waitForCreation(OVSDB_ROUNDTRIP_TIMEOUT); } catch (InterruptedException e) { @@ -978,7 +964,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { new NotifyingDataChangeListener(LogicalDatastoreType.OPERATIONAL, iid); aaOperationalListener.registerDataChangeListener(); - Assert.assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, iid)); + assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, iid)); try { aaOperationalListener.waitForDeletion(OVSDB_ROUNDTRIP_TIMEOUT); } catch (InterruptedException e) { @@ -1000,7 +986,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { try (TestBridge testBridge = new TestBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME)) { OvsdbBridgeAugmentation bridge = getBridge(connectionInfo); - Assert.assertNotNull(bridge); + assertNotNull(bridge); // CREATE: Create Autoattach table NodeId nodeId = SouthboundUtils.createManagedNodeId(SouthboundUtils.createInstanceIdentifier( @@ -1015,20 +1001,22 @@ public class SouthboundIT extends AbstractMdsalTestBase { Autoattach operAa = getAutoAttach(ovsdbNodeAugmentation, new Uri(testAutoattachId)); // skip tests after verifying that Autoattach doesn't break with unsupported schema - Assume.assumeFalse(isOldSchema); + assumeFalse(isOldSchema); // FIXME: Remove once CRUD is supported - Assume.assumeFalse(operAa == null); + assumeFalse(operAa == null); - Assert.assertNotNull(operAa); - Assert.assertEquals(testSystemName, operAa.getSystemName()); + assertNotNull(operAa); + assertEquals(testSystemName, operAa.getSystemName()); bridge = getBridge(connectionInfo); Uuid aaUuid = new Uuid(operAa.getAutoattachUuid().getValue()); - Assert.assertEquals(aaUuid, bridge.getAutoAttach()); + assertEquals(aaUuid, bridge.getAutoAttach()); // UPDATE: Update mappings column of AutoAttach table that was created - List mappings = ImmutableList.of(new MappingsBuilder().setMappingsKey(100L) - .setMappingsValue(200).build()); + Map mappings = BindingMap.of(new MappingsBuilder() + .setMappingsKey(Uint32.valueOf(100)) + .setMappingsValue(Uint16.valueOf(200)) + .build()); Autoattach updatedAa = new AutoattachBuilder() .setAutoattachId(new Uri(testAutoattachId)) .setMappings(mappings) @@ -1039,61 +1027,59 @@ public class SouthboundIT extends AbstractMdsalTestBase { final NotifyingDataChangeListener aaOperationalListener = new NotifyingDataChangeListener(LogicalDatastoreType.OPERATIONAL, iid); aaOperationalListener.registerDataChangeListener(); - Assert.assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, iid, updatedAa)); + assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, iid, updatedAa)); aaOperationalListener.waitForUpdate(OVSDB_UPDATE_TIMEOUT); // UPDATE: Update external_ids column of AutoAttach table that was created - List externalIds = new ArrayList<>(); + BindingMap.Builder externalIds = BindingMap.builder(); externalIds.add(new AutoattachExternalIdsBuilder() .setAutoattachExternalIdKey(testAutoattachExternalKey) .setAutoattachExternalIdValue(testAutoattachExternalValue) .build()); updatedAa = new AutoattachBuilder() .setAutoattachId(new Uri(testAutoattachId)) - .setAutoattachExternalIds(externalIds) + .setAutoattachExternalIds(externalIds.build()) .build(); - Assert.assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, iid, updatedAa)); + assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, iid, updatedAa)); aaOperationalListener.waitForUpdate(OVSDB_UPDATE_TIMEOUT); // READ: Read the updated AutoAttach table for latest mappings and external_ids column value ovsdbNodeAugmentation = getOvsdbNode(connectionInfo, LogicalDatastoreType.OPERATIONAL); operAa = getAutoAttach(ovsdbNodeAugmentation, new Uri(testAutoattachId)); - Assert.assertNotNull(operAa); + assertNotNull(operAa); Map operMappingsList = operAa.getMappings(); for (Mappings operMappings : operMappingsList.values()) { - Assert.assertTrue(mappings.contains(operMappings)); + assertTrue(mappings.containsValue(operMappings)); } Map operExternalIds = operAa.getAutoattachExternalIds(); - externalIds.add(new AutoattachExternalIdsBuilder() - .setAutoattachExternalIdKey(SouthboundConstants.AUTOATTACH_ID_EXTERNAL_ID_KEY) - .setAutoattachExternalIdValue(operAa.getAutoattachId().getValue()) - .build()); + final Collection ids = externalIds.add(new AutoattachExternalIdsBuilder() + .setAutoattachExternalIdKey(SouthboundConstants.AUTOATTACH_ID_EXTERNAL_ID_KEY) + .setAutoattachExternalIdValue(operAa.getAutoattachId().getValue()) + .build()) + .build().values(); + for (AutoattachExternalIds operExternalId : operExternalIds.values()) { - Assert.assertTrue(externalIds.contains(operExternalId)); + assertTrue(ids.contains(operExternalId)); } // DELETE: Delete AutoAttach table - Assert.assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, iid)); + assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, iid)); aaOperationalListener.waitForUpdate(OVSDB_UPDATE_TIMEOUT); - ovsdbNodeAugmentation = getOvsdbNode(connectionInfo, - LogicalDatastoreType.OPERATIONAL); + ovsdbNodeAugmentation = getOvsdbNode(connectionInfo, LogicalDatastoreType.OPERATIONAL); operAa = getAutoAttach(ovsdbNodeAugmentation, new Uri(testAutoattachId)); - Assert.assertNull(operAa); + assertNull(operAa); } catch (AssumptionViolatedException e) { LOG.warn("Skipped test for Autoattach due to unsupported schema", e); } } } - private static Autoattach getAutoAttach(OvsdbNodeAugmentation ovsdbNodeAugmentation, Uri uri) { - if (ovsdbNodeAugmentation.getAutoattach() != null - && !ovsdbNodeAugmentation.getAutoattach().isEmpty()) { - for (Autoattach aa : ovsdbNodeAugmentation.getAutoattach().values()) { - if (aa.key().getAutoattachId().equals(uri)) { - return aa; - } + private static Autoattach getAutoAttach(final OvsdbNodeAugmentation ovsdbNodeAugmentation, final Uri uri) { + for (Autoattach aa : ovsdbNodeAugmentation.nonnullAutoattach().values()) { + if (aa.key().getAutoattachId().equals(uri)) { + return aa; } } return null; @@ -1115,8 +1101,8 @@ public class SouthboundIT extends AbstractMdsalTestBase { TestQos(final ConnectionInfo connectionInfo, final Uri qosId, final Class qosType, - @Nullable final List externalIds, - @Nullable final List otherConfigs) { + final @Nullable Map externalIds, + final @Nullable Map otherConfigs) { this.connectionInfo = connectionInfo; this.qosId = qosId; @@ -1133,9 +1119,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { new NotifyingDataChangeListener(LogicalDatastoreType.OPERATIONAL, qeIid); qosOperationalListener.registerDataChangeListener(); - Assert.assertTrue( - mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, - qeIid, qosEntry)); + assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, qeIid, qosEntry)); try { qosOperationalListener.waitForCreation(OVSDB_ROUNDTRIP_TIMEOUT); @@ -1154,7 +1138,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { new NotifyingDataChangeListener(LogicalDatastoreType.OPERATIONAL, qeIid); qosOperationalListener.registerDataChangeListener(); - Assert.assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, qeIid)); + assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, qeIid)); try { qosOperationalListener.waitForDeletion(OVSDB_ROUNDTRIP_TIMEOUT); } catch (InterruptedException e) { @@ -1177,11 +1161,9 @@ public class SouthboundIT extends AbstractMdsalTestBase { * @param externalIds The external identifiers if any. * @param otherConfigs The other configuration items if any. */ - TestQueue(final ConnectionInfo connectionInfo, - final Uri queueId, - final Short queueDscp, - @Nullable final List externalIds, - @Nullable final List otherConfigs) { + TestQueue(final ConnectionInfo connectionInfo, final Uri queueId, final Uint8 queueDscp, + final @Nullable Map externalIds, + final @Nullable Map otherConfigs) { this.connectionInfo = connectionInfo; this.queueId = queueId; @@ -1198,9 +1180,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { new NotifyingDataChangeListener(LogicalDatastoreType.OPERATIONAL, queueIid); queueOperationalListener.registerDataChangeListener(); - Assert.assertTrue( - mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, - queueIid, queue)); + assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, queueIid, queue)); try { queueOperationalListener.waitForCreation(OVSDB_ROUNDTRIP_TIMEOUT); @@ -1222,7 +1202,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { new NotifyingDataChangeListener(LogicalDatastoreType.OPERATIONAL, queuesIid); queueOperationalListener.registerDataChangeListener(); - Assert.assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, queuesIid)); + assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, queuesIid)); try { queueOperationalListener.waitForDeletion(OVSDB_ROUNDTRIP_TIMEOUT); } catch (InterruptedException e) { @@ -1231,16 +1211,17 @@ public class SouthboundIT extends AbstractMdsalTestBase { } } - private OvsdbNodeAugmentation getOvsdbNode(ConnectionInfo connectionInfo, LogicalDatastoreType store) { + private static OvsdbNodeAugmentation getOvsdbNode(final ConnectionInfo connectionInfo, + final LogicalDatastoreType store) { InstanceIdentifier nodeIid = SouthboundUtils.createInstanceIdentifier(connectionInfo); Node node = mdsalUtils.read(store, nodeIid); - Assert.assertNotNull(node); + assertNotNull(node); OvsdbNodeAugmentation ovsdbNodeAugmentation = node.augmentation(OvsdbNodeAugmentation.class); - Assert.assertNotNull(ovsdbNodeAugmentation); + assertNotNull(ovsdbNodeAugmentation); return ovsdbNodeAugmentation; } - private OvsdbBridgeAugmentation getBridge(ConnectionInfo connectionInfo) { + private static OvsdbBridgeAugmentation getBridge(final ConnectionInfo connectionInfo) { return getBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME); } @@ -1253,12 +1234,12 @@ public class SouthboundIT extends AbstractMdsalTestBase { * @param store defined by the LogicalDatastoreType enumeration * @return store type data store contents */ - private OvsdbBridgeAugmentation getBridge(ConnectionInfo connectionInfo, String bridgeName, - LogicalDatastoreType store) { + private static OvsdbBridgeAugmentation getBridge(final ConnectionInfo connectionInfo, final String bridgeName, + final LogicalDatastoreType store) { Node bridgeNode = getBridgeNode(connectionInfo, bridgeName, store); - Assert.assertNotNull(bridgeNode); + assertNotNull(bridgeNode); OvsdbBridgeAugmentation ovsdbBridgeAugmentation = bridgeNode.augmentation(OvsdbBridgeAugmentation.class); - Assert.assertNotNull(ovsdbBridgeAugmentation); + assertNotNull(ovsdbBridgeAugmentation); return ovsdbBridgeAugmentation; } @@ -1271,7 +1252,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { * @see SouthboundIT#getBridge(ConnectionInfo, String, LogicalDatastoreType) * @return LogicalDatastoreType.OPERATIONAL type data store contents */ - private OvsdbBridgeAugmentation getBridge(ConnectionInfo connectionInfo, String bridgeName) { + private static OvsdbBridgeAugmentation getBridge(final ConnectionInfo connectionInfo, final String bridgeName) { return getBridge(connectionInfo, bridgeName, LogicalDatastoreType.OPERATIONAL); } @@ -1284,7 +1265,8 @@ public class SouthboundIT extends AbstractMdsalTestBase { * @param store defined by the LogicalDatastoreType enumeration * @return store type data store contents */ - private Node getBridgeNode(ConnectionInfo connectionInfo, String bridgeName, LogicalDatastoreType store) { + private static Node getBridgeNode(final ConnectionInfo connectionInfo, final String bridgeName, + final LogicalDatastoreType store) { InstanceIdentifier bridgeIid = SouthboundUtils.createInstanceIdentifier(connectionInfo, new OvsdbBridgeName(bridgeName)); return mdsalUtils.read(store, bridgeIid); @@ -1298,7 +1280,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { * @param bridgeName the bridge name * @return LogicalDatastoreType.OPERATIONAL type data store contents */ - private Node getBridgeNode(ConnectionInfo connectionInfo, String bridgeName) { + private static Node getBridgeNode(final ConnectionInfo connectionInfo, final String bridgeName) { return getBridgeNode(connectionInfo, bridgeName, LogicalDatastoreType.OPERATIONAL); } @@ -1308,12 +1290,13 @@ public class SouthboundIT extends AbstractMdsalTestBase { try (TestBridge testBridge = new TestBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME)) { OvsdbBridgeAugmentation bridge = getBridge(connectionInfo); - Assert.assertNotNull(bridge); + assertNotNull(bridge); LOG.info("bridge: {}", bridge); } } - private static InstanceIdentifier getTpIid(ConnectionInfo connectionInfo, OvsdbBridgeAugmentation bridge) { + private static InstanceIdentifier getTpIid(final ConnectionInfo connectionInfo, + final OvsdbBridgeAugmentation bridge) { return SouthboundUtils.createInstanceIdentifier(connectionInfo, bridge.getBridgeName()); } @@ -1327,11 +1310,12 @@ public class SouthboundIT extends AbstractMdsalTestBase { * @param index the index we're interested in * @return the augmentation (or {@code null} if none) */ - private OvsdbTerminationPointAugmentation getOvsdbTerminationPointAugmentation( - ConnectionInfo connectionInfo, String bridgeName, LogicalDatastoreType store, int index) { + private static OvsdbTerminationPointAugmentation getOvsdbTerminationPointAugmentation( + final ConnectionInfo connectionInfo, final String bridgeName, final LogicalDatastoreType store, + final int index) { Map tpList = getBridgeNode(connectionInfo, bridgeName, store) - .nonnullTerminationPoint(); + .getTerminationPoint(); if (tpList == null) { return null; } @@ -1341,7 +1325,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { @Test public void testCRUDTerminationPointIfIndex() throws InterruptedException { final boolean isOldSchema = schemaVersion.compareTo(IF_INDEX_FROM_VERSION) < 0; - Assume.assumeFalse(isOldSchema); + assumeFalse(isOldSchema); ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portNumber); // Test create ifIndex @@ -1349,7 +1333,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { SouthboundConstants.OVSDB_FAIL_MODE_MAP.inverse().get("secure"), true, SouthboundMapper.createDatapathType("netdev"), null, null, null)) { OvsdbBridgeAugmentation bridge = getBridge(connectionInfo); - Assert.assertNotNull(bridge); + assertNotNull(bridge); LOG.info("bridge: {}", bridge); NodeId nodeId = SouthboundMapper.createManagedNodeId(SouthboundUtils.createInstanceIdentifier( connectionInfo, bridge.getBridgeName())); @@ -1358,10 +1342,10 @@ public class SouthboundIT extends AbstractMdsalTestBase { String portName = "testIfIndex"; ovsdbTerminationBuilder.setName(portName); - Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); + assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); InstanceIdentifier terminationPointIid = getTpIid(connectionInfo, bridge); Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid); - Assert.assertNotNull(terminationPointNode); + assertNotNull(terminationPointNode); // Test read ifIndex for (TerminationPoint terminationPoint : terminationPointNode.nonnullTerminationPoint().values()) { @@ -1369,7 +1353,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { terminationPoint.augmentation(OvsdbTerminationPointAugmentation.class); if (ovsdbTerminationPointAugmentation.getName().equals(portName)) { Long ifIndex = ovsdbTerminationPointAugmentation.getIfindex().toJava(); - Assert.assertNotNull(ifIndex); + assertNotNull(ifIndex); LOG.info("ifIndex: {} for the port:{}", ifIndex, portName); } } @@ -1378,14 +1362,14 @@ public class SouthboundIT extends AbstractMdsalTestBase { @Test public void testCRDTerminationPointOfPort() throws InterruptedException { - final Long ofportExpected = 45002L; + final Uint32 ofportExpected = Uint32.valueOf(45002); ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portNumber); // CREATE try (TestBridge testBridge = new TestBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME)) { OvsdbBridgeAugmentation bridge = getBridge(connectionInfo); - Assert.assertNotNull(bridge); + assertNotNull(bridge); LOG.info("bridge: {}", bridge); NodeId nodeId = SouthboundMapper.createManagedNodeId(SouthboundUtils.createInstanceIdentifier( connectionInfo, bridge.getBridgeName())); @@ -1395,19 +1379,19 @@ public class SouthboundIT extends AbstractMdsalTestBase { ovsdbTerminationBuilder.setName(portName); ovsdbTerminationBuilder.setOfport(ofportExpected); - Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); + assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); InstanceIdentifier terminationPointIid = getTpIid(connectionInfo, bridge); Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid); - Assert.assertNotNull(terminationPointNode); + assertNotNull(terminationPointNode); // READ for (TerminationPoint terminationPoint : terminationPointNode.nonnullTerminationPoint().values()) { OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = terminationPoint.augmentation(OvsdbTerminationPointAugmentation.class); if (ovsdbTerminationPointAugmentation.getName().equals(portName)) { - Long ofPort = ovsdbTerminationPointAugmentation.getOfport().toJava(); + Uint32 ofPort = ovsdbTerminationPointAugmentation.getOfport(); // if ephemeral port 45002 is in use, ofPort is set to 1 - Assert.assertTrue(ofPort.equals(ofportExpected) || ofPort.equals(1L)); + assertTrue(ofPort.equals(ofportExpected) || ofPort.equals(Uint32.ONE)); LOG.info("ofPort: {}", ofPort); } } @@ -1422,41 +1406,41 @@ public class SouthboundIT extends AbstractMdsalTestBase { @Test public void testCRDTerminationPointOfPortRequest() throws InterruptedException { - final Long ofportExpected = 45008L; - final Long ofportInput = 45008L; + final Uint32 ofportExpected = Uint32.valueOf(45008); + final Uint32 ofportInput = Uint32.valueOf(45008); ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portNumber); // CREATE try (TestBridge testBridge = new TestBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME)) { OvsdbBridgeAugmentation bridge = getBridge(connectionInfo); - Assert.assertNotNull(bridge); + assertNotNull(bridge); final NodeId nodeId = SouthboundUtils.createManagedNodeId(SouthboundUtils.createInstanceIdentifier( connectionInfo, bridge.getBridgeName())); OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder = createGenericOvsdbTerminationPointAugmentationBuilder(); String portName = "testOfPortRequest"; ovsdbTerminationBuilder.setName(portName); - Integer ofPortRequestExpected = ofportExpected.intValue(); + Uint16 ofPortRequestExpected = ofportExpected.toUint16(); ovsdbTerminationBuilder.setOfport(ofportInput); ovsdbTerminationBuilder.setOfportRequest(ofPortRequestExpected); - Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); + assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); InstanceIdentifier terminationPointIid = getTpIid(connectionInfo, bridge); Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid); - Assert.assertNotNull(terminationPointNode); + assertNotNull(terminationPointNode); // READ for (TerminationPoint terminationPoint : terminationPointNode.nonnullTerminationPoint().values()) { OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = terminationPoint.augmentation(OvsdbTerminationPointAugmentation.class); if (ovsdbTerminationPointAugmentation.getName().equals(portName)) { - Long ofPort = ovsdbTerminationPointAugmentation.getOfport().toJava(); + Uint32 ofPort = ovsdbTerminationPointAugmentation.getOfport(); // if ephemeral port 45008 is in use, ofPort is set to 1 - Assert.assertTrue(ofPort.equals(ofportExpected) || ofPort.equals(1L)); + assertTrue(ofPort.equals(ofportExpected) || ofPort.equals(Uint32.ONE)); LOG.info("ofPort: {}", ofPort); - Integer ofPortRequest = ovsdbTerminationPointAugmentation.getOfportRequest().toJava(); - Assert.assertTrue(ofPortRequest.equals(ofPortRequestExpected)); + Uint16 ofPortRequest = ovsdbTerminationPointAugmentation.getOfportRequest(); + assertEquals(ofPortRequestExpected, ofPortRequest); LOG.info("ofPortRequest: {}", ofPortRequest); } } @@ -1469,17 +1453,17 @@ public class SouthboundIT extends AbstractMdsalTestBase { } } - private static , T extends Identifiable> void assertExpectedExist(Map expected, - Map test) { + private static , T extends Identifiable> void assertExpectedExist( + final Map expected, final Map test) { if (expected != null && test != null) { for (T exp : expected.values()) { - Assert.assertTrue("The retrieved values don't contain " + exp, test.containsValue(exp)); + assertTrue("The retrieved values don't contain " + exp, test.containsValue(exp)); } } } private interface SouthboundTerminationPointHelper, T extends Identifiable> { - void writeValues(OvsdbTerminationPointAugmentationBuilder builder, List values); + void writeValues(OvsdbTerminationPointAugmentationBuilder builder, Map values); Map readValues(OvsdbTerminationPointAugmentation augmentation); } @@ -1489,8 +1473,8 @@ public class SouthboundIT extends AbstractMdsalTestBase { * * @see SouthboundIT.generatePortExternalIdsTestCases() for specific test case information */ - private , T extends Identifiable> void testCRUDTerminationPoint( - KeyValueBuilder builder, String prefix, SouthboundTerminationPointHelper helper) + private static , T extends Identifiable> void testCRUDTerminationPoint( + final KeyValueBuilder builder, final String prefix, final SouthboundTerminationPointHelper helper) throws InterruptedException { final int terminationPointTestIndex = 0; @@ -1516,7 +1500,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { createGenericOvsdbTerminationPointAugmentationBuilder(); tpCreateAugmentationBuilder.setName(testBridgeAndPortName); helper.writeValues(tpCreateAugmentationBuilder, updateFromTestCase.inputValues); - Assert.assertTrue( + assertTrue( addTerminationPoint(testBridgeNodeId, testBridgeAndPortName, tpCreateAugmentationBuilder)); // READ: Read the test port and ensure changes are propagated to the CONFIGURATION data store, @@ -1549,11 +1533,9 @@ public class SouthboundIT extends AbstractMdsalTestBase { portUpdateNodeBuilder.setNodeId(portUpdateNodeId); TerminationPointBuilder tpUpdateBuilder = new TerminationPointBuilder(); tpUpdateBuilder.withKey(new TerminationPointKey(new TpId(testBridgeAndPortName))); - tpUpdateBuilder.addAugmentation( - OvsdbTerminationPointAugmentation.class, - tpUpdateAugmentationBuilder.build()); - portUpdateNodeBuilder.setTerminationPoint(Collections.singletonList(tpUpdateBuilder.build())); - Assert.assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, + tpUpdateBuilder.addAugmentation(tpUpdateAugmentationBuilder.build()); + portUpdateNodeBuilder.setTerminationPoint(BindingMap.of(tpUpdateBuilder.build())); + assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, portIid, portUpdateNodeBuilder.build())); Thread.sleep(OVSDB_UPDATE_TIMEOUT); @@ -1659,7 +1641,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { try (TestBridge testBridge = new TestBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME)) { OvsdbBridgeAugmentation bridge = getBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME); - Assert.assertNotNull(bridge); + assertNotNull(bridge); NodeId nodeId = SouthboundUtils.createManagedNodeId(SouthboundUtils.createInstanceIdentifier( connectionInfo, bridge.getBridgeName())); OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder = @@ -1668,10 +1650,10 @@ public class SouthboundIT extends AbstractMdsalTestBase { // add and delete a single port String portName = port1; ovsdbTerminationBuilder.setName(portName); - Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); + assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); InstanceIdentifier terminationPointIid = getTpIid(connectionInfo, bridge); Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid); - Assert.assertNotNull(terminationPointNode); + assertNotNull(terminationPointNode); SouthboundUtils.createInstanceIdentifier(connectionInfo, new OvsdbBridgeName(SouthboundITConstants.BRIDGE_NAME)); @@ -1681,27 +1663,27 @@ public class SouthboundIT extends AbstractMdsalTestBase { new OvsdbBridgeName(SouthboundITConstants.BRIDGE_NAME)) .child(TerminationPoint.class, new TerminationPointKey(new TpId(portName))); - Assert.assertTrue("failed to delete port " + portName, + assertTrue("failed to delete port " + portName, mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, nodePath)); LOG.info("shague: waiting for delete {}", portName); Thread.sleep(1000); TerminationPoint terminationPoint = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, nodePath); - Assert.assertNull(terminationPoint); + assertNull(terminationPoint); // add two ports, then delete them portName = port1; ovsdbTerminationBuilder.setName(portName); - Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); + assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); terminationPointIid = getTpIid(connectionInfo, bridge); terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid); - Assert.assertNotNull(terminationPointNode); + assertNotNull(terminationPointNode); portName = port2; ovsdbTerminationBuilder.setName(portName); - Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); + assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); terminationPointIid = getTpIid(connectionInfo, bridge); terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid); - Assert.assertNotNull(terminationPointNode); + assertNotNull(terminationPointNode); SouthboundUtils.createInstanceIdentifier(connectionInfo, new OvsdbBridgeName(SouthboundITConstants.BRIDGE_NAME)); @@ -1711,24 +1693,24 @@ public class SouthboundIT extends AbstractMdsalTestBase { new OvsdbBridgeName(SouthboundITConstants.BRIDGE_NAME)) .child(TerminationPoint.class, new TerminationPointKey(new TpId(portName))); - Assert.assertTrue("failed to delete port " + portName, + assertTrue("failed to delete port " + portName, mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, nodePath)); LOG.info("shague: waiting for delete {}", portName); Thread.sleep(1000); terminationPoint = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, nodePath); - Assert.assertNull(terminationPoint); + assertNull(terminationPoint); portName = port2; nodePath = SouthboundUtils.createInstanceIdentifier(connectionInfo, new OvsdbBridgeName(SouthboundITConstants.BRIDGE_NAME)) .child(TerminationPoint.class, new TerminationPointKey(new TpId(portName))); - Assert.assertTrue("failed to delete port " + portName, + assertTrue("failed to delete port " + portName, mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, nodePath)); LOG.info("shague: waiting for delete {}", portName); Thread.sleep(1000); terminationPoint = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, nodePath); - Assert.assertNull(terminationPoint); + assertNull(terminationPoint); // DELETE handled by TestBridge } @@ -1736,15 +1718,15 @@ public class SouthboundIT extends AbstractMdsalTestBase { @Test public void testCRUDTerminationPointVlan() throws InterruptedException { - final Integer createdVlanId = 4000; - final Integer updatedVlanId = 4001; + final Uint16 createdVlanId = Uint16.valueOf(4000); + final Uint16 updatedVlanId = Uint16.valueOf(4001); ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portNumber); // CREATE try (TestBridge testBridge = new TestBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME)) { OvsdbBridgeAugmentation bridge = getBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME); - Assert.assertNotNull(bridge); + assertNotNull(bridge); NodeId nodeId = SouthboundUtils.createManagedNodeId(SouthboundUtils.createInstanceIdentifier( connectionInfo, bridge.getBridgeName())); OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder = @@ -1752,10 +1734,10 @@ public class SouthboundIT extends AbstractMdsalTestBase { String portName = "testTerminationPointVlanId"; ovsdbTerminationBuilder.setName(portName); ovsdbTerminationBuilder.setVlanTag(new VlanId(createdVlanId)); - Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); + assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); InstanceIdentifier terminationPointIid = getTpIid(connectionInfo, bridge); Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid); - Assert.assertNotNull(terminationPointNode); + assertNotNull(terminationPointNode); // READ OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation; @@ -1764,9 +1746,8 @@ public class SouthboundIT extends AbstractMdsalTestBase { OvsdbTerminationPointAugmentation.class); if (ovsdbTerminationPointAugmentation.getName().equals(portName)) { VlanId actualVlanId = ovsdbTerminationPointAugmentation.getVlanTag(); - Assert.assertNotNull(actualVlanId); - Integer actualVlanIdInt = actualVlanId.getValue().toJava(); - Assert.assertEquals(createdVlanId, actualVlanIdInt); + assertNotNull(actualVlanId); + assertEquals(createdVlanId, actualVlanId.getValue()); } } @@ -1781,12 +1762,10 @@ public class SouthboundIT extends AbstractMdsalTestBase { portUpdateNodeBuilder.setNodeId(portUpdateNodeId); TerminationPointBuilder tpUpdateBuilder = new TerminationPointBuilder(); tpUpdateBuilder.withKey(new TerminationPointKey(new TpId(portName))); - tpUpdateBuilder.addAugmentation( - OvsdbTerminationPointAugmentation.class, - tpUpdateAugmentationBuilder.build()); + tpUpdateBuilder.addAugmentation(tpUpdateAugmentationBuilder.build()); tpUpdateBuilder.setTpId(new TpId(portName)); - portUpdateNodeBuilder.setTerminationPoint(Collections.singletonList(tpUpdateBuilder.build())); - Assert.assertTrue( + portUpdateNodeBuilder.setTerminationPoint(BindingMap.of(tpUpdateBuilder.build())); + assertTrue( mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, portIid, portUpdateNodeBuilder.build())); Thread.sleep(OVSDB_UPDATE_TIMEOUT); @@ -1796,9 +1775,8 @@ public class SouthboundIT extends AbstractMdsalTestBase { OvsdbTerminationPointAugmentation.class); if (ovsdbTerminationPointAugmentation.getName().equals(portName)) { VlanId actualVlanId = ovsdbTerminationPointAugmentation.getVlanTag(); - Assert.assertNotNull(actualVlanId); - Integer actualVlanIdInt = actualVlanId.getValue().toJava(); - Assert.assertEquals(updatedVlanId, actualVlanIdInt); + assertNotNull(actualVlanId); + assertEquals(updatedVlanId, actualVlanId.getValue()); } } @@ -1815,7 +1793,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { // CREATE try (TestBridge testBridge = new TestBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME)) { OvsdbBridgeAugmentation bridge = getBridge(connectionInfo); - Assert.assertNotNull(bridge); + assertNotNull(bridge); NodeId nodeId = SouthboundUtils.createManagedNodeId(SouthboundUtils.createInstanceIdentifier( connectionInfo, bridge.getBridgeName())); OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder = @@ -1823,10 +1801,10 @@ public class SouthboundIT extends AbstractMdsalTestBase { String portName = "testTerminationPointVlanMode" + vlanMode.toString(); ovsdbTerminationBuilder.setName(portName); ovsdbTerminationBuilder.setVlanMode(vlanMode); - Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); + assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); InstanceIdentifier terminationPointIid = getTpIid(connectionInfo, bridge); Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid); - Assert.assertNotNull(terminationPointNode); + assertNotNull(terminationPointNode); // READ for (TerminationPoint terminationPoint : terminationPointNode.nonnullTerminationPoint().values()) { @@ -1834,7 +1812,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { terminationPoint.augmentation(OvsdbTerminationPointAugmentation.class); if (ovsdbTerminationPointAugmentation.getName().equals(portName)) { //test - Assert.assertTrue(ovsdbTerminationPointAugmentation.getVlanMode().equals(vlanMode)); + assertTrue(ovsdbTerminationPointAugmentation.getVlanMode().equals(vlanMode)); } } @@ -1849,12 +1827,10 @@ public class SouthboundIT extends AbstractMdsalTestBase { portUpdateNodeBuilder.setNodeId(portUpdateNodeId); TerminationPointBuilder tpUpdateBuilder = new TerminationPointBuilder(); tpUpdateBuilder.withKey(new TerminationPointKey(new TpId(portName))); - tpUpdateBuilder.addAugmentation( - OvsdbTerminationPointAugmentation.class, - tpUpdateAugmentationBuilder.build()); + tpUpdateBuilder.addAugmentation(tpUpdateAugmentationBuilder.build()); tpUpdateBuilder.setTpId(new TpId(portName)); - portUpdateNodeBuilder.setTerminationPoint(Collections.singletonList(tpUpdateBuilder.build())); - Assert.assertTrue( + portUpdateNodeBuilder.setTerminationPoint(BindingMap.of(tpUpdateBuilder.build())); + assertTrue( mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, portIid, portUpdateNodeBuilder.build())); Thread.sleep(OVSDB_UPDATE_TIMEOUT); @@ -1864,7 +1840,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { terminationPoint.augmentation(OvsdbTerminationPointAugmentation.class); if (ovsdbTerminationPointAugmentation.getName().equals(portName)) { //test - Assert.assertEquals(updatedVlanMode, ovsdbTerminationPointAugmentation.getVlanMode()); + assertEquals(updatedVlanMode, ovsdbTerminationPointAugmentation.getVlanMode()); } } @@ -1873,37 +1849,36 @@ public class SouthboundIT extends AbstractMdsalTestBase { } } - private List> generateVlanSets() { + private static List> generateVlanSets() { int min = 0; int max = 4095; return Lists.newArrayList( - Collections.emptySet(), - Collections.singleton(2222), - Sets.newHashSet(min, max, min + 1, max - 1, (max - min) / 2)); + Collections.emptySet(), + Collections.singleton(Uint16.valueOf(2222)), + Sets.newHashSet(Uint16.valueOf(min), Uint16.valueOf(max), Uint16.valueOf(min + 1), + Uint16.valueOf(max - 1), Uint16.valueOf((max - min) / 2))); } - private List buildTrunkList(Set trunkSet) { + private static List buildTrunkList(final Set trunkSet) { List trunkList = new ArrayList<>(); - for (Integer trunk : trunkSet) { - TrunksBuilder trunkBuilder = new TrunksBuilder(); - trunkBuilder.setTrunk(new VlanId(trunk)); - trunkList.add(trunkBuilder.build()); + for (Uint16 trunk : trunkSet) { + trunkList.add(new TrunksBuilder().setTrunk(new VlanId(trunk)).build()); } return trunkList; } @Test public void testCRUDTerminationPointVlanTrunks() throws InterruptedException { - final List updatedTrunks = buildTrunkList(Collections.singleton(2011)); + final List updatedTrunks = buildTrunkList(Collections.singleton(Uint16.valueOf(2011))); ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portNumber); - Iterable> vlanSets = generateVlanSets(); + Iterable> vlanSets = generateVlanSets(); int testCase = 0; - for (Set vlanSet : vlanSets) { + for (Set vlanSet : vlanSets) { ++testCase; // CREATE try (TestBridge testBridge = new TestBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME)) { OvsdbBridgeAugmentation bridge = getBridge(connectionInfo); - Assert.assertNotNull(bridge); + assertNotNull(bridge); NodeId nodeId = SouthboundUtils.createManagedNodeId(connectionInfo, bridge.getBridgeName()); OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder = createGenericOvsdbTerminationPointAugmentationBuilder(); @@ -1911,10 +1886,10 @@ public class SouthboundIT extends AbstractMdsalTestBase { ovsdbTerminationBuilder.setName(portName); List trunks = buildTrunkList(vlanSet); ovsdbTerminationBuilder.setTrunks(trunks); - Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); + assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); InstanceIdentifier terminationPointIid = getTpIid(connectionInfo, bridge); Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid); - Assert.assertNotNull(terminationPointNode); + assertNotNull(terminationPointNode); // READ Collection terminationPoints = @@ -1925,7 +1900,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { if (ovsdbTerminationPointAugmentation.getName().equals(portName)) { List actualTrunks = ovsdbTerminationPointAugmentation.getTrunks(); for (Trunks trunk : trunks) { - Assert.assertTrue(actualTrunks.contains(trunk)); + assertTrue(actualTrunks.contains(trunk)); } } } @@ -1942,12 +1917,10 @@ public class SouthboundIT extends AbstractMdsalTestBase { portUpdateNodeBuilder.setNodeId(portUpdateNodeId); TerminationPointBuilder tpUpdateBuilder = new TerminationPointBuilder(); tpUpdateBuilder.withKey(new TerminationPointKey(new TpId(portName))); - tpUpdateBuilder.addAugmentation( - OvsdbTerminationPointAugmentation.class, - tpUpdateAugmentationBuilder.build()); + tpUpdateBuilder.addAugmentation(tpUpdateAugmentationBuilder.build()); tpUpdateBuilder.setTpId(new TpId(portName)); - portUpdateNodeBuilder.setTerminationPoint(Collections.singletonList(tpUpdateBuilder.build())); - Assert.assertTrue( + portUpdateNodeBuilder.setTerminationPoint(BindingMap.of(tpUpdateBuilder.build())); + assertTrue( mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, portIid, portUpdateNodeBuilder.build())); Thread.sleep(OVSDB_UPDATE_TIMEOUT); @@ -1957,7 +1930,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { terminationPoint.augmentation(OvsdbTerminationPointAugmentation.class); if (ovsdbTerminationPointAugmentation.getName().equals(portName)) { //test - Assert.assertEquals(updatedTrunks, ovsdbTerminationPointAugmentation.getTrunks()); + assertEquals(updatedTrunks, ovsdbTerminationPointAugmentation.getTrunks()); } } @@ -1981,22 +1954,22 @@ public class SouthboundIT extends AbstractMdsalTestBase { OvsdbNodeAugmentation ovsdbNodeAugmentation = getOvsdbNode(connectionInfo, LogicalDatastoreType.OPERATIONAL); QosEntries operQos = getQos(new Uri(testQosId), ovsdbNodeAugmentation); - Assert.assertNotNull(operQos); + assertNotNull(operQos); OvsdbBridgeAugmentation bridge = getBridge(connectionInfo); - Assert.assertNotNull(bridge); + assertNotNull(bridge); NodeId nodeId = SouthboundUtils.createManagedNodeId(connectionInfo, bridge.getBridgeName()); OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder = createGenericOvsdbTerminationPointAugmentationBuilder(); String portName = "testTerminationPointQos"; ovsdbTerminationBuilder.setName(portName); - Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); + assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); // READ and check that qos uuid has been added to the port InstanceIdentifier tpEntryIid = getTpIid(connectionInfo, bridge) .child(TerminationPoint.class, new TerminationPointKey(new TpId(portName))); TerminationPoint terminationPoint = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, tpEntryIid); - Assert.assertNotNull(terminationPoint); + assertNotNull(terminationPoint); // UPDATE - remove the qos entry from the port OvsdbTerminationPointAugmentationBuilder tpUpdateAugmentationBuilder = @@ -2004,18 +1977,16 @@ public class SouthboundIT extends AbstractMdsalTestBase { tpUpdateAugmentationBuilder.setName(portName); TerminationPointBuilder tpUpdateBuilder = new TerminationPointBuilder(); tpUpdateBuilder.withKey(new TerminationPointKey(new TpId(portName))); - tpUpdateBuilder.addAugmentation( - OvsdbTerminationPointAugmentation.class, - tpUpdateAugmentationBuilder.build()); + tpUpdateBuilder.addAugmentation(tpUpdateAugmentationBuilder.build()); tpUpdateBuilder.setTpId(new TpId(portName)); - Assert.assertTrue( + assertTrue( mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, tpEntryIid, tpUpdateBuilder.build())); Thread.sleep(OVSDB_UPDATE_TIMEOUT); // READ and verify that qos uuid has been removed from port TerminationPoint terminationPointUpdate = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, tpEntryIid); - Assert.assertNotNull(terminationPointUpdate); + assertNotNull(terminationPointUpdate); // DELETE handled by TestBridge } @@ -2032,8 +2003,8 @@ public class SouthboundIT extends AbstractMdsalTestBase { InstanceIdentifier expectedNodeIid = SouthboundUtils.createInstanceIdentifier(connectionInfo); NodeId expectedNodeId = expectedNodeIid.firstKeyOf(Node.class).getNodeId(); Node foundNode = null; - Assert.assertNotNull("Expected to find topology: " + topologyPath, topology); - Assert.assertNotNull("Expected to find some nodes" + topology.getNode()); + assertNotNull("Expected to find topology: " + topologyPath, topology); + assertNotNull("Expected to find some nodes" + topology.getNode()); LOG.info("expectedNodeId: {}, getNode: {}", expectedNodeId, topology.getNode()); for (Node node : topology.nonnullNode().values()) { if (node.getNodeId().getValue().equals(expectedNodeId.getValue())) { @@ -2041,7 +2012,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { break; } } - Assert.assertNotNull("Expected to find Node: " + expectedNodeId, foundNode); + assertNotNull("Expected to find Node: " + expectedNodeId, foundNode); } /* @@ -2054,13 +2025,13 @@ public class SouthboundIT extends AbstractMdsalTestBase { } private interface SouthboundBridgeHelper, T extends Identifiable> { - void writeValues(OvsdbBridgeAugmentationBuilder builder, List values); + void writeValues(OvsdbBridgeAugmentationBuilder builder, Map values); Map readValues(OvsdbBridgeAugmentation augmentation); } - private , T extends Identifiable> void testCRUDBridge(String prefix, - KeyValueBuilder builder, SouthboundBridgeHelper helper) throws InterruptedException { + private static , T extends Identifiable> void testCRUDBridge(final String prefix, + final KeyValueBuilder builder, final SouthboundBridgeHelper helper) throws InterruptedException { ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portNumber); // updateFromTestCases represent the original test case value. updateToTestCases represent the new value after // the update has been performed. @@ -2084,10 +2055,9 @@ public class SouthboundIT extends AbstractMdsalTestBase { SouthboundConstants.OVSDB_FAIL_MODE_MAP.inverse().get("secure")); setManagedBy(bridgeCreateAugmentationBuilder, connectionInfo); helper.writeValues(bridgeCreateAugmentationBuilder, updateFromTestCase.inputValues); - bridgeCreateNodeBuilder.addAugmentation(OvsdbBridgeAugmentation.class, - bridgeCreateAugmentationBuilder.build()); + bridgeCreateNodeBuilder.addAugmentation(bridgeCreateAugmentationBuilder.build()); LOG.debug("Built with the intent to store bridge data {}", bridgeCreateAugmentationBuilder); - Assert.assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, bridgeIid, + assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, bridgeIid, bridgeCreateNodeBuilder.build())); Thread.sleep(OVSDB_UPDATE_TIMEOUT); @@ -2108,9 +2078,8 @@ public class SouthboundIT extends AbstractMdsalTestBase { final Node bridgeNode = getBridgeNode(connectionInfo, testBridgeName); bridgeUpdateNodeBuilder.setNodeId(bridgeNode.getNodeId()); bridgeUpdateNodeBuilder.withKey(bridgeNode.key()); - bridgeUpdateNodeBuilder.addAugmentation(OvsdbBridgeAugmentation.class, - bridgeUpdateAugmentationBuilder.build()); - Assert.assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, bridgeIid, + bridgeUpdateNodeBuilder.addAugmentation(bridgeUpdateAugmentationBuilder.build()); + assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, bridgeIid, bridgeUpdateNodeBuilder.build())); Thread.sleep(OVSDB_UPDATE_TIMEOUT); @@ -2127,7 +2096,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { } // DELETE - Assert.assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, bridgeIid)); + assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, bridgeIid)); Thread.sleep(OVSDB_UPDATE_TIMEOUT); } } @@ -2157,12 +2126,12 @@ public class SouthboundIT extends AbstractMdsalTestBase { ovsdbNodeAugmentation = getOvsdbNode(connectionInfo, LogicalDatastoreType.OPERATIONAL); QosEntries operQosHtb = getQos(qosUri, ovsdbNodeAugmentation); - Assert.assertNotNull(operQosHtb); + assertNotNull(operQosHtb); } ovsdbNodeAugmentation = getOvsdbNode(connectionInfo, LogicalDatastoreType.OPERATIONAL); QosEntries operQosHtb = getQos(qosUri, ovsdbNodeAugmentation); - Assert.assertNull(operQosHtb); + assertNull(operQosHtb); } } @@ -2171,27 +2140,28 @@ public class SouthboundIT extends AbstractMdsalTestBase { ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portNumber); Uri queueUri = new Uri("QUEUE-A1"); - try (TestQueue testQueue = new TestQueue(connectionInfo, queueUri, Short.valueOf("25"), null, null)) { + try (TestQueue testQueue = new TestQueue(connectionInfo, queueUri, Uint8.valueOf(25), null, null)) { OvsdbNodeAugmentation ovsdbNodeAugmentation = getOvsdbNode(connectionInfo, LogicalDatastoreType.OPERATIONAL); Queues operQueue = getQueue(queueUri, ovsdbNodeAugmentation); - Assert.assertNotNull(operQueue); + assertNotNull(operQueue); } OvsdbNodeAugmentation ovsdbNodeAugmentation = getOvsdbNode(connectionInfo, LogicalDatastoreType.OPERATIONAL); Queues operQueue = getQueue(queueUri, ovsdbNodeAugmentation); - Assert.assertNull(operQueue); + assertNull(operQueue); } private static class SouthboundQueuesExternalIdsHelper implements SouthboundQueueHelper { @Override - public void writeValues(QueuesBuilder builder, List values) { + public void writeValues(final QueuesBuilder builder, + final Map values) { builder.setQueuesExternalIds(values); } @Override - public Map readValues(Queues queue) { + public Map readValues(final Queues queue) { return queue.getQueuesExternalIds(); } } @@ -2199,23 +2169,24 @@ public class SouthboundIT extends AbstractMdsalTestBase { private static class SouthboundQueuesOtherConfigHelper implements SouthboundQueueHelper { @Override - public void writeValues(QueuesBuilder builder, List values) { + public void writeValues(final QueuesBuilder builder, + final Map values) { builder.setQueuesOtherConfig(values); } @Override - public Map readValues(Queues queue) { + public Map readValues(final Queues queue) { return queue.getQueuesOtherConfig(); } } private interface SouthboundQueueHelper, T extends Identifiable> { - void writeValues(QueuesBuilder builder, List values); + void writeValues(QueuesBuilder builder, Map values); Map readValues(Queues queue); } - private static Queues getQueue(Uri queueId, OvsdbNodeAugmentation node) { + private static Queues getQueue(final Uri queueId, final OvsdbNodeAugmentation node) { for (Queues queue : node.nonnullQueues().values()) { if (queue.key().getQueueId().getValue().equals(queueId.getValue())) { return queue; @@ -2227,12 +2198,12 @@ public class SouthboundIT extends AbstractMdsalTestBase { private static class SouthboundQosExternalIdsHelper implements SouthboundQosHelper { @Override - public void writeValues(QosEntriesBuilder builder, List values) { + public void writeValues(final QosEntriesBuilder builder, final Map values) { builder.setQosExternalIds(values); } @Override - public Map readValues(QosEntries qos) { + public Map readValues(final QosEntries qos) { return qos.getQosExternalIds(); } } @@ -2240,23 +2211,23 @@ public class SouthboundIT extends AbstractMdsalTestBase { private static class SouthboundQosOtherConfigHelper implements SouthboundQosHelper { @Override - public void writeValues(QosEntriesBuilder builder, List values) { + public void writeValues(final QosEntriesBuilder builder, final Map values) { builder.setQosOtherConfig(values); } @Override - public Map readValues(QosEntries qos) { + public Map readValues(final QosEntries qos) { return qos.getQosOtherConfig(); } } private interface SouthboundQosHelper, T extends Identifiable> { - void writeValues(QosEntriesBuilder builder, List values); + void writeValues(QosEntriesBuilder builder, Map values); Map readValues(QosEntries qos); } - private static QosEntries getQos(Uri qosId, OvsdbNodeAugmentation node) { + private static QosEntries getQos(final Uri qosId, final OvsdbNodeAugmentation node) { for (QosEntries qos : node.nonnullQosEntries().values()) { if (qos.key().getQosId().equals(qosId)) { return qos; @@ -2265,8 +2236,8 @@ public class SouthboundIT extends AbstractMdsalTestBase { return null; } - private , T extends Identifiable> void testCRUDQueue( - KeyValueBuilder builder, String prefix, SouthboundQueueHelper helper) + private static , T extends Identifiable> void testCRUDQueue( + final KeyValueBuilder builder, final String prefix, final SouthboundQueueHelper helper) throws InterruptedException { ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portNumber); @@ -2282,7 +2253,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { // CREATE: and update the test queue with starting values. try (TestQueue testQueue = new TestQueue(connectionInfo, new Uri(testQueueId), - Short.valueOf("45"), null, null)) { + Uint8.valueOf(45), null, null)) { QueuesBuilder queuesBuilder = new QueuesBuilder(); queuesBuilder.setQueueId(new Uri(testQueueId)); InstanceIdentifier queueIid = SouthboundUtils.createInstanceIdentifier(connectionInfo) @@ -2296,7 +2267,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { queueOperationalListener.registerDataChangeListener(); helper.writeValues(queuesBuilder, updateFromTestCase.inputValues); - Assert.assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, + assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, queueIid, queuesBuilder.build())); queueConfigurationListener.waitForUpdate(OVSDB_UPDATE_TIMEOUT); @@ -2322,7 +2293,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { QueuesBuilder queuesUpdateBuilder = new QueuesBuilder(); queuesUpdateBuilder.setQueueId(new Uri(testQueueId)); helper.writeValues(queuesUpdateBuilder, updateToTestCase.inputValues); - Assert.assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, + assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, queueIid, queuesUpdateBuilder.build())); queueConfigurationListener.waitForUpdate(OVSDB_UPDATE_TIMEOUT); @@ -2367,8 +2338,8 @@ public class SouthboundIT extends AbstractMdsalTestBase { String testQueueId = "testQueueDscp"; // CREATE: and update the test queue with starting values. - try (TestQueue testQueue = new TestQueue(connectionInfo, new Uri(testQueueId), (short) 0, null, null)) { - for (Short dscp = 1; dscp < 64; dscp++) { + try (TestQueue testQueue = new TestQueue(connectionInfo, new Uri(testQueueId), Uint8.ZERO, null, null)) { + for (short dscp = 1; dscp < 64; dscp++) { QueuesBuilder queuesBuilder = new QueuesBuilder(); queuesBuilder.setQueueId(new Uri(testQueueId)); InstanceIdentifier queueIid = SouthboundUtils.createInstanceIdentifier(connectionInfo) @@ -2378,8 +2349,8 @@ public class SouthboundIT extends AbstractMdsalTestBase { new NotifyingDataChangeListener(LogicalDatastoreType.OPERATIONAL, queueIid); queueOperationalListener.registerDataChangeListener(); - queuesBuilder.setDscp(dscp); - Assert.assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, + queuesBuilder.setDscp(Uint8.valueOf(dscp)); + assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, queueIid, queuesBuilder.build())); queueOperationalListener.waitForUpdate(OVSDB_ROUNDTRIP_TIMEOUT); @@ -2388,10 +2359,8 @@ public class SouthboundIT extends AbstractMdsalTestBase { OvsdbNodeAugmentation ovsdbNodeAugmentation = getOvsdbNode(connectionInfo, LogicalDatastoreType.OPERATIONAL); Queues operQueue = getQueue(new Uri(testQueueId), ovsdbNodeAugmentation); - Assert.assertNotNull(operQueue); - Short operDscp = operQueue.getDscp().toJava(); - Assert.assertNotNull(operDscp); - Assert.assertEquals(dscp, operDscp); + assertNotNull(operQueue); + assertEquals(dscp, operQueue.getDscp().toJava()); } // DELETE handled by TestQueue @@ -2399,8 +2368,8 @@ public class SouthboundIT extends AbstractMdsalTestBase { } - private , T extends Identifiable> void testCRUDQos( - KeyValueBuilder builder, String prefix, SouthboundQosHelper helper) + private static , T extends Identifiable> void testCRUDQos( + final KeyValueBuilder builder, final String prefix, final SouthboundQosHelper helper) throws InterruptedException { ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portNumber); @@ -2430,7 +2399,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { qosOperationalListener.registerDataChangeListener(); helper.writeValues(qosBuilder, updateFromTestCase.inputValues); - Assert.assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, + assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, qosIid, qosBuilder.build())); qosConfigurationListener.waitForUpdate(OVSDB_UPDATE_TIMEOUT); @@ -2455,7 +2424,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { QosEntriesBuilder qosUpdateBuilder = new QosEntriesBuilder(); qosUpdateBuilder.setQosId(new Uri(testQosId)); helper.writeValues(qosUpdateBuilder, updateToTestCase.inputValues); - Assert.assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, + assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, qosIid, qosUpdateBuilder.build())); qosConfigurationListener.waitForUpdate(OVSDB_UPDATE_TIMEOUT); @@ -2502,9 +2471,9 @@ public class SouthboundIT extends AbstractMdsalTestBase { // CREATE: and update the test queue with starting values. try (TestQos testQos = new TestQos(connectionInfo, new Uri(testQosId), SouthboundMapper.createQosType(SouthboundConstants.QOS_LINUX_HTB), null, null); - TestQueue testQueue1 = new TestQueue(connectionInfo, new Uri("queue1"), Short.valueOf("12"), null, + TestQueue testQueue1 = new TestQueue(connectionInfo, new Uri("queue1"), Uint8.valueOf(12), null, null); - TestQueue testQueue2 = new TestQueue(connectionInfo, new Uri("queue2"), Short.valueOf("35"), null, + TestQueue testQueue2 = new TestQueue(connectionInfo, new Uri("queue2"), Uint8.valueOf(35), null, null)) { QosEntriesBuilder qosBuilder = new QosEntriesBuilder(); qosBuilder.setQosId(new Uri(testQosId)); @@ -2522,23 +2491,23 @@ public class SouthboundIT extends AbstractMdsalTestBase { Queues operQueue1 = getQueue(new Uri("queue1"), ovsdbNodeAugmentation); - Assert.assertNotNull(operQueue1); + assertNotNull(operQueue1); InstanceIdentifier queue1Iid = testQueue1.getInstanceIdentifier(); OvsdbQueueRef queue1Ref = new OvsdbQueueRef(queue1Iid); Queues operQueue2 = getQueue(new Uri("queue2"), ovsdbNodeAugmentation); - Assert.assertNotNull(operQueue2); + assertNotNull(operQueue2); InstanceIdentifier queue2Iid = testQueue2.getInstanceIdentifier(); OvsdbQueueRef queue2Ref = new OvsdbQueueRef(queue2Iid); - List queueList = new ArrayList<>(); - queueList.add(new QueueListBuilder().setQueueNumber(Uint32.ONE).setQueueRef(queue1Ref).build()); - queueList.add(new QueueListBuilder().setQueueNumber(Uint32.TWO).setQueueRef(queue2Ref).build()); + Map queueList = BindingMap.of( + new QueueListBuilder().setQueueNumber(Uint32.ONE).setQueueRef(queue1Ref).build(), + new QueueListBuilder().setQueueNumber(Uint32.TWO).setQueueRef(queue2Ref).build()); qosBuilder.setQueueList(queueList); - Assert.assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, + assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, qosIid, qosBuilder.build())); qosOperationalListener.waitForUpdate(OVSDB_UPDATE_TIMEOUT); @@ -2547,17 +2516,17 @@ public class SouthboundIT extends AbstractMdsalTestBase { ovsdbNodeAugmentation = getOvsdbNode(connectionInfo, LogicalDatastoreType.OPERATIONAL); QosEntries operQos = getQos(new Uri(testQosId), ovsdbNodeAugmentation); - Assert.assertNotNull(operQos); + assertNotNull(operQos); Map operQueueList = operQos.getQueueList(); - Assert.assertNotNull(operQueueList); - for (QueueList queueEntry : queueList) { - Assert.assertTrue(isQueueInList(operQueueList, queueEntry)); + assertNotNull(operQueueList); + for (QueueList queueEntry : queueList.values()) { + assertTrue(isQueueInList(operQueueList, queueEntry)); } // DELETE one queue from queue list and check that one remains KeyedInstanceIdentifier qosQueueIid = qosIid .child(QueueList.class, new QueueListKey(Uint32.ONE)); - Assert.assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, qosQueueIid)); + assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, qosQueueIid)); qosOperationalListener.waitForUpdate(OVSDB_UPDATE_TIMEOUT); // READ: Read the test qos and ensure changes are propagated to the OPERATIONAL data store @@ -2565,39 +2534,39 @@ public class SouthboundIT extends AbstractMdsalTestBase { ovsdbNodeAugmentation = getOvsdbNode(connectionInfo, LogicalDatastoreType.OPERATIONAL); operQos = getQos(new Uri(testQosId), ovsdbNodeAugmentation); - Assert.assertNotNull(operQos); + assertNotNull(operQos); operQueueList = operQos.getQueueList(); - Assert.assertNotNull(operQueueList); + assertNotNull(operQueueList); - for (QueueList queueEntry : queueList) { + for (QueueList queueEntry : queueList.values()) { if (queueEntry.getQueueRef().equals(queue2Ref)) { - Assert.assertTrue(isQueueInList(operQueueList, queueEntry)); + assertTrue(isQueueInList(operQueueList, queueEntry)); } else if (queueEntry.getQueueRef().equals(queue1Ref)) { - Assert.assertFalse(isQueueInList(operQueueList, queueEntry)); + assertFalse(isQueueInList(operQueueList, queueEntry)); } else { - Assert.assertTrue("Unknown queue entry in qos queue list", false); + assertTrue("Unknown queue entry in qos queue list", false); } } // DELETE queue list and check that list is empty qosQueueIid = qosIid .child(QueueList.class, new QueueListKey(Uint32.ONE)); - Assert.assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, qosQueueIid)); + assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, qosQueueIid)); qosOperationalListener.waitForUpdate(OVSDB_UPDATE_TIMEOUT); ovsdbNodeAugmentation = getOvsdbNode(connectionInfo, LogicalDatastoreType.OPERATIONAL); operQos = getQos(new Uri(testQosId), ovsdbNodeAugmentation); - Assert.assertNotNull(operQos); + assertNotNull(operQos); operQueueList = operQos.getQueueList(); - Assert.assertNotNull(operQueueList); - Assert.assertTrue(operQueueList.isEmpty()); + assertNotNull(operQueueList); + assertTrue(operQueueList.isEmpty()); } } - private static Boolean isQueueInList(Map queueList, QueueList queue) { + private static Boolean isQueueInList(final Map queueList, final QueueList queue) { for (QueueList queueEntry : queueList.values()) { if (queueEntry.getQueueNumber().equals(queue.getQueueNumber()) && queueEntry.getQueueRef().equals(queue.getQueueRef())) { @@ -2621,7 +2590,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { */ private static final class SouthboundTestCase, T extends Identifiable> { private final String name; - private final List inputValues; + private final Map inputValues; private final Map expectedValues; /** @@ -2633,8 +2602,8 @@ public class SouthboundIT extends AbstractMdsalTestBase { */ SouthboundTestCase(final String name, final List inputValues, final List expectedValues) { this.name = name; - this.inputValues = inputValues; - this.expectedValues = Maps.uniqueIndex(expectedValues, Identifiable::key); + this.inputValues = BindingMap.ordered(inputValues); + this.expectedValues = BindingMap.of(expectedValues); } } @@ -2745,12 +2714,12 @@ public class SouthboundIT extends AbstractMdsalTestBase { } @Override - protected void setKey(Builder builder, String key) { + protected void setKey(final Builder builder, final String key) { ((QueuesExternalIdsBuilder) builder).setQueuesExternalIdKey(key); } @Override - protected void setValue(Builder builder, String value) { + protected void setValue(final Builder builder, final String value) { ((QueuesExternalIdsBuilder) builder).setQueuesExternalIdValue(value); } @@ -2767,12 +2736,12 @@ public class SouthboundIT extends AbstractMdsalTestBase { } @Override - protected void setKey(Builder builder, String key) { + protected void setKey(final Builder builder, final String key) { ((QueuesOtherConfigBuilder) builder).setQueueOtherConfigKey(key); } @Override - protected void setValue(Builder builder, String value) { + protected void setValue(final Builder builder, final String value) { ((QueuesOtherConfigBuilder) builder).setQueueOtherConfigValue(value); } @@ -2789,12 +2758,12 @@ public class SouthboundIT extends AbstractMdsalTestBase { } @Override - protected void setKey(Builder builder, String key) { + protected void setKey(final Builder builder, final String key) { ((QosExternalIdsBuilder) builder).setQosExternalIdKey(key); } @Override - protected void setValue(Builder builder, String value) { + protected void setValue(final Builder builder, final String value) { ((QosExternalIdsBuilder) builder).setQosExternalIdValue(value); } @@ -2811,12 +2780,12 @@ public class SouthboundIT extends AbstractMdsalTestBase { } @Override - protected void setKey(Builder builder, String key) { + protected void setKey(final Builder builder, final String key) { ((QosOtherConfigBuilder) builder).setOtherConfigKey(key); } @Override - protected void setValue(Builder builder, String value) { + protected void setValue(final Builder builder, final String value) { ((QosOtherConfigBuilder) builder).setOtherConfigValue(value); } @@ -2833,12 +2802,12 @@ public class SouthboundIT extends AbstractMdsalTestBase { } @Override - protected void setKey(Builder builder, String key) { + protected void setKey(final Builder builder, final String key) { ((PortExternalIdsBuilder) builder).setExternalIdKey(key); } @Override - protected void setValue(Builder builder, String value) { + protected void setValue(final Builder builder, final String value) { ((PortExternalIdsBuilder) builder).setExternalIdValue(value); } @@ -2855,12 +2824,12 @@ public class SouthboundIT extends AbstractMdsalTestBase { } @Override - protected void setKey(Builder builder, String key) { + protected void setKey(final Builder builder, final String key) { ((InterfaceExternalIdsBuilder) builder).setExternalIdKey(key); } @Override - protected void setValue(Builder builder, String value) { + protected void setValue(final Builder builder, final String value) { ((InterfaceExternalIdsBuilder) builder).setExternalIdValue(value); } @@ -2877,12 +2846,12 @@ public class SouthboundIT extends AbstractMdsalTestBase { } @Override - protected void setKey(Builder builder, String key) { + protected void setKey(final Builder builder, final String key) { ((InterfaceLldpBuilder) builder).setLldpKey(key); } @Override - protected void setValue(Builder builder, String value) { + protected void setValue(final Builder builder, final String value) { ((InterfaceLldpBuilder) builder).setLldpValue(value); } @@ -2899,12 +2868,12 @@ public class SouthboundIT extends AbstractMdsalTestBase { } @Override - protected void setKey(Builder builder, String key) { + protected void setKey(final Builder builder, final String key) { ((OptionsBuilder) builder).setOption(key); } @Override - protected void setValue(Builder builder, String value) { + protected void setValue(final Builder builder, final String value) { ((OptionsBuilder) builder).setValue(value); } @@ -2921,12 +2890,12 @@ public class SouthboundIT extends AbstractMdsalTestBase { } @Override - protected void setKey(Builder builder, String key) { + protected void setKey(final Builder builder, final String key) { ((InterfaceOtherConfigsBuilder) builder).setOtherConfigKey(key); } @Override - protected void setValue(Builder builder, String value) { + protected void setValue(final Builder builder, final String value) { ((InterfaceOtherConfigsBuilder) builder).setOtherConfigValue(value); } @@ -2943,12 +2912,12 @@ public class SouthboundIT extends AbstractMdsalTestBase { } @Override - protected void setKey(Builder builder, String key) { + protected void setKey(final Builder builder, final String key) { ((PortOtherConfigsBuilder) builder).setOtherConfigKey(key); } @Override - protected void setValue(Builder builder, String value) { + protected void setValue(final Builder builder, final String value) { ((PortOtherConfigsBuilder) builder).setOtherConfigValue(value); } @@ -2965,12 +2934,12 @@ public class SouthboundIT extends AbstractMdsalTestBase { } @Override - protected void setKey(Builder builder, String key) { + protected void setKey(final Builder builder, final String key) { ((BridgeOtherConfigsBuilder) builder).setBridgeOtherConfigKey(key); } @Override - protected void setValue(Builder builder, String value) { + protected void setValue(final Builder builder, final String value) { ((BridgeOtherConfigsBuilder) builder).setBridgeOtherConfigValue(value); } @@ -2987,12 +2956,12 @@ public class SouthboundIT extends AbstractMdsalTestBase { } @Override - protected void setKey(Builder builder, String key) { + protected void setKey(final Builder builder, final String key) { ((BridgeExternalIdsBuilder) builder).setBridgeExternalIdKey(key); } @Override - protected void setValue(Builder builder, String value) { + protected void setValue(final Builder builder, final String value) { ((BridgeExternalIdsBuilder) builder).setBridgeExternalIdValue(value); } @@ -3007,7 +2976,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { * the particular cases considered. */ private static , T extends Identifiable> List> - generateKeyValueTestCases(KeyValueBuilder builder, String testName) { + generateKeyValueTestCases(final KeyValueBuilder builder, final String testName) { List> testCases = new ArrayList<>(); final String goodKey = "GoodKey"; @@ -3076,12 +3045,14 @@ public class SouthboundIT extends AbstractMdsalTestBase { private static class PortExternalIdsSouthboundHelper implements SouthboundTerminationPointHelper { @Override - public void writeValues(OvsdbTerminationPointAugmentationBuilder builder, List values) { + public void writeValues(final OvsdbTerminationPointAugmentationBuilder builder, + final Map values) { builder.setPortExternalIds(values); } @Override - public Map readValues(OvsdbTerminationPointAugmentation augmentation) { + public Map readValues( + final OvsdbTerminationPointAugmentation augmentation) { return augmentation.getPortExternalIds(); } } @@ -3089,14 +3060,14 @@ public class SouthboundIT extends AbstractMdsalTestBase { private static class InterfaceExternalIdsSouthboundHelper implements SouthboundTerminationPointHelper { @Override - public void writeValues( - OvsdbTerminationPointAugmentationBuilder builder, List values) { + public void writeValues(final OvsdbTerminationPointAugmentationBuilder builder, + final Map values) { builder.setInterfaceExternalIds(values); } @Override public Map readValues( - OvsdbTerminationPointAugmentation augmentation) { + final OvsdbTerminationPointAugmentation augmentation) { return augmentation.getInterfaceExternalIds(); } } @@ -3104,26 +3075,26 @@ public class SouthboundIT extends AbstractMdsalTestBase { private static class InterfaceLldpSouthboundHelper implements SouthboundTerminationPointHelper { @Override - public void writeValues( - OvsdbTerminationPointAugmentationBuilder builder, List values) { + public void writeValues(final OvsdbTerminationPointAugmentationBuilder builder, + final Map values) { builder.setInterfaceLldp(values); } @Override - public Map readValues(OvsdbTerminationPointAugmentation augmentation) { + public Map readValues(final OvsdbTerminationPointAugmentation augmentation) { return augmentation.getInterfaceLldp(); } } private static class OptionsSouthboundHelper implements SouthboundTerminationPointHelper { @Override - public void writeValues( - OvsdbTerminationPointAugmentationBuilder builder, List values) { + public void writeValues(final OvsdbTerminationPointAugmentationBuilder builder, + final Map values) { builder.setOptions(values); } @Override - public Map readValues(OvsdbTerminationPointAugmentation augmentation) { + public Map readValues(final OvsdbTerminationPointAugmentation augmentation) { return augmentation.getOptions(); } } @@ -3131,14 +3102,14 @@ public class SouthboundIT extends AbstractMdsalTestBase { private static class InterfaceOtherConfigsSouthboundHelper implements SouthboundTerminationPointHelper { @Override - public void writeValues( - OvsdbTerminationPointAugmentationBuilder builder, List values) { + public void writeValues(final OvsdbTerminationPointAugmentationBuilder builder, + final Map values) { builder.setInterfaceOtherConfigs(values); } @Override public Map readValues( - OvsdbTerminationPointAugmentation augmentation) { + final OvsdbTerminationPointAugmentation augmentation) { return augmentation.getInterfaceOtherConfigs(); } } @@ -3146,13 +3117,14 @@ public class SouthboundIT extends AbstractMdsalTestBase { private static class PortOtherConfigsSouthboundHelper implements SouthboundTerminationPointHelper { @Override - public void writeValues( - OvsdbTerminationPointAugmentationBuilder builder, List values) { + public void writeValues(final OvsdbTerminationPointAugmentationBuilder builder, + final Map values) { builder.setPortOtherConfigs(values); } @Override - public Map readValues(OvsdbTerminationPointAugmentation augmentation) { + public Map readValues( + final OvsdbTerminationPointAugmentation augmentation) { return augmentation.getPortOtherConfigs(); } } @@ -3160,13 +3132,13 @@ public class SouthboundIT extends AbstractMdsalTestBase { private static class BridgeExternalIdsSouthboundHelper implements SouthboundBridgeHelper { @Override - public void writeValues( - OvsdbBridgeAugmentationBuilder builder, List values) { + public void writeValues(final OvsdbBridgeAugmentationBuilder builder, + final Map values) { builder.setBridgeExternalIds(values); } @Override - public Map readValues(OvsdbBridgeAugmentation augmentation) { + public Map readValues(final OvsdbBridgeAugmentation augmentation) { return augmentation.getBridgeExternalIds(); } } @@ -3174,13 +3146,13 @@ public class SouthboundIT extends AbstractMdsalTestBase { private static class BridgeOtherConfigsSouthboundHelper implements SouthboundBridgeHelper { @Override - public void writeValues( - OvsdbBridgeAugmentationBuilder builder, List values) { + public void writeValues(final OvsdbBridgeAugmentationBuilder builder, + final Map values) { builder.setBridgeOtherConfigs(values); } @Override - public Map readValues(OvsdbBridgeAugmentation augmentation) { + public Map readValues(final OvsdbBridgeAugmentation augmentation) { return augmentation.getBridgeOtherConfigs(); } }