Fixing SFC build issues after migration to genius tools-api 13/71813/2
authorFaseela K <[email protected]>
Sat, 5 May 2018 18:50:12 +0000 (00:20 +0530)
committerFaseela K <[email protected]>
Sat, 5 May 2018 20:01:57 +0000 (01:31 +0530)
Change-Id: I0115457e7c1b442aa8d2dabbc44012b7a4b94d89
Signed-off-by: Faseela K <[email protected]>
sfc-classifiers/sfc-scf-openflow/src/test/java/org/opendaylight/sfc/scfofrenderer/listeners/SfcScfOfDataListenerTest.java
sfc-ovs/pom.xml
sfc-ovs/src/test/java/org/opendaylight/sfc/ovs/listener/SfcOvsNodeDataListenerTest.java
sfc-ovs/src/test/java/org/opendaylight/sfc/ovs/listener/SfcOvsSffEntryDataListenerTest.java
sfc-ovs/src/test/java/org/opendaylight/sfc/sfc_ovs/provider/listener/SfcOvsNodeDataListenerTest.java
sfc-ovs/src/test/java/org/opendaylight/sfc/sfc_ovs/provider/listener/SfcOvsSffEntryDataListenerTest.java
sfc-provider/pom.xml
sfc-provider/src/test/java/org/opendaylight/sfc/provider/listeners/ServiceFunctionClassifierListenerTest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/listeners/ServiceFunctionForwarderListenerTest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/listeners/ServiceFunctionListenerTest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/listeners/ServiceFunctionSchedulerTypeListenerTest.java

index bf360cd7a95b4ccbb02ca6187ec1e3336067d80d..b6ef8f2de681974a18f6eabba88484c57944e91d 100644 (file)
@@ -28,6 +28,7 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.scf.rev1407
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.scf.rev140701.service.function.classifiers.service.function.classifier.AclBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.AclBase;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.Ipv4Acl;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
  * Test Suite to test the SfcScfOfDataListener class.
@@ -83,8 +84,8 @@ public class SfcScfOfDataListenerTest {
         when(dataObjectModification.getDataBefore()).thenReturn(null);
         when(dataObjectModification.getDataAfter()).thenReturn(serviceFunctionClassifier);
 
-        collection.add(dataTreeModification);
-        sfcScfOfDataListener.onDataTreeChanged(collection);
+        sfcScfOfDataListener.add(InstanceIdentifier.create(ServiceFunctionClassifier.class),
+                serviceFunctionClassifier);
 
         Thread.sleep(500);
 
@@ -106,8 +107,8 @@ public class SfcScfOfDataListenerTest {
         when(dataObjectModification.getModificationType()).thenReturn(ModificationType.DELETE);
         when(dataObjectModification.getDataBefore()).thenReturn(serviceFunctionClassifier);
 
-        collection.add(dataTreeModification);
-        sfcScfOfDataListener.onDataTreeChanged(collection);
+        sfcScfOfDataListener.remove(InstanceIdentifier.create(ServiceFunctionClassifier.class),
+                serviceFunctionClassifier);
 
         Thread.sleep(500);
 
@@ -141,8 +142,8 @@ public class SfcScfOfDataListenerTest {
         when(dataObjectModification.getDataBefore()).thenReturn(originalServiceFunctionClassifier);
         when(dataObjectModification.getDataAfter()).thenReturn(updatedServiceFunctionClassifier);
 
-        collection.add(dataTreeModification);
-        sfcScfOfDataListener.onDataTreeChanged(collection);
+        sfcScfOfDataListener.update(InstanceIdentifier.create(ServiceFunctionClassifier.class),
+                originalServiceFunctionClassifier, updatedServiceFunctionClassifier);
 
         Thread.sleep(500);
 
index be0dfbbc25ea57aded0c07dc6dbe912395009106..710b42b5f3f877787be10d3be7194077df94bee3 100644 (file)
       <groupId>${project.groupId}</groupId>
       <artifactId>sfc-provider</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.genius</groupId>
+      <artifactId>tools-api</artifactId>
+      <version>${genius.version}</version>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.ovsdb</groupId>
       <artifactId>southbound-impl</artifactId>
index 892e473b8f51cde16c869e968e6b509ab5b88962..d73291120dec58fe9ac5f05a6d1c224b0da4720d 100644 (file)
@@ -123,8 +123,7 @@ public class SfcOvsNodeDataListenerTest extends AbstractDataStoreManager {
         when(dataObjectModification.getDataAfter()).thenReturn(node);
 
         // This will call sfcOvsSffEntryDataListener.add()
-        collection.add(dataTreeModification);
-        sfcOvsNodeDataListener.onDataTreeChanged(collection);
+        sfcOvsNodeDataListener.add(InstanceIdentifier.create(Node.class), node);
 
         ovsdbBridgeId = SfcOvsUtil.getOvsdbAugmentationNodeIdBySff(sff);
         assertNotNull(ovsdbBridgeId);
index d5ca9a0dc51dd40fbb92bf51bd48265918b2d0da..67380d69fca3197800b1758cb6c0f2746e5e62a3 100644 (file)
@@ -104,9 +104,7 @@ public class SfcOvsSffEntryDataListenerTest extends AbstractDataStoreManager {
         when(dataObjectModification.getDataBefore()).thenReturn(null);
         when(dataObjectModification.getDataAfter()).thenReturn(sff);
 
-        // This will call sfcOvsSffEntryDataListener.add()
-        collection.add(dataTreeModification);
-        sfcOvsSffEntryDataListener.onDataTreeChanged(collection);
+        sfcOvsSffEntryDataListener.add(InstanceIdentifier.create(ServiceFunctionForwarder.class), sff);
 
         NodeId ovsdbBridgeId = SfcOvsUtil.getOvsdbAugmentationNodeIdBySff(sff);
         // The DPL is used to lookup the topology node
@@ -129,9 +127,7 @@ public class SfcOvsSffEntryDataListenerTest extends AbstractDataStoreManager {
         when(dataObjectModification.getDataBefore()).thenReturn(null);
         when(dataObjectModification.getDataAfter()).thenReturn(sff);
 
-        // This will call sfcOvsSffEntryDataListener.add()
-        collection.add(dataTreeModification);
-        sfcOvsSffEntryDataListener.onDataTreeChanged(collection);
+        sfcOvsSffEntryDataListener.add(InstanceIdentifier.create(ServiceFunctionForwarder.class), sff);
 
         NodeId ovsdbBridgeId = SfcOvsUtil.getOvsdbAugmentationNodeIdBySff(sff);
         assertNotNull(ovsdbBridgeId);
@@ -159,9 +155,7 @@ public class SfcOvsSffEntryDataListenerTest extends AbstractDataStoreManager {
         when(dataObjectModification.getDataBefore()).thenReturn(null);
         when(dataObjectModification.getDataAfter()).thenReturn(sff);
 
-        // This will call sfcOvsSffEntryDataListener.add()
-        collection.add(dataTreeModification);
-        sfcOvsSffEntryDataListener.onDataTreeChanged(collection);
+        sfcOvsSffEntryDataListener.add(InstanceIdentifier.create(ServiceFunctionForwarder.class), sff);
 
         NodeId ovsdbBridgeId = SfcOvsUtil.getOvsdbAugmentationNodeIdBySff(sff);
         assertNotNull(ovsdbBridgeId);
@@ -175,9 +169,7 @@ public class SfcOvsSffEntryDataListenerTest extends AbstractDataStoreManager {
         when(dataObjectModification.getModificationType()).thenReturn(ModificationType.DELETE);
         when(dataObjectModification.getDataBefore()).thenReturn(sff);
 
-        // This will call sfcOvsSffEntryDataListener.remove()
-        collection.add(dataTreeModification);
-        sfcOvsSffEntryDataListener.onDataTreeChanged(collection);
+        sfcOvsSffEntryDataListener.remove(InstanceIdentifier.create(ServiceFunctionForwarder.class), sff);
 
         ovsdbBridgeId = SfcOvsUtil.getOvsdbAugmentationNodeIdBySff(sff);
         assertNull(getSffTerminationPoint(ovsdbBridgeId, sff));
@@ -200,9 +192,7 @@ public class SfcOvsSffEntryDataListenerTest extends AbstractDataStoreManager {
         when(dataObjectModification.getDataBefore()).thenReturn(null);
         when(dataObjectModification.getDataAfter()).thenReturn(originalSff);
 
-        // This will call sfcOvsSffEntryDataListener.add()
-        collection.add(dataTreeModification);
-        sfcOvsSffEntryDataListener.onDataTreeChanged(collection);
+        sfcOvsSffEntryDataListener.add(InstanceIdentifier.create(ServiceFunctionForwarder.class), originalSff);
 
         NodeId ovsdbBridgeId = SfcOvsUtil.getOvsdbAugmentationNodeIdBySff(originalSff);
         assertNull(ovsdbBridgeId);
@@ -223,9 +213,8 @@ public class SfcOvsSffEntryDataListenerTest extends AbstractDataStoreManager {
         when(dataObjectModification.getDataBefore()).thenReturn(originalSff);
         when(dataObjectModification.getDataAfter()).thenReturn(updatedSff);
 
-        // This will call sfcOvsSffEntryDataListener.update()
-        collection.add(dataTreeModification);
-        sfcOvsSffEntryDataListener.onDataTreeChanged(collection);
+        sfcOvsSffEntryDataListener.update(InstanceIdentifier.create(ServiceFunctionForwarder.class),
+                originalSff, updatedSff);
 
         ovsdbBridgeId = SfcOvsUtil.getOvsdbAugmentationNodeIdBySff(updatedSff);
         assertNotNull(ovsdbBridgeId);
index 0b03376fee620db0ea4a5c8dc2d5149b82397506..3255cc82d43f30d1645cd1b3071e91fcdcec3ed0 100644 (file)
@@ -127,8 +127,7 @@ public class SfcOvsNodeDataListenerTest extends AbstractDataStoreManager {
         when(dataObjectModification.getDataAfter()).thenReturn(node);
 
         // This will call sfcOvsSffEntryDataListener.add()
-        collection.add(dataTreeModification);
-        sfcOvsNodeDataListener.onDataTreeChanged(collection);
+        sfcOvsNodeDataListener.add(InstanceIdentifier.create(Node.class), node);
 
         ovsdbBridgeId = SfcOvsUtil.getOvsdbAugmentationNodeIdBySff(sff);
         assertNotNull(ovsdbBridgeId);
index 27dce01e0f514192965eb9a0510b2ce9f63f6055..a562a8687a94b29404e70f82ad418cbb53b5519a 100644 (file)
@@ -105,9 +105,7 @@ public class SfcOvsSffEntryDataListenerTest extends AbstractDataStoreManager {
         when(dataObjectModification.getDataBefore()).thenReturn(null);
         when(dataObjectModification.getDataAfter()).thenReturn(sff);
 
-        // This will call sfcOvsSffEntryDataListener.add()
-        collection.add(dataTreeModification);
-        sfcOvsSffEntryDataListener.onDataTreeChanged(collection);
+        sfcOvsSffEntryDataListener.add(InstanceIdentifier.create(ServiceFunctionForwarder.class), sff);
 
         NodeId ovsdbBridgeId = SfcOvsUtil.getOvsdbAugmentationNodeIdBySff(sff);
         // The DPL is used to lookup the topology node
@@ -130,9 +128,7 @@ public class SfcOvsSffEntryDataListenerTest extends AbstractDataStoreManager {
         when(dataObjectModification.getDataBefore()).thenReturn(null);
         when(dataObjectModification.getDataAfter()).thenReturn(sff);
 
-        // This will call sfcOvsSffEntryDataListener.add()
-        collection.add(dataTreeModification);
-        sfcOvsSffEntryDataListener.onDataTreeChanged(collection);
+        sfcOvsSffEntryDataListener.add(InstanceIdentifier.create(ServiceFunctionForwarder.class), sff);
 
         NodeId ovsdbBridgeId = SfcOvsUtil.getOvsdbAugmentationNodeIdBySff(sff);
         assertNotNull(ovsdbBridgeId);
@@ -160,9 +156,7 @@ public class SfcOvsSffEntryDataListenerTest extends AbstractDataStoreManager {
         when(dataObjectModification.getDataBefore()).thenReturn(null);
         when(dataObjectModification.getDataAfter()).thenReturn(sff);
 
-        // This will call sfcOvsSffEntryDataListener.add()
-        collection.add(dataTreeModification);
-        sfcOvsSffEntryDataListener.onDataTreeChanged(collection);
+        sfcOvsSffEntryDataListener.add(InstanceIdentifier.create(ServiceFunctionForwarder.class), sff);
 
         NodeId ovsdbBridgeId = SfcOvsUtil.getOvsdbAugmentationNodeIdBySff(sff);
         assertNotNull(ovsdbBridgeId);
@@ -176,9 +170,7 @@ public class SfcOvsSffEntryDataListenerTest extends AbstractDataStoreManager {
         when(dataObjectModification.getModificationType()).thenReturn(ModificationType.DELETE);
         when(dataObjectModification.getDataBefore()).thenReturn(sff);
 
-        // This will call sfcOvsSffEntryDataListener.remove()
-        collection.add(dataTreeModification);
-        sfcOvsSffEntryDataListener.onDataTreeChanged(collection);
+        sfcOvsSffEntryDataListener.remove(InstanceIdentifier.create(ServiceFunctionForwarder.class), sff);
 
         ovsdbBridgeId = SfcOvsUtil.getOvsdbAugmentationNodeIdBySff(sff);
         assertNull(getSffTerminationPoint(ovsdbBridgeId, sff));
@@ -201,9 +193,7 @@ public class SfcOvsSffEntryDataListenerTest extends AbstractDataStoreManager {
         when(dataObjectModification.getDataBefore()).thenReturn(null);
         when(dataObjectModification.getDataAfter()).thenReturn(originalSff);
 
-        // This will call sfcOvsSffEntryDataListener.add()
-        collection.add(dataTreeModification);
-        sfcOvsSffEntryDataListener.onDataTreeChanged(collection);
+        sfcOvsSffEntryDataListener.add(InstanceIdentifier.create(ServiceFunctionForwarder.class), originalSff);
 
         NodeId ovsdbBridgeId = SfcOvsUtil.getOvsdbAugmentationNodeIdBySff(originalSff);
         assertNull(ovsdbBridgeId);
@@ -224,9 +214,8 @@ public class SfcOvsSffEntryDataListenerTest extends AbstractDataStoreManager {
         when(dataObjectModification.getDataBefore()).thenReturn(originalSff);
         when(dataObjectModification.getDataAfter()).thenReturn(updatedSff);
 
-        // This will call sfcOvsSffEntryDataListener.update()
-        collection.add(dataTreeModification);
-        sfcOvsSffEntryDataListener.onDataTreeChanged(collection);
+        sfcOvsSffEntryDataListener.update(InstanceIdentifier.create(ServiceFunctionForwarder.class),
+                originalSff, updatedSff);
 
         ovsdbBridgeId = SfcOvsUtil.getOvsdbAugmentationNodeIdBySff(updatedSff);
         assertNotNull(ovsdbBridgeId);
index 1e31c462db8c62bb799f24056f0409a4fe6d22c0..157e03aa502b3712aa46e3acdf1c66f977a1947d 100644 (file)
@@ -45,6 +45,7 @@
         <dependency>
             <groupId>org.opendaylight.genius</groupId>
             <artifactId>tools-api</artifactId>
+            <version>${genius.version}</version>
         </dependency>
 
         <!-- Testing dependencies -->
index 88fb30218d48a231ca4bc4d6ce77a8e5dff5cc6b..3c11e8fb408585b470fe38e286f20f55a5567898 100644 (file)
@@ -34,6 +34,7 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.scf.rev1407
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.scf.rev140701.service.function.classifiers.service.function.classifier.AclBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.AclBase;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.Ipv4Acl;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
  * Test Suite to test the ServiceFunctionClassifierListener class.
@@ -85,8 +86,8 @@ public class ServiceFunctionClassifierListenerTest extends AbstractDataStoreMana
         when(dataObjectModification.getDataBefore()).thenReturn(null);
         when(dataObjectModification.getDataAfter()).thenReturn(serviceFunctionClassifier);
 
-        collection.add(dataTreeModification);
-        serviceFunctionClassifierListener.onDataTreeChanged(collection);
+        serviceFunctionClassifierListener.add(InstanceIdentifier.create(ServiceFunctionClassifier.class),
+                serviceFunctionClassifier);
 
         Thread.sleep(500);
 
@@ -129,8 +130,8 @@ public class ServiceFunctionClassifierListenerTest extends AbstractDataStoreMana
         when(dataObjectModification.getModificationType()).thenReturn(ModificationType.DELETE);
         when(dataObjectModification.getDataBefore()).thenReturn(serviceFunctionClassifier);
 
-        collection.add(dataTreeModification);
-        serviceFunctionClassifierListener.onDataTreeChanged(collection);
+        serviceFunctionClassifierListener.remove(InstanceIdentifier.create(ServiceFunctionClassifier.class),
+                serviceFunctionClassifier);
 
         Thread.sleep(500);
 
@@ -184,8 +185,8 @@ public class ServiceFunctionClassifierListenerTest extends AbstractDataStoreMana
 
         // The listener will update the original <ACL, Classifier> entry into
         // ACL
-        collection.add(dataTreeModification);
-        serviceFunctionClassifierListener.onDataTreeChanged(collection);
+        serviceFunctionClassifierListener.update(InstanceIdentifier.create(ServiceFunctionClassifier.class),
+                originalServiceFunctionClassifier, updatedServiceFunctionClassifier);
         Thread.sleep(500);
 
         // We verify the removal of the Original <ACL, Classifier> entry from
index b2682dbf1da1022e42ea50b8b9c8b2cfb487f185..5714d4e1453ef28ca226abe9e28ffd4a901f3243 100644 (file)
@@ -84,6 +84,7 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev14070
 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.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
  * Test Suite to test the ServiceFunctionForwarderListener class.
@@ -128,8 +129,8 @@ public class ServiceFunctionForwarderListenerTest extends AbstractDataStoreManag
         when(dataObjectModification.getDataBefore()).thenReturn(null);
         when(dataObjectModification.getDataAfter()).thenReturn(serviceFunctionForwarder);
 
-        collection.add(dataTreeModification);
-        serviceFunctionForwarderListener.onDataTreeChanged(collection);
+        serviceFunctionForwarderListener.add(InstanceIdentifier.create(ServiceFunctionForwarder.class),
+                serviceFunctionForwarder);
     }
 
     /**
@@ -145,8 +146,8 @@ public class ServiceFunctionForwarderListenerTest extends AbstractDataStoreManag
         when(dataObjectModification.getModificationType()).thenReturn(ModificationType.DELETE);
         when(dataObjectModification.getDataBefore()).thenReturn(serviceFunctionForwarder);
 
-        collection.add(dataTreeModification);
-        serviceFunctionForwarderListener.onDataTreeChanged(collection);
+        serviceFunctionForwarderListener.remove(InstanceIdentifier.create(ServiceFunctionForwarder.class),
+                serviceFunctionForwarder);
     }
 
     /**
@@ -176,8 +177,8 @@ public class ServiceFunctionForwarderListenerTest extends AbstractDataStoreManag
         when(dataObjectModification.getDataBefore()).thenReturn(serviceFunctionForwarder);
 
         // The listener will remove the Service Function Forwarder Entry
-        collection.add(dataTreeModification);
-        serviceFunctionForwarderListener.onDataTreeChanged(collection);
+        serviceFunctionForwarderListener.remove(InstanceIdentifier.create(ServiceFunctionForwarder.class),
+                serviceFunctionForwarder);
         // Verify that SFP was removed
         assertNull(SfcProviderServicePathAPI.readServiceFunctionPath(
                 renderedServicePath.getParentServiceFunctionPath()));
@@ -222,8 +223,8 @@ public class ServiceFunctionForwarderListenerTest extends AbstractDataStoreManag
 
         // The listener will remove the Original Service Function Forwarder
         // Entry and associated RSPs
-        collection.add(dataTreeModification);
-        serviceFunctionForwarderListener.onDataTreeChanged(collection);
+        serviceFunctionForwarderListener.update(InstanceIdentifier.create(ServiceFunctionForwarder.class),
+                originalServiceFunctionForwarder, updatedServiceFunctionForwarder);
         assertNull(SfcProviderServicePathAPI.readServiceFunctionPath(
                 renderedServicePath.getParentServiceFunctionPath()));
 
@@ -273,8 +274,8 @@ public class ServiceFunctionForwarderListenerTest extends AbstractDataStoreManag
 
         // The listener will remove the Original Service Function Forwarder
         // Entry and associated RSPs
-        collection.add(dataTreeModification);
-        serviceFunctionForwarderListener.onDataTreeChanged(collection);
+        serviceFunctionForwarderListener.update(InstanceIdentifier.create(ServiceFunctionForwarder.class),
+                originalServiceFunctionForwarder, updatedServiceFunctionForwarder);
         assertNull(SfcProviderServicePathAPI.readServiceFunctionPath(
                 renderedServicePath.getParentServiceFunctionPath()));
 
@@ -324,8 +325,8 @@ public class ServiceFunctionForwarderListenerTest extends AbstractDataStoreManag
         when(dataObjectModification.getDataAfter()).thenReturn(updatedServiceFunctionForwarder);
 
         // The listener will NOT remove the RSP
-        collection.add(dataTreeModification);
-        serviceFunctionForwarderListener.onDataTreeChanged(collection);
+        serviceFunctionForwarderListener.update(InstanceIdentifier.create(ServiceFunctionForwarder.class),
+                originalServiceFunctionForwarder, updatedServiceFunctionForwarder);
         assertNotNull(SfcProviderRenderedPathAPI.readRenderedServicePath(renderedServicePath.getName()));
 
         // Verify that State was NOT removed
@@ -339,7 +340,8 @@ public class ServiceFunctionForwarderListenerTest extends AbstractDataStoreManag
         when(dataObjectModification.getDataAfter()).thenReturn(updatedServiceFunctionForwarder);
 
         // The listener will NOT remove the RSP
-        serviceFunctionForwarderListener.onDataTreeChanged(collection);
+        serviceFunctionForwarderListener.update(InstanceIdentifier.create(ServiceFunctionForwarder.class),
+                originalServiceFunctionForwarder, updatedServiceFunctionForwarder);
         assertNotNull(SfcProviderRenderedPathAPI.readRenderedServicePath(renderedServicePath.getName()));
 
         // Verify that State was NOT removed
@@ -389,8 +391,8 @@ public class ServiceFunctionForwarderListenerTest extends AbstractDataStoreManag
         when(dataObjectModification.getDataAfter()).thenReturn(updatedServiceFunctionForwarder);
 
         // The listener will remove the SFP
-        collection.add(dataTreeModification);
-        serviceFunctionForwarderListener.onDataTreeChanged(collection);
+        serviceFunctionForwarderListener.update(InstanceIdentifier.create(ServiceFunctionForwarder.class),
+                originalServiceFunctionForwarder, updatedServiceFunctionForwarder);
         assertNull(SfcProviderServicePathAPI.readServiceFunctionPath(
                 renderedServicePath.getParentServiceFunctionPath()));
 
@@ -439,8 +441,8 @@ public class ServiceFunctionForwarderListenerTest extends AbstractDataStoreManag
         when(dataObjectModification.getDataAfter()).thenReturn(updatedServiceFunctionForwarder);
 
         // The listener will remove the SFP
-        collection.add(dataTreeModification);
-        serviceFunctionForwarderListener.onDataTreeChanged(collection);
+        serviceFunctionForwarderListener.update(InstanceIdentifier.create(ServiceFunctionForwarder.class),
+                originalServiceFunctionForwarder, updatedServiceFunctionForwarder);
         assertNull(SfcProviderServicePathAPI.readServiceFunctionPath(
                 renderedServicePath.getParentServiceFunctionPath()));
 
@@ -491,8 +493,8 @@ public class ServiceFunctionForwarderListenerTest extends AbstractDataStoreManag
         when(dataObjectModification.getDataAfter()).thenReturn(updatedServiceFunctionForwarder);
 
         // The listener will NOT remove the RSP
-        collection.add(dataTreeModification);
-        serviceFunctionForwarderListener.onDataTreeChanged(collection);
+        serviceFunctionForwarderListener.update(InstanceIdentifier.create(ServiceFunctionForwarder.class),
+                originalServiceFunctionForwarder, updatedServiceFunctionForwarder);
         Thread.sleep(500);
         assertNotNull(SfcProviderRenderedPathAPI.readRenderedServicePath(renderedServicePath.getName()));
 
@@ -539,8 +541,8 @@ public class ServiceFunctionForwarderListenerTest extends AbstractDataStoreManag
         when(dataObjectModification.getDataAfter()).thenReturn(updatedServiceFunctionForwarder);
 
         // The listener will remove the SFP
-        collection.add(dataTreeModification);
-        serviceFunctionForwarderListener.onDataTreeChanged(collection);
+        serviceFunctionForwarderListener.update(InstanceIdentifier.create(ServiceFunctionForwarder.class),
+                originalServiceFunctionForwarder, updatedServiceFunctionForwarder);
         assertNull(SfcProviderServicePathAPI.readServiceFunctionPath(
                 renderedServicePath.getParentServiceFunctionPath()));
 
index e513636e49f534352ea5bff2a0f579f0a040761f..30a54e0c648ec57bbc4eac16211a0f54566f9106 100644 (file)
@@ -81,6 +81,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 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.yangtools.yang.binding.InstanceIdentifier;
 
 /**
  * Test Suite to test the ServiceFunctionListener class.
@@ -124,8 +125,7 @@ public class ServiceFunctionListenerTest extends AbstractDataStoreManager {
         when(dataObjectModification.getDataBefore()).thenReturn(null);
         when(dataObjectModification.getDataAfter()).thenReturn(serviceFunction);
 
-        collection.add(dataTreeModification);
-        serviceFunctionListener.onDataTreeChanged(collection);
+        serviceFunctionListener.add(InstanceIdentifier.create(ServiceFunction.class), serviceFunction);
 
         SftServiceFunctionName sftServiceFunctionName = SfcProviderServiceTypeAPI
                 .readServiceFunctionTypeEntry(serviceFunction);
@@ -150,8 +150,7 @@ public class ServiceFunctionListenerTest extends AbstractDataStoreManager {
         when(dataObjectModification.getModificationType()).thenReturn(ModificationType.DELETE);
         when(dataObjectModification.getDataBefore()).thenReturn(serviceFunction);
 
-        collection.add(dataTreeModification);
-        serviceFunctionListener.onDataTreeChanged(collection);
+        serviceFunctionListener.remove(InstanceIdentifier.create(ServiceFunction.class), serviceFunction);
 
         assertNull(SfcProviderServiceTypeAPI.readServiceFunctionTypeEntry(serviceFunction));
     }
@@ -184,8 +183,9 @@ public class ServiceFunctionListenerTest extends AbstractDataStoreManager {
 
         // The listener will remove the Original Service Function Type Entry and
         // create a new one with the new type
-        collection.add(dataTreeModification);
-        serviceFunctionListener.onDataTreeChanged(collection);
+        serviceFunctionListener.update(InstanceIdentifier.create(ServiceFunction.class),
+                originalServiceFunction, updatedServiceFunction);
+
         assertNull(SfcProviderServiceTypeAPI.readServiceFunctionTypeEntry(originalServiceFunction));
         assertNotNull(SfcProviderServiceTypeAPI.readServiceFunctionTypeEntry(updatedServiceFunction));
         // Clean-up
@@ -219,8 +219,8 @@ public class ServiceFunctionListenerTest extends AbstractDataStoreManager {
         when(dataObjectModification.getDataBefore()).thenReturn(serviceFunction);
 
         // The listener will remove the Service Function Type Entry
-        collection.add(dataTreeModification);
-        serviceFunctionListener.onDataTreeChanged(collection);
+        serviceFunctionListener.remove(InstanceIdentifier.create(ServiceFunction.class), serviceFunction);
+
         assertNull(SfcProviderServicePathAPI.readServiceFunctionPath(
                 renderedServicePath.getParentServiceFunctionPath()));
         List<RspName> rspNameList = SfcProviderServiceFunctionAPI.getRspsBySfName(serviceFunction.getName());
@@ -278,8 +278,9 @@ public class ServiceFunctionListenerTest extends AbstractDataStoreManager {
 
         // The listener will remove the Original Service Function Type Entry and
         // create a new one with the new type
-        collection.add(dataTreeModification);
-        serviceFunctionListener.onDataTreeChanged(collection);
+        serviceFunctionListener.update(InstanceIdentifier.create(ServiceFunction.class),
+                originalServiceFunction, updatedServiceFunction);
+
         // The original SF type is only deleted if the SF type changes
         assertNotNull(SfcProviderServiceTypeAPI.readServiceFunctionTypeEntry(originalServiceFunction));
         assertNotNull(SfcProviderServiceTypeAPI.readServiceFunctionTypeEntry(updatedServiceFunction));
@@ -338,8 +339,9 @@ public class ServiceFunctionListenerTest extends AbstractDataStoreManager {
 
         // The listener will remove the Original Service Function Type Entry and
         // create a new one with the new type
-        collection.add(dataTreeModification);
-        serviceFunctionListener.onDataTreeChanged(collection);
+        serviceFunctionListener.update(InstanceIdentifier.create(ServiceFunction.class),
+                originalServiceFunction, updatedServiceFunction);
+
         assertNull(SfcProviderServiceTypeAPI.readServiceFunctionTypeEntry(originalServiceFunction));
         assertNotNull(SfcProviderServiceTypeAPI.readServiceFunctionTypeEntry(updatedServiceFunction));
         assertNull(SfcProviderServicePathAPI.readServiceFunctionPath(
@@ -397,8 +399,9 @@ public class ServiceFunctionListenerTest extends AbstractDataStoreManager {
 
         // The listener will remove the Original Service Function Type Entry and
         // create a new one with the new type
-        collection.add(dataTreeModification);
-        serviceFunctionListener.onDataTreeChanged(collection);
+        serviceFunctionListener.update(InstanceIdentifier.create(ServiceFunction.class),
+                originalServiceFunction, updatedServiceFunction);
+
         // The original SF type is only deleted if the SF type changes
         assertNotNull(SfcProviderServiceTypeAPI.readServiceFunctionTypeEntry(originalServiceFunction));
         assertNotNull(SfcProviderServiceTypeAPI.readServiceFunctionTypeEntry(updatedServiceFunction));
@@ -456,8 +459,9 @@ public class ServiceFunctionListenerTest extends AbstractDataStoreManager {
         when(dataObjectModification.getDataAfter()).thenReturn(updatedServiceFunction);
 
         // The listener will NOT remove anything
-        collection.add(dataTreeModification);
-        serviceFunctionListener.onDataTreeChanged(collection);
+        serviceFunctionListener.update(InstanceIdentifier.create(ServiceFunction.class),
+                originalServiceFunction, updatedServiceFunction);
+
         // The original SF type is only deleted if the SF type changes
         assertNotNull(SfcProviderServiceTypeAPI.readServiceFunctionTypeEntry(originalServiceFunction));
         assertNotNull(SfcProviderServiceTypeAPI.readServiceFunctionTypeEntry(updatedServiceFunction));
index 40056b8cccd880b4b54f4308b97425b3f8953e43..f0006cd1b132417739c5bb596be584cc037a16b5 100644 (file)
@@ -35,6 +35,7 @@ import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150
 import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.service.function.scheduler.types.ServiceFunctionSchedulerType;
 import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.service.function.scheduler.types.ServiceFunctionSchedulerTypeBuilder;
 import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.service.function.scheduler.types.ServiceFunctionSchedulerTypeKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
  * Test Suite to test the ServiceFunctionSchedulerTypeListener class.
@@ -97,8 +98,9 @@ public class ServiceFunctionSchedulerTypeListenerTest extends AbstractDataStoreM
         when(dataObjectModification.getModificationType()).thenReturn(ModificationType.WRITE);
         when(dataObjectModification.getDataBefore()).thenReturn(null);
         when(dataObjectModification.getDataAfter()).thenReturn(serviceFunctionSchedulerType);
-        collection.add(dataTreeModification);
-        serviceFunctionSchedulerTypeListener.onDataTreeChanged(collection);
+
+        serviceFunctionSchedulerTypeListener.add(InstanceIdentifier.create(ServiceFunctionSchedulerType.class),
+                serviceFunctionSchedulerType);
 
         Thread.sleep(500);
 
@@ -134,8 +136,9 @@ public class ServiceFunctionSchedulerTypeListenerTest extends AbstractDataStoreM
         when(dataTreeModification.getRootNode()).thenReturn(dataObjectModification);
         when(dataObjectModification.getModificationType()).thenReturn(ModificationType.DELETE);
         when(dataObjectModification.getDataBefore()).thenReturn(serviceFunctionSchedulerType);
-        collection.add(dataTreeModification);
-        serviceFunctionSchedulerTypeListener.onDataTreeChanged(collection);
+
+        serviceFunctionSchedulerTypeListener.remove(InstanceIdentifier.create(ServiceFunctionSchedulerType.class),
+                serviceFunctionSchedulerType);
 
         Thread.sleep(500);
 
@@ -181,8 +184,9 @@ public class ServiceFunctionSchedulerTypeListenerTest extends AbstractDataStoreM
         when(dataObjectModification.getModificationType()).thenReturn(ModificationType.SUBTREE_MODIFIED);
         when(dataObjectModification.getDataBefore()).thenReturn(originalServiceFunctionSchedulerType);
         when(dataObjectModification.getDataAfter()).thenReturn(updatedServiceFunctionSchedulerType);
-        collection.add(dataTreeModification);
-        serviceFunctionSchedulerTypeListener.onDataTreeChanged(collection);
+
+        serviceFunctionSchedulerTypeListener.update(InstanceIdentifier.create(ServiceFunctionSchedulerType.class),
+                originalServiceFunctionSchedulerType, updatedServiceFunctionSchedulerType);
 
         Thread.sleep(500);