import org.opendaylight.ovsdb.southbound.SouthboundUtil;
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.rev100924.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
+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;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathTypeBase;
private static final int OVSDB_ROUNDTRIP_TIMEOUT = 10000;
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 String addressStr;
private static int portNumber;
private static String connectionType;
.getURL();
}
- @Override
- public String getModuleName() {
- return "southbound-impl";
- }
-
- @Override
- public String getInstanceName() {
- return "southbound-default";
- }
-
@Override
public MavenUrlReference getFeatureRepo() {
return maven()
return tpList.get(index).getAugmentation(OvsdbTerminationPointAugmentation.class);
}
+ @Test
+ public void testCRUDTerminationPointIfIndex() throws InterruptedException {
+ final boolean isOldSchema = schemaVersion.compareTo(IF_INDEX_FROM_VERSION) < 0;
+ Assume.assumeFalse(isOldSchema);
+ ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portNumber);
+
+ // Test create ifIndex
+ try (TestBridge testBridge = new TestBridge(connectionInfo, null, SouthboundITConstants.BRIDGE_NAME, null, true,
+ SouthboundConstants.OVSDB_FAIL_MODE_MAP.inverse().get("secure"),
+ true, SouthboundMapper.createDatapathType("netdev"), null, null, null)) {
+ OvsdbBridgeAugmentation bridge = getBridge(connectionInfo);
+ Assert.assertNotNull(bridge);
+ LOG.info("bridge: {}", bridge);
+ NodeId nodeId = SouthboundMapper.createManagedNodeId(SouthboundUtils.createInstanceIdentifier(
+ connectionInfo, bridge.getBridgeName()));
+ OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder =
+ createGenericOvsdbTerminationPointAugmentationBuilder();
+ String portName = "testIfIndex";
+ ovsdbTerminationBuilder.setName(portName);
+
+ Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder));
+ InstanceIdentifier<Node> terminationPointIid = getTpIid(connectionInfo, bridge);
+ Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid);
+ Assert.assertNotNull(terminationPointNode);
+
+ // Test read ifIndex
+ List<TerminationPoint> terminationPoints = terminationPointNode.getTerminationPoint();
+ for (TerminationPoint terminationPoint : terminationPoints) {
+ OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation =
+ terminationPoint.getAugmentation(OvsdbTerminationPointAugmentation.class);
+ if (ovsdbTerminationPointAugmentation.getName().equals(portName)) {
+ Long ifIndex = ovsdbTerminationPointAugmentation.getIfindex();
+ Assert.assertNotNull(ifIndex);
+ LOG.info("ifIndex: {} for the port:{}", ifIndex, portName);
+ }
+ }
+ }
+ }
+
@Test
public void testCRDTerminationPointOfPort() throws InterruptedException {
final Long OFPORT_EXPECTED = 45002L;
private Queues getQueue(Uri queueId, OvsdbNodeAugmentation node) {
for (Queues queue : node.getQueues()) {
- if (queue.getKey().getQueueId().equals(queueId))
+ if (queue.getKey().getQueueId().getValue().equals(queueId.getValue()))
return queue;
}
return null;
List<QueueList> operQueueList = operQos.getQueueList();
Assert.assertNotNull(operQueueList);
for (QueueList queueEntry : queueList) {
- Assert.assertTrue(operQueueList.contains(queueEntry));
+ Assert.assertTrue(isQueueInList(operQueueList, queueEntry));
}
// DELETE one queue from queue list and check that one remains
operQueueList = operQos.getQueueList();
Assert.assertNotNull(operQueueList);
for (QueueList queueEntry : queueList) {
- if (queueEntry.getQueueUuid().equals(queue2Uuid))
- Assert.assertTrue(operQueueList.contains(queueEntry));
- else if (queueEntry.getQueueUuid().equals(queue1Uuid)) {
- Assert.assertFalse(operQueueList.contains(queueEntry));
+ if (queueEntry.getQueueUuid().equals(queue2Uuid)) {
+ Assert.assertTrue(isQueueInList(operQueueList, queueEntry));
+ } else if (queueEntry.getQueueUuid().equals(queue1Uuid)) {
+ Assert.assertFalse(isQueueInList(operQueueList, queueEntry));
} else {
Assert.assertTrue("Unknown queue entry in qos queue list", false);
}
}
}
+ private Boolean isQueueInList(List<QueueList> queueList, QueueList queue) {
+ for (QueueList queueEntry : queueList) {
+ if (queueEntry.getQueueNumber().equals(queue.getQueueNumber())
+ && queueEntry.getQueueUuid().equals(queue.getQueueUuid())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* <p>
* Representation of a southbound test case. Each test case has a name, a list of input values and a list of