From: Praveen Mala Date: Mon, 9 Jan 2017 23:56:31 +0000 (-0500) Subject: Bug 7757 -Removing qos deprecations in carbon X-Git-Tag: release/nitrogen~26 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=48e97d6384cfa2c03101e02900b7c7bd0a55b0d3;p=ovsdb.git Bug 7757 -Removing qos deprecations in carbon remove leaf qos,leaf queue-uuid from the model and then the relevant code in the ovsdb plugin along with postman collection Change-Id: I2003b0e9f7e7d17d1b28b19da0a2bf31cadd637a Signed-off-by: Praveen Mala --- diff --git a/resources/commons/Qos-and-Queue-Collection.json.postman_collection b/resources/commons/Qos-and-Queue-Collection.json.postman_collection index 4f420c69a..fc130b4ee 100644 --- a/resources/commons/Qos-and-Queue-Collection.json.postman_collection +++ b/resources/commons/Qos-and-Queue-Collection.json.postman_collection @@ -42,7 +42,7 @@ "currentHelper": "normal", "helperAttributes": {}, "time": 1454572576470, - "name": "Add a QpS entry to a qos-entries list", + "name": "Add a QoS entry to a qos-entries list", "description": "This restconf request will create or update a Qos entry for the ovsdb node 'HOST1'.", "collectionId": "b96ed27e-7aee-47e1-daa6-e3dbe3f176af", "responses": [], @@ -107,26 +107,6 @@ "responses": [], "rawModeData": "\r\n {\r\n \"node\": [\r\n {\r\n \"node-id\": \"ovsdb:HOST1\",\r\n \"connection-info\": {\r\n \"ovsdb:remote-ip\": \"{{HYPERVISOR-IP}}\",\r\n \"ovsdb:remote-port\": \"{{HYPERVISOR-OVSDB-PORT}}\"\r\n }\r\n }\r\n ]\r\n }\r\n" }, - { - "id": "4298de9f-d2e0-a7c0-da4b-71ce9ecc7260", - "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\nAccept: application/json\n", - "url": "http://{{CONTROLLER-IP}}:8181/restconf/config/network-topology:network-topology/topology/ovsdb:1/node/ovsdb:HOST1%2Fbridge%2Fbr-test/termination-point/testport/", - "preRequestScript": "", - "pathVariables": {}, - "method": "PUT", - "data": [], - "dataMode": "raw", - "version": 2, - "tests": "", - "currentHelper": "normal", - "helperAttributes": {}, - "time": 1454572769501, - "name": "Add existing QoS UUID to existing termination point (deprecated)", - "description": "This restconf request will specify the UUID of a Qos entry to associate with a port.\n\nThe Qos UUID is the actual operational value of a Qos entry.\n\nNote: The QoS model also has a QoS ID. The preferred method for associating a QoS entry to a termination point is to use the QoS ID.", - "collectionId": "b96ed27e-7aee-47e1-daa6-e3dbe3f176af", - "responses": [], - "rawModeData": "{\n \"network-topology:termination-point\": [\n \t{\n \t \t\t\"ovsdb:name\": \"testport\",\n \t\t\t\"tp-id\": \"testport\",\n \t\t\t\"qos\": \"4126e461-020d-497d-97b7-c8f409d1c9b9\"\n \t\t}\n ]\n}" - }, { "id": "479d3281-ac30-3b30-d727-80b0b8505140", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", @@ -228,26 +208,6 @@ "helperAttributes": {}, "rawModeData": "{\n \"network-topology:termination-point\": [\n \t{\n\t \t\t\"ovsdb:name\": \"testport\",\n \t\t\t\"tp-id\": \"testport\",\n \"ovsdb:ingress-policing-rate\": 1000,\n \"ovsdb:ingress-policing-burst\": 2000\n\t\t}\n ]\n}" }, - { - "id": "8ff38d91-00ee-e7c6-ef1a-e3d236f59641", - "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\nAccept: application/json\n", - "url": "http://{{CONTROLLER-IP}}:8181/restconf/config/network-topology:network-topology/topology/ovsdb:1/node/ovsdb:HOST1%2Fbridge%2Fbr-test/termination-point/testport/", - "preRequestScript": "", - "pathVariables": {}, - "method": "PUT", - "data": [], - "dataMode": "raw", - "version": 2, - "tests": "", - "currentHelper": "normal", - "helperAttributes": {}, - "time": 1454572787173, - "name": "Delete a QoS UUID from a termination point (deprecated)", - "description": "This restconf request will delete a Qos entry from a port (termination point).\n\nNote - this is done by doing a PUT operation on the termination port with the Qos\nentry cleared.\n\nNote - The model now provides a QoS entry list (max number of one entry) as part of the termination point model. This allows perfroaming a DELETE operation on the list entry instead of doing a PUT on the termination point.", - "collectionId": "b96ed27e-7aee-47e1-daa6-e3dbe3f176af", - "responses": [], - "rawModeData": "{\n \"network-topology:termination-point\": [\n \t{\n \t \t\t\"ovsdb:name\": \"testport\",\n \t\t\t\"tp-id\": \"testport\"\n \t\t}\n ]\n}" - }, { "id": "9aa6926b-70db-1d22-dc30-db269e424bec", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\n", diff --git a/southbound/southbound-api/src/main/yang/ovsdb.yang b/southbound/southbound-api/src/main/yang/ovsdb.yang index a66129a54..0cfd6ff88 100755 --- a/southbound/southbound-api/src/main/yang/ovsdb.yang +++ b/southbound/southbound-api/src/main/yang/ovsdb.yang @@ -551,11 +551,6 @@ module ovsdb { type ovsdb-queue-ref; } - leaf queue-uuid { - description "The unique identifier of the queue record."; - type yang:uuid; - status deprecated; - } } list qos-external-ids { key "qos-external-id-key"; @@ -1303,12 +1298,6 @@ module ovsdb { } } - leaf qos { - description "The unique identifier of the QoS entry for this port."; - status deprecated; - type yang:uuid; - } - list qos-entry { key "qos-key"; max-elements 1; diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosUpdateCommand.java index effb4e06b..cea65595d 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosUpdateCommand.java @@ -85,8 +85,6 @@ public class QosUpdateCommand implements TransactCommand { if (queue.getQueueRef() != null) { newQueueList.put(queue.getQueueNumber(), new UUID(getQueueUuid(queue.getQueueRef(), operNode))); - } else if (queue.getQueueUuid() != null) { - newQueueList.put(queue.getQueueNumber(), new UUID(queue.getQueueUuid().getValue())); } } } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointUpdateCommand.java index 7ffc21f25..b027cb1ab 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointUpdateCommand.java @@ -37,7 +37,6 @@ import org.opendaylight.ovsdb.southbound.SouthboundConstants; import org.opendaylight.ovsdb.southbound.SouthboundProvider; import org.opendaylight.ovsdb.utils.yang.YangUtils; 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.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbPortInterfaceAttributes.VlanMode; @@ -187,13 +186,6 @@ public class TerminationPointUpdateCommand implements TransactCommand { uuidSet.add(new UUID(SouthboundConstants.QOS_NAMED_UUID_PREFIX + TransactUtils.bytesToHexString(qosId.getValue().getBytes()))); } - } else { - // Second check if Qos is present and use that (deprecated) - // Do not bother to check if QosEntry and Qos are consistent if both are present - Uuid qosUuid = terminationPoint.getQos(); - if (qosUuid != null) { - uuidSet.add(new UUID(qosUuid.getValue())); - } } port.setQos(uuidSet); } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbPortUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbPortUpdateCommand.java index 6510b2d38..6cf93acb8 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbPortUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbPortUpdateCommand.java @@ -351,7 +351,6 @@ public class OvsdbPortUpdateCommand extends AbstractTransactionCommand { Collection qosUuidCol = port.getValue().getQosColumn().getData(); if (!qosUuidCol.isEmpty()) { UUID qosUuid = qosUuidCol.iterator().next(); - ovsdbTerminationPointBuilder.setQos(new Uuid(qosUuid.toString())); NodeId nodeId = node.getNodeId(); OvsdbNodeAugmentation ovsdbNode = node.getAugmentation(OvsdbNodeAugmentation.class); @@ -368,7 +367,6 @@ public class OvsdbPortUpdateCommand extends AbstractTransactionCommand { .augmentation(OvsdbTerminationPointAugmentation.class) .child(QosEntry.class, new QosEntryKey(new Long(SouthboundConstants.PORT_QOS_LIST_KEY))); -// new QosEntryKey(new OvsdbQosRef(oldQosIid))); transaction.delete(LogicalDatastoreType.OPERATIONAL, oldPortQosIid); } } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbQosUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbQosUpdateCommand.java index 916874f59..f14c11e90 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbQosUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbQosUpdateCommand.java @@ -323,9 +323,9 @@ public class OvsdbQosUpdateCommand extends AbstractTransactionCommand { newQueueList.add( new QueueListBuilder() .setQueueNumber(queueEntry.getKey()) - .setQueueRef(new OvsdbQueueRef(queueIid)) - .setQueueUuid(new Uuid(queueEntry.getValue().toString())).build()); + .setQueueRef(new OvsdbQueueRef(queueIid)).build()); } + } qosEntryBuilder.setQueueList(newQueueList); } 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 08e276a90..a182c7b78 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 @@ -48,6 +48,7 @@ import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; import org.opendaylight.controller.mdsal.it.base.AbstractMdsalTestBase; import org.opendaylight.ovsdb.lib.notation.Version; +import org.opendaylight.ovsdb.schema.openvswitch.Queue; import org.opendaylight.ovsdb.southbound.SouthboundConstants; import org.opendaylight.ovsdb.southbound.SouthboundMapper; import org.opendaylight.ovsdb.southbound.SouthboundUtil; @@ -67,6 +68,7 @@ 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.OvsdbFailModeBase; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeRef; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbQueueRef; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbPortInterfaceAttributes.VlanMode; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder; @@ -186,6 +188,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { private static final NotifyingDataChangeListener OPERATIONAL_LISTENER = new NotifyingDataChangeListener(LogicalDatastoreType.OPERATIONAL); + private static class NotifyingDataChangeListener implements DataChangeListener { private final LogicalDatastoreType type; private final Set> createdIids = new HashSet<>(); @@ -1131,6 +1134,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { private static class TestQueue implements AutoCloseable { private final ConnectionInfo connectionInfo; private final Uri queueId; + private final InstanceIdentifier qIid; /** * Creates a test queue entry which can be automatically removed when no longer necessary. @@ -1155,7 +1159,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { .setQueuesExternalIds(externalIds) .setQueuesOtherConfig(otherConfigs) .build(); - InstanceIdentifier qIid = SouthboundUtils.createInstanceIdentifier(connectionInfo) + qIid = SouthboundUtils.createInstanceIdentifier(connectionInfo) .augmentation(OvsdbNodeAugmentation.class) .child(Queues.class, queue.getKey()); final NotifyingDataChangeListener queueOperationalListener = @@ -1173,6 +1177,9 @@ public class SouthboundIT extends AbstractMdsalTestBase { } } + public InstanceIdentifier getInstanceIdentifier() { + return qIid; + } @Override public void close() { InstanceIdentifier qIid = SouthboundUtils.createInstanceIdentifier(connectionInfo) @@ -1956,17 +1963,14 @@ public class SouthboundIT extends AbstractMdsalTestBase { createGenericOvsdbTerminationPointAugmentationBuilder(); String portName = "testTerminationPointQos"; ovsdbTerminationBuilder.setName(portName); - ovsdbTerminationBuilder.setQos(qosUuid); Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder)); - // READ and check that qos uuid has been added to the port + + // 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); - OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = - terminationPoint.getAugmentation(OvsdbTerminationPointAugmentation.class); - Assert.assertEquals(ovsdbTerminationPointAugmentation.getQos(), qosUuid); // UPDATE - remove the qos entry from the port OvsdbTerminationPointAugmentationBuilder tpUpdateAugmentationBuilder = @@ -1986,9 +1990,6 @@ public class SouthboundIT extends AbstractMdsalTestBase { // READ and verify that qos uuid has been removed from port TerminationPoint terminationPointUpdate = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, tpEntryIid); Assert.assertNotNull(terminationPointUpdate); - OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentationUpdate = - terminationPointUpdate.getAugmentation(OvsdbTerminationPointAugmentation.class); - Assert.assertNull(ovsdbTerminationPointAugmentationUpdate.getQos()); // DELETE handled by TestBridge } @@ -2491,18 +2492,23 @@ public class SouthboundIT extends AbstractMdsalTestBase { // configuration of the Qos row. OvsdbNodeAugmentation ovsdbNodeAugmentation = getOvsdbNode(connectionInfo, LogicalDatastoreType.OPERATIONAL); + Queues operQueue1 = getQueue(new Uri("queue1"), ovsdbNodeAugmentation); + Assert.assertNotNull(operQueue1); - Uuid queue1Uuid = new Uuid(operQueue1.getQueueUuid().getValue()); + + InstanceIdentifier queue1Iid = testQueue1.getInstanceIdentifier(); + OvsdbQueueRef queue1Ref = new OvsdbQueueRef(queue1Iid); + Queues operQueue2 = getQueue(new Uri("queue2"), ovsdbNodeAugmentation); Assert.assertNotNull(operQueue2); - Uuid queue2Uuid = new Uuid(operQueue2.getQueueUuid().getValue()); + InstanceIdentifier queue2Iid = testQueue2.getInstanceIdentifier(); + OvsdbQueueRef queue2Ref = new OvsdbQueueRef(queue2Iid); List queueList = new ArrayList<>(); - queueList.add(new QueueListBuilder().setQueueNumber(new Long("0")) - .setQueueUuid(queue1Uuid).build()); - queueList.add(new QueueListBuilder().setQueueNumber(new Long("1")) - .setQueueUuid(queue2Uuid).build()); + queueList.add(new QueueListBuilder().setQueueNumber(new Long("1")).setQueueRef(queue1Ref).build()); + queueList.add(new QueueListBuilder().setQueueNumber(new Long("2")).setQueueRef(queue2Ref).build()); + qosBuilder.setQueueList(queueList); Assert.assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, @@ -2523,7 +2529,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { // DELETE one queue from queue list and check that one remains KeyedInstanceIdentifier qosQueueIid = qosIid - .child(QueueList.class, new QueueListKey(new Long("0"))); + .child(QueueList.class, new QueueListKey(new Long("1"))); Assert.assertTrue(mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, qosQueueIid)); qosOperationalListener.waitForUpdate(OVSDB_UPDATE_TIMEOUT); @@ -2535,10 +2541,11 @@ public class SouthboundIT extends AbstractMdsalTestBase { Assert.assertNotNull(operQos); operQueueList = operQos.getQueueList(); Assert.assertNotNull(operQueueList); + for (QueueList queueEntry : queueList) { - if (queueEntry.getQueueUuid().equals(queue2Uuid)) { + if (queueEntry.getQueueRef().equals(queue2Ref)) { Assert.assertTrue(isQueueInList(operQueueList, queueEntry)); - } else if (queueEntry.getQueueUuid().equals(queue1Uuid)) { + } else if (queueEntry.getQueueRef().equals(queue1Ref)) { Assert.assertFalse(isQueueInList(operQueueList, queueEntry)); } else { Assert.assertTrue("Unknown queue entry in qos queue list", false); @@ -2561,10 +2568,11 @@ public class SouthboundIT extends AbstractMdsalTestBase { } } + + private Boolean isQueueInList(List queueList, QueueList queue) { for (QueueList queueEntry : queueList) { - if (queueEntry.getQueueNumber().equals(queue.getQueueNumber()) - && queueEntry.getQueueUuid().equals(queue.getQueueUuid())) { + if (queueEntry.getQueueNumber().equals(queue.getQueueNumber())&& queueEntry.getQueueRef().equals(queue.getQueueRef())) { return true; } }