Removed methods containing reflection 89/28389/4
authorMartin Sunal <[email protected]>
Wed, 14 Oct 2015 12:30:14 +0000 (14:30 +0200)
committerMartin Sunal <[email protected]>
Thu, 15 Oct 2015 15:06:02 +0000 (17:06 +0200)
- removed all methods with name *Executor
- removed SfcProviderAbstractAPI which is not needed anymore

Change-Id: Ib7f0e2ad3ad5c43f4d06b3c93363eee0b2070ea2
Signed-off-by: Martin Sunal <[email protected]>
60 files changed:
sfc-netconf/src/main/java/org/opendaylight/sfc/sfc_netconf/provider/listener/SfcNetconfNodeDataListener.java
sfc-netconf/src/test/java/org/opendaylight/sfc/sfc_netconf/provider/api/SfcNetconfServiceFunctionAPITest.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcProviderRpc.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcProviderScfEntryDataListener.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcProviderSfEntryDataListener.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcProviderSffEntryDataListener.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcProviderSfstEntryDataListener.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcReflection.java [deleted file]
sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcProviderAbstractAPI.java [deleted file]
sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcProviderAclAPI.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcProviderRenderedPathAPI.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcProviderScheduleTypeAPI.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcProviderServiceChainAPI.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcProviderServiceClassifierAPI.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcProviderServiceForwarderAPI.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcProviderServiceFunctionAPI.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcProviderServiceFunctionGroupAPI.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcProviderServiceFunctionGroupAlgAPI.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcProviderServiceFunctionMetadataAPI.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcProviderServicePathAPI.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcProviderServiceTypeAPI.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcServiceFunctionLoadBalanceSchedulerAPI.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcServiceFunctionRandomSchedulerAPI.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcServiceFunctionRoundRobinSchedulerAPI.java
sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcServiceFunctionShortestPathSchedulerAPI.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/SfcProviderRpcTest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/SfcProviderSfEntryDataListenerTest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/SfcProviderSffEntryDataListenerTest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/SfcProviderSfstEntryDataListenerTest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/api/AbstractSfcRendererServicePathAPITest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/api/SfcProviderAclAPITest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/api/SfcProviderRenderedPathAPITest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/api/SfcProviderScheduleTypeAPITest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/api/SfcProviderServiceChainAPITest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/api/SfcProviderServiceClassifierAPITest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/api/SfcProviderServiceForwarderAPIDictionaryTest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/api/SfcProviderServiceForwarderAPISimpleIPv6GTest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/api/SfcProviderServiceForwarderAPISimpleIPv6Test.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/api/SfcProviderServiceForwarderAPISimpleTest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/api/SfcProviderServiceFunctionAPITest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/api/SfcProviderServiceFunctionGroupAPITest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/api/SfcProviderServiceFunctionMetadataAPITest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/api/SfcProviderServicePathAPITest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/api/SfcProviderServiceTypeAPITest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/api/SfcServiceFunctionLoadBalanceSchedulerAPITest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/api/SfcServiceFunctionSchedulerAPITest.java
sfc-provider/src/test/java/org/opendaylight/sfc/provider/api/SfcServiceFunctionShortestPathSchedulerAPITest.java
sfc-sb-rest/src/main/java/org/opendaylight/sfc/sbrest/provider/listener/SbRestScfEntryDataListener.java
sfc-sb-rest/src/main/java/org/opendaylight/sfc/sbrest/provider/task/SbRestAclTask.java
sfc-sb-rest/src/main/java/org/opendaylight/sfc/sbrest/provider/task/SbRestRspTask.java
sfc-sb-rest/src/main/java/org/opendaylight/sfc/sbrest/provider/task/SbRestSfstateTask.java
sfc-sb-rest/src/test/java/org/opendaylight/sfc/sbrest/provider/task/SbRestAclTaskTest.java
sfc-sb-rest/src/test/java/org/opendaylight/sfc/sbrest/provider/task/SbRestRspTaskTest.java
sfc-sb-rest/src/test/java/org/opendaylight/sfc/sbrest/provider/task/SbRestSfstateTaskTest.java
sfclisp/src/main/java/org/opendaylight/sfc/sfc_lisp/provider/SfcLispUtil.java
sfclisp/src/main/java/org/opendaylight/sfc/sfc_lisp/provider/api/SfcProviderServiceLispAPI.java
sfclisp/src/main/java/org/opendaylight/sfc/sfc_lisp/provider/listener/SfcLispSfEntryDataListener.java
sfclisp/src/main/java/org/opendaylight/sfc/sfc_lisp/provider/listener/SfcLispSffDataListener.java
sfcofl2/src/main/java/org/opendaylight/sfc/l2renderer/SfcL2ProviderUtils.java
sfcofl2/src/main/java/org/opendaylight/sfc/l2renderer/sfg/SfcL2SfgDataListener.java

index 498bb9c0cbdd012fd1df9c1abc242df8474adcad..c3c5dfd6fa73d68afbc955305d5e2f662eac2af8 100755 (executable)
 
 package org.opendaylight.sfc.sfc_netconf.provider.listener;
 
+import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStart;
+import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.sfc.provider.OpendaylightSfc;
 import org.opendaylight.sfc.provider.api.SfcProviderServiceForwarderAPI;
 import org.opendaylight.sfc.provider.api.SfcProviderServiceFunctionAPI;
-import org.opendaylight.sfc.sfc_netconf.provider.api.SfcProviderSfDescriptionMonitorAPI;
 import org.opendaylight.sfc.sfc_netconf.provider.api.SfcNetconfServiceForwarderAPI;
 import org.opendaylight.sfc.sfc_netconf.provider.api.SfcNetconfServiceFunctionAPI;
+import org.opendaylight.sfc.sfc_netconf.provider.api.SfcProviderSfDescriptionMonitorAPI;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.functions.ServiceFunction;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Dpi;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Firewall;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.HttpHeaderEnrichment;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Napt44;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Qos;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.ServiceFunctionTypeIdentity;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.TcpProxy;
 import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.sf.desc.mon.rev141201.service.functions.state.service.function.state.sfc.sf.desc.mon.DescriptionInfo;
 import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.sf.desc.mon.rev141201.service.functions.state.service.function.state.sfc.sf.desc.mon.MonitoringInfo;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
@@ -39,26 +53,12 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.ServiceFunctionTypeIdentity;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Dpi;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Firewall;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.HttpHeaderEnrichment;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Napt44;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Qos;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.TcpProxy;
-import org.opendaylight.yangtools.yang.binding.Identifier;
 import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.Identifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-
-import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStart;
-import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
-
 public class SfcNetconfNodeDataListener extends SfcNetconfAbstractDataListener {
     private static final Logger LOG = LoggerFactory.getLogger(SfcNetconfNodeDataListener.class);
     private static HashMap<String, Class<? extends ServiceFunctionTypeIdentity>> sftMap = new HashMap<String, Class<? extends ServiceFunctionTypeIdentity>>() {{
@@ -193,7 +193,7 @@ public class SfcNetconfNodeDataListener extends SfcNetconfAbstractDataListener {
                                     break;
                                 }
                                 ServiceFunction sf = SfcNetconfServiceFunctionAPI.buildServiceFunctionFromNetconf(nodeName, descInfo.getDataPlaneIp(), descInfo.getDataPlanePort(), sfType);
-                                if (SfcProviderServiceFunctionAPI.putServiceFunctionExecutor(sf)) {
+                                if (SfcProviderServiceFunctionAPI.putServiceFunction(sf)) {
                                     LOG.info("Successfully created SF from Netconf node {}", nodeName);
                                     SfcNetconfServiceFunctionAPI.putServiceFunctionDescription(descInfo, nodeName);
                                     MonitoringInfo monInfo = SfcNetconfServiceFunctionAPI.getServiceFunctionMonitor(nodeName);
@@ -210,7 +210,7 @@ public class SfcNetconfNodeDataListener extends SfcNetconfAbstractDataListener {
                                 thread.start();
                             } else { //SFF
                                 ServiceFunctionForwarder sff = SfcNetconfServiceForwarderAPI.buildServiceForwarderFromNetconf(nodeName, nnode);
-                                if (SfcProviderServiceForwarderAPI.putServiceFunctionForwarderExecutor(sff)) {
+                                if (SfcProviderServiceForwarderAPI.putServiceFunctionForwarder(sff)) {
                                     LOG.info("Successfully created SFF from Netconf node {}", nodeName);
                                 } else {
                                     LOG.error("Failed to create SFF from Netconf node {}", nodeName);
@@ -223,7 +223,7 @@ public class SfcNetconfNodeDataListener extends SfcNetconfAbstractDataListener {
                             // Note that device could jump back and forth between connected and connecting for various reasons:
                             // disconnect from remote device, network connectivity loss etc.
                             LOG.info("Netconf device disconnected, deleting SFF {}", nodeName);
-                            if (SfcProviderServiceForwarderAPI.deleteServiceFunctionForwarderExecutor(nodeName)) {
+                            if (SfcProviderServiceForwarderAPI.deleteServiceFunctionForwarder(nodeName)) {
                                 LOG.info("SFF {} deleted successfully", nodeName);
                             } else {
                                 LOG.error("Failed to delete SFF {}", nodeName);
@@ -233,7 +233,7 @@ public class SfcNetconfNodeDataListener extends SfcNetconfAbstractDataListener {
                         case UnableToConnect: {
                             // Its over for the device, no more reconnects
                             LOG.info("Unable to connected to Netconf device, deleting SFF {}", nodeName);
-                            if (SfcProviderServiceForwarderAPI.deleteServiceFunctionForwarderExecutor(nodeName)) {
+                            if (SfcProviderServiceForwarderAPI.deleteServiceFunctionForwarder(nodeName)) {
                                 LOG.info("SFF {} deleted successfully", nodeName);
                             } else {
                                 LOG.error("Failed to delete SFF {}", nodeName);
index acf9641b3e55af2448284b0c639df9c243e8626b..35270c081e788d0d4ed85008d51bbdb722c51ba9 100755 (executable)
@@ -8,23 +8,29 @@
 
 package org.opendaylight.sfc.sfc_netconf.provider.api;
 
-import org.junit.After;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
 import org.junit.Before;
 import org.junit.Test;
-import org.opendaylight.sfc.provider.api.SfcProviderServiceFunctionAPI;
-import org.opendaylight.sfc.provider.api.SfcDataStoreAPI;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
-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.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.test.AbstractDataBrokerTest;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.sfc.provider.OpendaylightSfc;
+import org.opendaylight.sfc.provider.api.SfcDataStoreAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderServiceFunctionAPI;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctionsState;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.functions.state.ServiceFunctionState;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.functions.state.ServiceFunctionStateBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.functions.state.ServiceFunctionStateKey;
+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.Ipv4Address;
+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.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.sf.desc.mon.rev141201.ServiceFunctionState1;
 import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.sf.desc.mon.rev141201.ServiceFunctionState1Builder;
 import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.sf.desc.mon.rev141201.service.functions.state.service.function.state.SfcSfDescMon;
@@ -49,16 +55,8 @@ import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.sf.desc.mon.rpt.rev1
 import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.sf.desc.mon.rpt.rev141105.sf.monitoring.info.resource.utilization.sf.ports.bandwidth.utilization.PortBandwidthUtilizationKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-
-import static org.junit.Assert.*;
-
 public class SfcNetconfServiceFunctionAPITest extends AbstractDataBrokerTest {
 
-    private ExecutorService executor;
     private final OpendaylightSfc opendaylightSfc = new OpendaylightSfc();
     private static final String IP_MGMT_ADDRESS = "192.168.1.2";
     private static final int DP_PORT = 6633;
@@ -66,17 +64,12 @@ public class SfcNetconfServiceFunctionAPITest extends AbstractDataBrokerTest {
     private static final String SF_STATE_NAME = "dummySFS";
 
     @Before
-    public void before() throws InterruptedException {
+    public void before() {
         DataBroker dataBroker = getDataBroker();
         opendaylightSfc.setDataProvider(dataBroker);
-        executor = opendaylightSfc.getExecutor();
-    }
-
-    @After
-    public void after() throws InterruptedException {
     }
 
-    public void testCreateReadServiceFunctionDescription() throws ExecutionException, InterruptedException {
+    public void testCreateReadServiceFunctionDescription() {
         ServiceFunctionStateKey serviceFunctionStateKey =
                 new ServiceFunctionStateKey("unittest-fw-1");
         SfcSfDescMon sfDescMon;
@@ -123,7 +116,7 @@ public class SfcNetconfServiceFunctionAPITest extends AbstractDataBrokerTest {
         SfcProviderServiceFunctionAPI.putServiceFunctionState(serviceFunctionState);
 
         SfcSfDescMon readSfcSfDescMon =
-                SfcProviderServiceFunctionAPI.readServiceFunctionDescriptionMonitorExecutor("unittest-fw-1");
+                SfcProviderServiceFunctionAPI.readServiceFunctionDescriptionMonitor("unittest-fw-1");
         Long numPorts = 1L;
         assertNotNull("Must be not null", readSfcSfDescMon);
         assertEquals("Must be equal", cap, readSfcSfDescMon.getDescriptionInfo().getCapabilities());
@@ -131,7 +124,7 @@ public class SfcNetconfServiceFunctionAPITest extends AbstractDataBrokerTest {
     }
 
     @Test
-    public void testCreateReadServiceFunctionMonitor() throws ExecutionException, InterruptedException {
+    public void testCreateReadServiceFunctionMonitor() {
         SfcSfDescMon sfDescMon;
 
         ServiceFunctionStateKey serviceFunctionStateKey =
@@ -179,7 +172,7 @@ public class SfcNetconfServiceFunctionAPITest extends AbstractDataBrokerTest {
                 .addAugmentation(ServiceFunctionState1.class,sfState1).build();
         SfcProviderServiceFunctionAPI.putServiceFunctionState(serviceFunctionState);
         SfcSfDescMon readSfcSfDescMon =
-                SfcProviderServiceFunctionAPI.readServiceFunctionDescriptionMonitorExecutor("unittest-fw-2");
+                SfcProviderServiceFunctionAPI.readServiceFunctionDescriptionMonitor("unittest-fw-2");
         assertNotNull("Must be not null", readSfcSfDescMon);
         assertEquals("Must be equal", resrcUtil, readSfcSfDescMon.getMonitoringInfo().getResourceUtilization());
         assertTrue("Must be true", readSfcSfDescMon.getMonitoringInfo().isLiveness());
index 5d3fd19cab995efe51ea599ed9d8181e47a9a821..7856de56283ed3ad4b78aa1bd178861bba99b837 100755 (executable)
@@ -203,7 +203,7 @@ public class SfcProviderRpc implements ServiceFunctionService,
         RpcResult <CreateRenderedPathOutput> rpcResult;
         String retRspName = null;
 
-        createdServiceFunctionPath = SfcProviderServicePathAPI.readServiceFunctionPathExecutor
+        createdServiceFunctionPath = SfcProviderServicePathAPI.readServiceFunctionPath
                 (createRenderedPathInput.getParentServiceFunctionPath());
 
         if (createdServiceFunctionPath != null) {
@@ -215,9 +215,9 @@ public class SfcProviderRpc implements ServiceFunctionService,
                 rpcResult = RpcResultBuilder.success(createRenderedPathOutputBuilder.build()).build();
 
                 if ((createdServiceFunctionPath.getClassifier() != null) &&
-                        SfcProviderServiceClassifierAPI.readServiceClassifierExecutor
+                        SfcProviderServiceClassifierAPI.readServiceClassifier
                                 (createdServiceFunctionPath.getClassifier()) != null) {
-                    SfcProviderServiceClassifierAPI.addRenderedPathToServiceClassifierStateExecutor
+                    SfcProviderServiceClassifierAPI.addRenderedPathToServiceClassifierState
                             (createdServiceFunctionPath.getClassifier(), renderedServicePath.getName());
                 } else {
                     LOG.warn("Classifier not provided or does not exist");
@@ -233,9 +233,9 @@ public class SfcProviderRpc implements ServiceFunctionService,
                         SfcProviderRenderedPathAPI.setSymmetricPathId(renderedServicePath, revRenderedServicePath.getPathId());
                         if ((createdServiceFunctionPath.getSymmetricClassifier() != null) &&
                                 SfcProviderServiceClassifierAPI
-                                        .readServiceClassifierExecutor
+                                        .readServiceClassifier
                                                 (createdServiceFunctionPath.getSymmetricClassifier()) != null) {
-                            SfcProviderServiceClassifierAPI.addRenderedPathToServiceClassifierStateExecutor
+                            SfcProviderServiceClassifierAPI.addRenderedPathToServiceClassifierState
                                     (createdServiceFunctionPath.getSymmetricClassifier(), revRenderedServicePath.getName());
 
                         } else {
@@ -264,11 +264,11 @@ public class SfcProviderRpc implements ServiceFunctionService,
         RpcResultBuilder<DeleteRenderedPathOutput> rpcResultBuilder;
         // If a RSP is deleted we delete both SF and SFF operational states.
         SfcProviderServiceForwarderAPI
-                .deletePathFromServiceForwarderStateExecutor(input.getName());
+                .deletePathFromServiceForwarderState(input.getName());
         SfcProviderServiceFunctionAPI
-                .deleteServicePathFromServiceFunctionStateExecutor(input.getName());
+                .deleteServicePathFromServiceFunctionState(input.getName());
 
-        ret = SfcProviderRenderedPathAPI.deleteRenderedServicePathExecutor(input.getName());
+        ret = SfcProviderRenderedPathAPI.deleteRenderedServicePath(input.getName());
         DeleteRenderedPathOutputBuilder deleteRenderedPathOutputBuilder = new DeleteRenderedPathOutputBuilder();
         deleteRenderedPathOutputBuilder.setResult(ret);
         if (ret) {
index a8bbb0d24d070055bcc629556cc4b45c2a9f957f..1026941cbd0a16d6ba710eba26489b3acaa01cd7 100644 (file)
@@ -66,7 +66,7 @@ public class SfcProviderScfEntryDataListener implements DataChangeListener {
 
                 if ((createdServiceFunctionClassifier.getAccessList() != null) && !createdServiceFunctionClassifier.getAccessList().isEmpty()) {
                     //call executor to write <ACL, Classifier> entry into ACL operational store
-                    SfcProviderAclAPI.addClassifierToAccessListStateExecutor(createdServiceFunctionClassifier.getAccessList(),
+                    SfcProviderAclAPI.addClassifierToAccessListState(createdServiceFunctionClassifier.getAccessList(),
                             createdServiceFunctionClassifier.getName());
                 }
             }
@@ -86,13 +86,13 @@ public class SfcProviderScfEntryDataListener implements DataChangeListener {
 
                     if (!updatedServiceFunctionClassifier.getAccessList().isEmpty()) {
                         //call executor to write <ACL, Classifier> entry into ACL operational store
-                        SfcProviderAclAPI.addClassifierToAccessListStateExecutor(updatedServiceFunctionClassifier.getAccessList(),
+                        SfcProviderAclAPI.addClassifierToAccessListState(updatedServiceFunctionClassifier.getAccessList(),
                                 updatedServiceFunctionClassifier.getName());
                     }
                     // if Access List is empty string, Classifier should be not more linked to the origin Access List
                     else {
                         //call executor to delete <ACL, Classifier> entry from ACL operational store
-                        SfcProviderAclAPI.deleteClassifierFromAccessListStateExecutor(originalServiceFunctionClassifier.getAccessList(),
+                        SfcProviderAclAPI.deleteClassifierFromAccessListState(originalServiceFunctionClassifier.getAccessList(),
                                 originalServiceFunctionClassifier.getName());
                     }
                 }
@@ -108,7 +108,7 @@ public class SfcProviderScfEntryDataListener implements DataChangeListener {
 
                 if ((deletedServiceFunctionClassifier.getAccessList() != null) && !deletedServiceFunctionClassifier.getAccessList().isEmpty()) {
                     //call executor to delete <ACL, Classifier> entry from ACL operational store
-                    SfcProviderAclAPI.deleteClassifierFromAccessListStateExecutor(deletedServiceFunctionClassifier.getAccessList(),
+                    SfcProviderAclAPI.deleteClassifierFromAccessListState(deletedServiceFunctionClassifier.getAccessList(),
                             deletedServiceFunctionClassifier.getName());
                 }
             }
index c1037160e3caba52b080417de4b02937a304f5ad..3de5e31819a71113c8ce76a8d6b3cafd458221ac 100755 (executable)
@@ -15,8 +15,6 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
 
 import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
@@ -44,7 +42,6 @@ import org.slf4j.LoggerFactory;
 public class SfcProviderSfEntryDataListener implements DataChangeListener {
 
     private static final Logger LOG = LoggerFactory.getLogger(SfcProviderSfEntryDataListener.class);
-    private OpendaylightSfc odlSfc = OpendaylightSfc.getOpendaylightSfcObj();
 
     /**
      * This method is called whenever there is change in a SF. Before doing any changes
@@ -76,7 +73,7 @@ public class SfcProviderSfEntryDataListener implements DataChangeListener {
                     if (entry.getValue() instanceof ServiceFunction) {
                         ServiceFunction createdServiceFunction = (ServiceFunction) entry.getValue();
 
-                        if (!SfcProviderServiceTypeAPI.createServiceFunctionTypeEntryExecutor(createdServiceFunction)) {
+                        if (!SfcProviderServiceTypeAPI.createServiceFunctionTypeEntry(createdServiceFunction)) {
                             LOG.error("Failed to create service function type: {}", createdServiceFunction.getType());
                         }
                     }
@@ -90,7 +87,7 @@ public class SfcProviderSfEntryDataListener implements DataChangeListener {
                         ServiceFunction originalServiceFunction = (ServiceFunction) dataObject;
 
                         if (!SfcProviderServiceTypeAPI
-                            .deleteServiceFunctionTypeEntryExecutor(originalServiceFunction)) {
+                            .deleteServiceFunctionTypeEntry(originalServiceFunction)) {
                             LOG.error("Failed to delete Service Function Type for SF: {}",
                                     originalServiceFunction.getName());
                         }
@@ -101,16 +98,16 @@ public class SfcProviderSfEntryDataListener implements DataChangeListener {
                          */
                         String sfName = originalServiceFunction.getName();
                         List<String> rspList =
-                                SfcProviderServiceFunctionAPI.readServiceFunctionStateAsStringListExecutor(sfName);
+                                SfcProviderServiceFunctionAPI.readServiceFunctionStateAsStringList(sfName);
                         if ((rspList != null) && (!rspList.isEmpty())) {
-                            if (SfcProviderServiceFunctionAPI.deleteServiceFunctionStateExecutor(sfName)) {
+                            if (SfcProviderServiceFunctionAPI.deleteServiceFunctionState(sfName)) {
                             } else {
                                 LOG.error("{}: Failed to delete SF {} operational state",
                                         Thread.currentThread().getStackTrace()[1], sfName);
                             }
-                            SfcProviderServiceForwarderAPI.deletePathFromServiceForwarderStateExecutor(rspList);
+                            SfcProviderServiceForwarderAPI.deletePathFromServiceForwarderState(rspList);
 
-                            SfcProviderRenderedPathAPI.deleteRenderedServicePathsExecutor(rspList);
+                            SfcProviderRenderedPathAPI.deleteRenderedServicePaths(rspList);
                         }
                     }
                 }
@@ -122,29 +119,14 @@ public class SfcProviderSfEntryDataListener implements DataChangeListener {
                             && (!(dataCreatedObject.containsKey(entry.getKey())))) {
                         DataObject dataObject = dataOriginalDataObject.get(entry.getKey());
                         ServiceFunction originalServiceFunction = (ServiceFunction) dataObject;
-                        Object[] serviceFunctionObj = {originalServiceFunction};
-                        Class[] serviceFunctionClass = {ServiceFunction.class};
-
                         ServiceFunction updatedServiceFunction = (ServiceFunction) entry.getValue();
 
                         // We only update SF type entry if type has changed
                         if (!updatedServiceFunction.getType().equals(originalServiceFunction.getType())) {
-
                             // We remove the original SF from SF type list
-                            Future future = odlSfc.getExecutor().submit(SfcProviderServiceTypeAPI
-                                .getDeleteServiceFunctionFromServiceType(serviceFunctionObj, serviceFunctionClass));
-                            try {
-                                LOG.debug("getDeleteServiceFunctionFromServiceType returns: {}", future.get());
-                            } catch (InterruptedException e) {
-                                LOG.warn("failed to ....", e);
-                            } catch (ExecutionException e) {
-                                LOG.warn("failed to ....", e);
-                            }
+                            SfcProviderServiceTypeAPI.deleteServiceFunctionTypeEntry(originalServiceFunction);
                             // We create a independent entry
-                            serviceFunctionObj[0] = updatedServiceFunction;
-                            serviceFunctionClass[0] = ServiceFunction.class;
-                            odlSfc.getExecutor().submit(SfcProviderServiceTypeAPI
-                                .getCreateServiceFunctionTypeEntry(serviceFunctionObj, serviceFunctionClass));
+                            SfcProviderServiceTypeAPI.createServiceFunctionTypeEntry(updatedServiceFunction);
                         }
 
                         /*
@@ -153,19 +135,19 @@ public class SfcProviderSfEntryDataListener implements DataChangeListener {
                          */
                         String sfName = originalServiceFunction.getName();
                         List<SfServicePath> sfServicePathList =
-                                SfcProviderServiceFunctionAPI.readServiceFunctionStateExecutor(sfName);
+                                SfcProviderServiceFunctionAPI.readServiceFunctionState(sfName);
                         List<String> rspList = new ArrayList<>();
                         if ((sfServicePathList != null) && (!sfServicePathList.isEmpty())) {
-                            if (!SfcProviderServiceFunctionAPI.deleteServiceFunctionStateExecutor(sfName)) {
+                            if (!SfcProviderServiceFunctionAPI.deleteServiceFunctionState(sfName)) {
                                 LOG.error("{}: Failed to delete SF {} operational state",
                                         Thread.currentThread().getStackTrace()[1], sfName);
                             }
                             for (SfServicePath sfServicePath : sfServicePathList) {
                                 String rspName = sfServicePath.getName();
-                                SfcProviderServiceForwarderAPI.deletePathFromServiceForwarderStateExecutor(rspName);
+                                SfcProviderServiceForwarderAPI.deletePathFromServiceForwarderState(rspName);
                                 rspList.add(rspName);
                             }
-                            SfcProviderRenderedPathAPI.deleteRenderedServicePathsExecutor(rspList);
+                            SfcProviderRenderedPathAPI.deleteRenderedServicePaths(rspList);
                         }
                         /*
                          * We do not update the SFF dictionary. Since the user configured it in the
index 5cf73ff82fbd47a615dad0cb20233c56089be4fc..4a612dd2e52c6a1697327fb743ede5200b34751b 100755 (executable)
@@ -77,9 +77,9 @@ public class SfcProviderSffEntryDataListener implements DataChangeListener {
                         String sffName = serviceFunctionForwarder.getName();
                         List<String> rspList = new ArrayList<>();
                         List<SffServicePath> sffServicePathList =
-                                SfcProviderServiceForwarderAPI.readSffStateExecutor(sffName);
+                                SfcProviderServiceForwarderAPI.readSffState(sffName);
                         if ((sffServicePathList != null) && !sffServicePathList.isEmpty()) {
-                            if (SfcProviderServiceForwarderAPI.deleteServiceFunctionForwarderStateExecutor(sffName)) {
+                            if (SfcProviderServiceForwarderAPI.deleteServiceFunctionForwarderState(sffName)) {
 
                             } else {
                                 LOG.error("{}: Failed to delete SFF {} operational state",
@@ -88,10 +88,10 @@ public class SfcProviderSffEntryDataListener implements DataChangeListener {
                             for (SffServicePath sffServicePath : sffServicePathList) {
                                 String rspName = sffServicePath.getName();
                                 SfcProviderServiceFunctionAPI
-                                    .deleteServicePathFromServiceFunctionStateExecutor(rspName);
+                                    .deleteServicePathFromServiceFunctionState(rspName);
                                 rspList.add(rspName);
                             }
-                            SfcProviderRenderedPathAPI.deleteRenderedServicePathsExecutor(rspList);
+                            SfcProviderRenderedPathAPI.deleteRenderedServicePaths(rspList);
                         }
                     }
                 }
@@ -126,20 +126,20 @@ public class SfcProviderSffEntryDataListener implements DataChangeListener {
                         String sffName = serviceFunctionForwarder.getName();
                         LOG.debug("{}: SFF {} update", Thread.currentThread().getStackTrace()[1], sffName);
                         List<SffServicePath> sffServicePathList =
-                                SfcProviderServiceForwarderAPI.readSffStateExecutor(sffName);
+                                SfcProviderServiceForwarderAPI.readSffState(sffName);
                         List<String> rspList = new ArrayList<>();
                         if ((sffServicePathList != null) && !sffServicePathList.isEmpty()) {
-                            if (!SfcProviderServiceForwarderAPI.deleteServiceFunctionForwarderStateExecutor(sffName)) {
+                            if (!SfcProviderServiceForwarderAPI.deleteServiceFunctionForwarderState(sffName)) {
                                 LOG.error("{}: Failed to delete SFF {} operational state",
                                         Thread.currentThread().getStackTrace()[1], sffName);
                             }
                             for (SffServicePath sffServicePath : sffServicePathList) {
                                 String rspName = sffServicePath.getName();
                                 SfcProviderServiceFunctionAPI
-                                    .deleteServicePathFromServiceFunctionStateExecutor(rspName);
+                                    .deleteServicePathFromServiceFunctionState(rspName);
                                 rspList.add(rspName);
                             }
-                            SfcProviderRenderedPathAPI.deleteRenderedServicePathsExecutor(rspList);
+                            SfcProviderRenderedPathAPI.deleteRenderedServicePaths(rspList);
                         }
 
                     }
index 50487ebde996ce890a79d935968fd43d3dcd1790..ffa9716f817ed37285a73aa08f5065995046175c 100644 (file)
@@ -9,9 +9,17 @@
 package org.opendaylight.sfc.provider;
 
 
+import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStart;
+import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
-import org.opendaylight.sfc.provider.api.*;
+import org.opendaylight.sfc.provider.api.SfcConcurrencyAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderScheduleTypeAPI;
 import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.ServiceFunctionSchedulerTypes;
 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;
@@ -20,15 +28,6 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
-import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStart;
-import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
-
 
 public class SfcProviderSfstEntryDataListener implements DataChangeListener {
     private static final Logger LOG = LoggerFactory.getLogger(SfcProviderSfstEntryDataListener.class);
@@ -68,42 +67,27 @@ public class SfcProviderSfstEntryDataListener implements DataChangeListener {
                                 (ServiceFunctionSchedulerType) entry.getValue();
                         LOG.debug("\n########## createdServiceFunctionSchedulerType {} {}",
                                 createdServiceFunctionSchedulerType.getType(), createdServiceFunctionSchedulerType.getName());
-                        try {
-                            if (createdServiceFunctionSchedulerType.isEnabled() == true) {
-                                isCreateTrue = true;
-
-                                Object[] sfstObj = {};
-                                Class[] sfstClass = {};
-                                SfcProviderScheduleTypeAPI sfcProviderScheduleTypeAPI = SfcProviderScheduleTypeAPI
-                                        .getReadAll(sfstObj, sfstClass);
-                                Future future = odlSfc.getExecutor().submit(sfcProviderScheduleTypeAPI);
-                                if(future.get()!=null) {
-                                    ServiceFunctionSchedulerTypes serviceFunctionSchedulerTypes =
-                                            (ServiceFunctionSchedulerTypes)future.get();
-                                    List<ServiceFunctionSchedulerType> sfScheduleTypeList =
-                                            serviceFunctionSchedulerTypes.getServiceFunctionSchedulerType();
-                                    for (ServiceFunctionSchedulerType sfst : sfScheduleTypeList) {
-                                        if (sfst.isEnabled() == true) {
-                                            if (!(sfst.getType().equals(createdServiceFunctionSchedulerType.getType()))) {
-                                                ServiceFunctionSchedulerType sfstUpdate = new ServiceFunctionSchedulerTypeBuilder()
-                                                                                            .setName(sfst.getName())
-                                                                                            .setType(sfst.getType())
-                                                                                            .setEnabled(false).build();
-
-                                                Object[] sfstObjUpdate = {sfstUpdate};
-                                                Class[] sfstClassUpdate = {ServiceFunctionSchedulerType.class};
-                                                future = odlSfc.getExecutor().submit(SfcProviderScheduleTypeAPI
-                                                    .getPut(sfstObjUpdate, sfstClassUpdate));
-                                                break;
-                                            }
+                        if (createdServiceFunctionSchedulerType.isEnabled() == true) {
+                            isCreateTrue = true;
+                            ServiceFunctionSchedulerTypes serviceFunctionSchedulerTypes = SfcProviderScheduleTypeAPI
+                                    .readAllServiceFunctionScheduleTypes();
+                            if(serviceFunctionSchedulerTypes != null) {
+                                List<ServiceFunctionSchedulerType> sfScheduleTypeList =
+                                        serviceFunctionSchedulerTypes.getServiceFunctionSchedulerType();
+                                for (ServiceFunctionSchedulerType sfst : sfScheduleTypeList) {
+                                    if (sfst.isEnabled() == true) {
+                                        if (!(sfst.getType().equals(createdServiceFunctionSchedulerType.getType()))) {
+                                            ServiceFunctionSchedulerType sfstUpdate = new ServiceFunctionSchedulerTypeBuilder()
+                                                                                        .setName(sfst.getName())
+                                                                                        .setType(sfst.getType())
+                                                                                        .setEnabled(false).build();
+
+                                            SfcProviderScheduleTypeAPI.putServiceFunctionScheduleType(sfstUpdate);
+                                            break;
                                         }
                                     }
                                 }
                             }
-                        } catch (InterruptedException e) {
-                            LOG.warn("failed to ....", e);
-                        } catch (ExecutionException e) {
-                            LOG.warn("failed to ....", e);
                         }
                     }
                 }
@@ -130,45 +114,31 @@ public class SfcProviderSfstEntryDataListener implements DataChangeListener {
                         LOG.debug("\n########## updatedServiceFunctionSchedulerType {} {}",
                                 updatedServiceFunctionSchedulerType.getType(), updatedServiceFunctionSchedulerType.getName());
 
-                        try {
-                            if (isCreateTrue==false) {
-                                if (updatedServiceFunctionSchedulerType.isEnabled() == true) {
-                                    Object[] sfstObj = {};
-                                    Class[] sfstClass = {};
-                                    SfcProviderScheduleTypeAPI sfcProviderScheduleTypeAPI = SfcProviderScheduleTypeAPI
-                                            .getReadAll(sfstObj, sfstClass);
-                                    Future future = odlSfc.getExecutor().submit(sfcProviderScheduleTypeAPI);
-                                    if(future.get()!=null) {
-                                        ServiceFunctionSchedulerTypes serviceFunctionSchedulerTypes =
-                                                (ServiceFunctionSchedulerTypes)future.get();
-                                        List<ServiceFunctionSchedulerType> sfScheduleTypeList =
-                                                serviceFunctionSchedulerTypes.getServiceFunctionSchedulerType();
-                                        for (ServiceFunctionSchedulerType sfst : sfScheduleTypeList) {
-                                            if (sfst.isEnabled() == true) {
-                                                if (!(sfst.getType().equals(updatedServiceFunctionSchedulerType.getType()))) {
-                                                    ServiceFunctionSchedulerType sfstUpdate = new ServiceFunctionSchedulerTypeBuilder()
-                                                                                                .setName(sfst.getName())
-                                                                                                .setType(sfst.getType())
-                                                                                                .setEnabled(false).build();
-
-                                                    Object[] serviceFunctionSchedulerTypeObj = {sfstUpdate};
-                                                    Class[] serviceFunctionSchedulerTypeClass = {ServiceFunctionSchedulerType.class};
-                                                    future = odlSfc.getExecutor().submit(SfcProviderScheduleTypeAPI
-                                                        .getPut(serviceFunctionSchedulerTypeObj, serviceFunctionSchedulerTypeClass));
-                                                    break;
-
-                                                }
+                        if (isCreateTrue==false) {
+                            if (updatedServiceFunctionSchedulerType.isEnabled() == true) {
+                                ServiceFunctionSchedulerTypes serviceFunctionSchedulerTypes = SfcProviderScheduleTypeAPI
+                                        .readAllServiceFunctionScheduleTypes();
+                                if(serviceFunctionSchedulerTypes != null) {
+                                    List<ServiceFunctionSchedulerType> sfScheduleTypeList =
+                                            serviceFunctionSchedulerTypes.getServiceFunctionSchedulerType();
+                                    for (ServiceFunctionSchedulerType sfst : sfScheduleTypeList) {
+                                        if (sfst.isEnabled() == true) {
+                                            if (!(sfst.getType().equals(updatedServiceFunctionSchedulerType.getType()))) {
+                                                ServiceFunctionSchedulerType sfstUpdate = new ServiceFunctionSchedulerTypeBuilder()
+                                                                                            .setName(sfst.getName())
+                                                                                            .setType(sfst.getType())
+                                                                                            .setEnabled(false).build();
+
+                                                SfcProviderScheduleTypeAPI.putServiceFunctionScheduleType(sfstUpdate);
+                                                break;
+
                                             }
                                         }
                                     }
                                 }
-                            } else if (isCreateTrue==true) {
-                                isCreateTrue=false;
                             }
-                        } catch (InterruptedException e) {
-                            LOG.warn("failed to ...." , e);
-                        } catch (ExecutionException e) {
-                            LOG.warn("failed to ...." , e);
+                        } else if (isCreateTrue==true) {
+                            isCreateTrue=false;
                         }
                     }
                 }
diff --git a/sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcReflection.java b/sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcReflection.java
deleted file mode 100644 (file)
index 8e57a57..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.sfc.provider;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Created by repenno on 11/29/14.
- */
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD) //can use in method only.
-public @interface SfcReflection {
-
-    //should ignore this test?
-    public boolean enabled() default true;
-}
diff --git a/sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcProviderAbstractAPI.java b/sfc-provider/src/main/java/org/opendaylight/sfc/provider/api/SfcProviderAbstractAPI.java
deleted file mode 100755 (executable)
index ce2e9b7..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.sfc.provider.api;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.sfc.provider.OpendaylightSfc;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.concurrent.Callable;
-
-/**
- * <p>
- *
- * @author Konstantin Blagov ([email protected])
- * @version 0.1
- * @since 2014-06-30
- */
-public abstract class SfcProviderAbstractAPI implements Callable<Object> {
-
-    protected static final OpendaylightSfc ODL_SFC = OpendaylightSfc.getOpendaylightSfcObj();
-    private static final Logger LOG = LoggerFactory.getLogger
-            (SfcProviderAbstractAPI.class);
-    private String methodName = null;
-    private Object[] parameters;
-    private Class[] parameterTypes;
-    protected DataBroker dataBroker;
-
-    public String getMethodName()
-    {
-        return methodName;
-    }
-
-    public void setMethodName(String methodName)
-    {
-        this.methodName = methodName;
-    }
-
-    public Object[] getParameters()
-    {
-        return parameters;
-    }
-
-    public void setParameters(Object[] parameters)
-    {
-        this.parameters = Arrays.copyOf(parameters, parameters.length);
-    }
-
-    public Class[] getParameterTypes()
-    {
-        return parameterTypes;
-    }
-
-    public void setParameterTypes(Class[] parameterTypes)
-    {
-        this.parameterTypes = Arrays.copyOf(parameterTypes,
-                parameterTypes.length);
-    }
-
-    public DataBroker getDataBroker()
-    {
-        return dataBroker;
-    }
-
-    public void setDataBroker(DataBroker dataBroker)
-    {
-        this.dataBroker = dataBroker;
-    }
-
-    SfcProviderAbstractAPI(Object[] params, String m) {
-        setMethodName(m);
-        this.parameters = new Object[params.length];
-        this.parameterTypes = new Class[params.length];
-        setParameters(params);
-        setDataBroker(ODL_SFC.getDataProvider());
-
-        for (int i = 0; i < params.length; i++) {
-            this.parameterTypes[i] = params[i].getClass();
-        }
-    }
-
-    protected SfcProviderAbstractAPI(Object[] params, Class[] paramsTypes, String m) {
-        setMethodName(m);
-        this.parameters = new Object[params.length];
-        this.parameterTypes = new Class[params.length];
-        setParameters(params);
-        setParameterTypes(paramsTypes);
-        setDataBroker(ODL_SFC.getDataProvider());
-    }
-
-    @Override
-    public final Object call() {
-        Object result = null;
-        if (methodName != null) {
-            Class<?> c = this.getClass();
-            Method method;
-            try {
-                method = c.getDeclaredMethod(methodName, parameterTypes);
-                result = method.invoke(this, parameters);
-            } catch (IllegalAccessException  e) {
-                LOG.error("Illegal Access, method: {}, message: {}", methodName, e.getMessage());
-            } catch (InvocationTargetException e) {
-                LOG.error("Invocation exception {}, message: {}", methodName, e.getMessage());
-            } catch (NoSuchMethodException e) {
-                LOG.error("Could not find method {} in class", methodName);
-            }
-        }
-        return result;
-    }
-
-}
index bc81633903223520051d0bf1daf595d83182ca1f..943e773e828bbef20134635b7ffbc7da1c463832 100644 (file)
@@ -11,9 +11,7 @@ package org.opendaylight.sfc.provider.api;
 import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStart;
 import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
 
-
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.sfc.provider.SfcReflection;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.AccessLists;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.AccessListsState;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.Acl;
@@ -27,9 +25,6 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
 
 /**
  * This class has the APIs to operate on the ACL
@@ -45,34 +40,9 @@ import java.util.concurrent.Future;
  * <p>
  * @since 2014-11-04
  */
-public class SfcProviderAclAPI extends SfcProviderAbstractAPI {
+public class SfcProviderAclAPI {
 
     private static final Logger LOG = LoggerFactory.getLogger(SfcProviderAclAPI.class);
-    private static final String FAILED_TO_STR = "failed to ...";
-
-    SfcProviderAclAPI(Object[] params, String m) {
-        super(params, m);
-    }
-
-    SfcProviderAclAPI(Object[] params, Class[] paramsTypes, String m) {
-        super(params, paramsTypes, m);
-    }
-
-    public static SfcProviderAclAPI getReadAccessList(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderAclAPI(params, paramsTypes, "readAccessList");
-    }
-
-    public static SfcProviderAclAPI getReadAccessListState(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderAclAPI(params, paramsTypes, "readAccessListState");
-    }
-
-    public static SfcProviderAclAPI getAddClassifierToAccessListStateExecutor(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderAclAPI(params, paramsTypes, "addClassifierToAccessListState");
-    }
-
-    public static SfcProviderAclAPI getDeleteClassifierFromAccessListStateExecutor(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderAclAPI(params, paramsTypes, "deleteClassifierFromAccessListState");
-    }
 
     /**
      * This method reads a Access List from DataStore
@@ -80,9 +50,7 @@ public class SfcProviderAclAPI extends SfcProviderAbstractAPI {
      * @param accessListName Access List name
      * @return ACL object or null if not found
      */
-    @SuppressWarnings("unused")
-    @SfcReflection
-    protected Acl readAccessList(String accessListName) {
+    public static Acl readAccessList(String accessListName) {
         printTraceStart(LOG);
         Acl acl;
         InstanceIdentifier<Acl> aclIID;
@@ -97,41 +65,13 @@ public class SfcProviderAclAPI extends SfcProviderAbstractAPI {
     }
 
 
-    /**
-     * Wrapper API to read access list from Datastore
-     * <p>
-     * @param accessListName Access List name
-     * @return an Acl object, null otherwise
-     */
-    public static Acl readAccessListExecutor(String accessListName) {
-
-        printTraceStart(LOG);
-        Acl ret = null;
-        Object[] functionParamsObj = {accessListName};
-        Class[] functionParamsClass = {String.class};
-        Future future  = ODL_SFC.getExecutor().submit(SfcProviderAclAPI
-                .getReadAccessList(functionParamsObj, functionParamsClass));
-        try {
-            ret = (Acl) future.get();
-            LOG.debug("getReadAccessList: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * This method reads a Access List state from Operational DataStore
      * <p>
      * @param accessListName Access List name
      * @return ACL state object or null if not found
      */
-    @SuppressWarnings("unused")
-    @SfcReflection
-    protected AccessListState readAccessListState(String accessListName) {
+    public static AccessListState readAccessListState(String accessListName) {
         printTraceStart(LOG);
         AccessListState aclState;
         InstanceIdentifier<AccessListState> aclStateIID;
@@ -146,33 +86,6 @@ public class SfcProviderAclAPI extends SfcProviderAbstractAPI {
     }
 
 
-    /**
-     * Wrapper API to read access list state from Operational Datastore
-     * <p>
-     * @param accessListName Access List name
-     * @return an AccessListState object that is a list of all classifiers using
-     * this access list, null otherwise
-     */
-    public static AccessListState readAccessListStateExecutor(String accessListName) {
-
-        printTraceStart(LOG);
-        AccessListState ret = null;
-        Object[] functionParamsObj = {accessListName};
-        Class[] functionParamsClass = {String.class};
-        Future future  = ODL_SFC.getExecutor().submit(SfcProviderAclAPI
-                .getReadAccessListState(functionParamsObj, functionParamsClass));
-        try {
-            ret = (AccessListState) future.get();
-            LOG.debug("getReadAccessListState: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * Adds Classifier to Access List state
      * <p>
@@ -180,7 +93,6 @@ public class SfcProviderAclAPI extends SfcProviderAbstractAPI {
      * @param serviceClassifierName Service Classifier name
      * @return true if success.
      */
-    @SuppressWarnings("unused")
     public static boolean addClassifierToAccessListState (String accessListName, String serviceClassifierName) {
 
         printTraceStart(LOG);
@@ -208,34 +120,6 @@ public class SfcProviderAclAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * Wrapper API used to add Classifier to Access List state
-     * <p>
-     * @param accessListName Service Function Classifier name
-     * @param serviceClassifierName Rendered Path name
-     * @return true if success.
-     */
-    @SuppressWarnings("unused")
-    public static boolean addClassifierToAccessListStateExecutor (String accessListName, String serviceClassifierName) {
-
-        printTraceStart(LOG);
-        boolean ret = true;
-        Object[] functionParams = {accessListName, serviceClassifierName};
-        Class[] functionParamsTypes = {String.class, String.class};
-        Future future = ODL_SFC.getExecutor().submit(SfcProviderAclAPI
-                .getAddClassifierToAccessListStateExecutor(functionParams, functionParamsTypes));
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getAddClassifierToAccessListStateExecutor returns: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn(FAILED_TO_STR , e);
-        } catch (ExecutionException e) {
-            LOG.warn(FAILED_TO_STR , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * Deletes Classifier from Access List state
      * <p>
@@ -243,7 +127,6 @@ public class SfcProviderAclAPI extends SfcProviderAbstractAPI {
      * @param serviceClassifierName Service Classifier name
      * @return true if success.
      */
-    @SuppressWarnings("unused")
     public static boolean deleteClassifierFromAccessListState (String accessListName, String serviceClassifierName) {
 
         printTraceStart(LOG);
@@ -267,32 +150,4 @@ public class SfcProviderAclAPI extends SfcProviderAbstractAPI {
         printTraceStop(LOG);
         return ret;
     }
-
-    /**
-     * Wrapper API used to delete Classifier from Access List state
-     * <p>
-     * @param accessListName Service Function Classifier name
-     * @param serviceClassifierName Rendered Path name
-     * @return true if success.
-     */
-    @SuppressWarnings("unused")
-    public static boolean deleteClassifierFromAccessListStateExecutor (String accessListName, String serviceClassifierName) {
-
-        printTraceStart(LOG);
-        boolean ret = true;
-        Object[] functionParams = {accessListName, serviceClassifierName};
-        Class[] functionParamsTypes = {String.class, String.class};
-        Future future = ODL_SFC.getExecutor().submit(SfcProviderAclAPI
-                .getDeleteClassifierFromAccessListStateExecutor(functionParams, functionParamsTypes));
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeleteClassifierFromAccessListStateExecutor returns: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn(FAILED_TO_STR , e);
-        } catch (ExecutionException e) {
-            LOG.warn(FAILED_TO_STR , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
 }
index 99f519e8d82e8141b3572e1f4ee080542d05a385..dadcc1459029e28ab8bc79d97490624d82fe9321 100644 (file)
@@ -15,13 +15,9 @@ import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
 import java.util.ListIterator;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.sfc.provider.OpendaylightSfc;
-import org.opendaylight.sfc.provider.SfcReflection;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.CreateRenderedPathInput;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.CreateRenderedPathInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.RenderedServicePaths;
@@ -75,13 +71,11 @@ import org.slf4j.LoggerFactory;
  *          <p>
  * @since 2014-11-04
  */
-public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
+public class SfcProviderRenderedPathAPI {
 
     private static final Logger LOG = LoggerFactory.getLogger(SfcProviderRenderedPathAPI.class);
-    private static final String FAILED_TO_STR = "failed to ...";
     private static final int MAX_STARTING_INDEX = 255;
     private static AtomicInteger numCreatedPath = new AtomicInteger(0);
-    private static final OpendaylightSfc ODL_SFC = OpendaylightSfc.getOpendaylightSfcObj();
     private static SfcServiceFunctionSchedulerAPI defaultScheduler;
 
     static final Comparator<SfcServiceFunction> SF_ORDER = new Comparator<SfcServiceFunction>() {
@@ -123,7 +117,7 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
 
         try {
             serviceFunctionSchedulerType =
-                    SfcProviderScheduleTypeAPI.readEnabledServiceFunctionScheduleTypeEntryExecutor().getType();
+                    SfcProviderScheduleTypeAPI.readEnabledServiceFunctionScheduleTypeEntry().getType();
         } catch (Exception e) {
             serviceFunctionSchedulerType = Random.class;
         }
@@ -132,7 +126,6 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
         LOG.info("Selected SF Schdedule Type: {}", serviceFunctionSchedulerType);
     }
 
-    @SuppressWarnings("unused")
     public static int numCreatedPathGetValue() {
         return numCreatedPath.get();
     }
@@ -141,102 +134,10 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
         return numCreatedPath.incrementAndGet();
     }
 
-    @SuppressWarnings("unused")
     public int numCreatedPathDecrementGet() {
         return numCreatedPath.decrementAndGet();
     }
 
-    SfcProviderRenderedPathAPI(Object[] params, String m) {
-        super(params, m);
-        // initDefaultServiceFunctionScheduler();
-    }
-
-    SfcProviderRenderedPathAPI(Object[] params, Class[] paramsTypes, String m) {
-        super(params, paramsTypes, m);
-        // initDefaultServiceFunctionScheduler();
-    }
-
-    public static SfcProviderRenderedPathAPI getRead(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderRenderedPathAPI(params, paramsTypes, "readRenderedServicePath");
-    }
-
-    public static SfcProviderRenderedPathAPI getReadRenderedServicePath(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderRenderedPathAPI(params, paramsTypes, "readRenderedServicePath");
-    }
-
-    public static SfcProviderRenderedPathAPI getCreateRenderedServicePathEntryAPI(Object[] params,
-            Class[] paramsTypes) {
-        return new SfcProviderRenderedPathAPI(params, paramsTypes, "createRenderedServicePathEntry");
-    }
-
-    public static SfcProviderRenderedPathAPI getCreateReverseRenderedServicePathEntryAPI(Object[] params,
-            Class[] paramsTypes) {
-        return new SfcProviderRenderedPathAPI(params, paramsTypes, "createReverseRenderedServicePathEntry");
-    }
-
-    @SuppressWarnings("unused")
-    public static SfcProviderRenderedPathAPI getDeleteRenderedServicePath(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderRenderedPathAPI(params, paramsTypes, "deleteRenderedServicePath");
-    }
-
-    @SuppressWarnings("unused")
-    public static SfcProviderRenderedPathAPI getDeleteRenderedServicePaths(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderRenderedPathAPI(params, paramsTypes, "deleteRenderedServicePaths");
-    }
-
-    @SuppressWarnings("unused")
-    public static SfcProviderRenderedPathAPI getUpdateRenderedServicePathAPI(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderRenderedPathAPI(params, paramsTypes, "updateRenderedServicePathEntry");
-    }
-
-    @SuppressWarnings("unused")
-    /*
-     * protected void updateRenderedServicePathEntry (ServiceFunctionPath serviceFunctionPath) {
-     * this.createRenderedServicePathEntry(serviceFunctionPath);
-     * }
-     */
-
-    public static RenderedServicePath createRenderedServicePathEntryExecutor(ServiceFunctionPath serviceFunctionPath,
-            CreateRenderedPathInput createRenderedPathInput, SfcServiceFunctionSchedulerAPI scheduler) {
-        RenderedServicePath ret = null;
-        Object[] servicePathObj = {serviceFunctionPath, createRenderedPathInput, scheduler};
-        Class[] servicePathClass =
-                {ServiceFunctionPath.class, CreateRenderedPathInput.class, SfcServiceFunctionSchedulerAPI.class};
-        SfcProviderRenderedPathAPI sfcProviderRenderedPathAPI =
-                SfcProviderRenderedPathAPI.getCreateRenderedServicePathEntryAPI(servicePathObj, servicePathClass);
-        Future futureCreateRSP = ODL_SFC.getExecutor().submit(sfcProviderRenderedPathAPI);
-        try {
-            ret = (RenderedServicePath) futureCreateRSP.get();
-            LOG.debug("createRenderedServicePathEntryExecutor: {}", ret);
-        } catch (InterruptedException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        } catch (ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        }
-        return ret;
-    }
-
-    public static RenderedServicePath createReverseRenderedServicePathEntryExecutor(
-            RenderedServicePath renderedServicePath) {
-        RenderedServicePath ret = null;
-        Object[] servicePathObj = {renderedServicePath};
-        Class[] servicePathClass = {RenderedServicePath.class};
-        SfcProviderRenderedPathAPI sfcProviderRenderedPathAPI = SfcProviderRenderedPathAPI
-            .getCreateReverseRenderedServicePathEntryAPI(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderRenderedPathAPI);
-        try {
-            ret = (RenderedServicePath) future.get();
-            LOG.debug("getCreateRenderedServicePathEntryAPI: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        } catch (ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        return ret;
-    }
-
     /**
      * Creates a RSP and all the associated operational state based on the
      * given service function path and scheduler
@@ -262,7 +163,7 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
         }
 
         // Create RSP
-        if ((renderedServicePath = SfcProviderRenderedPathAPI.createRenderedServicePathEntryExecutor(
+        if ((renderedServicePath = SfcProviderRenderedPathAPI.createRenderedServicePathEntry(
                 createdServiceFunctionPath, createRenderedPathInput, scheduler)) != null) {
             rspSuccessful = true;
 
@@ -273,37 +174,37 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
 
         // Add Path name to SFF operational state
         if (rspSuccessful
-                && SfcProviderServiceForwarderAPI.addPathToServiceForwarderStateExecutor(renderedServicePath)) {
+                && SfcProviderServiceForwarderAPI.addPathToServiceForwarderState(renderedServicePath)) {
             addPathToSffStateSuccessful = true;
         } else {
             if (renderedServicePath != null) {
-                SfcProviderRenderedPathAPI.deleteRenderedServicePathExecutor(renderedServicePath.getName());
+                SfcProviderRenderedPathAPI.deleteRenderedServicePath(renderedServicePath.getName());
             }
         }
 
         // Add Path to SF operational state
         if (addPathToSffStateSuccessful
-                && SfcProviderServiceFunctionAPI.addPathToServiceFunctionStateExecutor(renderedServicePath)) {
+                && SfcProviderServiceFunctionAPI.addPathToServiceFunctionState(renderedServicePath)) {
 
             addPathToSfStateSuccessful = true;
         } else {
-            SfcProviderServiceForwarderAPI.deletePathFromServiceForwarderStateExecutor(createdServiceFunctionPath);
+            SfcProviderServiceForwarderAPI.deletePathFromServiceForwarderState(createdServiceFunctionPath);
             if (renderedServicePath != null) {
-                SfcProviderRenderedPathAPI.deleteRenderedServicePathExecutor(renderedServicePath.getName());
+                SfcProviderRenderedPathAPI.deleteRenderedServicePath(renderedServicePath.getName());
             }
         }
 
         // Add RSP to SFP operational state
-        if (addPathToSfStateSuccessful && SfcProviderServicePathAPI.addRenderedPathToServicePathStateExecutor(
+        if (addPathToSfStateSuccessful && SfcProviderServicePathAPI.addRenderedPathToServicePathState(
                 createdServiceFunctionPath.getName(), renderedServicePath.getName())) {
             addPathtoSfpStateSuccessful = true;
 
         } else {
             SfcProviderServiceFunctionAPI
-                .deleteServicePathFromServiceFunctionStateExecutor(createdServiceFunctionPath.getName());
-            SfcProviderServiceForwarderAPI.deletePathFromServiceForwarderStateExecutor(createdServiceFunctionPath);
+                .deleteServicePathFromServiceFunctionState(createdServiceFunctionPath.getName());
+            SfcProviderServiceForwarderAPI.deletePathFromServiceForwarderState(createdServiceFunctionPath);
             if (renderedServicePath != null) {
-                SfcProviderRenderedPathAPI.deleteRenderedServicePathExecutor(renderedServicePath.getName());
+                SfcProviderRenderedPathAPI.deleteRenderedServicePath(renderedServicePath.getName());
             }
         }
 
@@ -351,7 +252,7 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
         // Reverse Path
 
         if ((revRenderedServicePath = SfcProviderRenderedPathAPI
-            .createReverseRenderedServicePathEntryExecutor(renderedServicePath)) != null) {
+            .createReverseRenderedServicePathEntry(renderedServicePath)) != null) {
             revRspSuccessful = true;
         } else {
             LOG.error("Could not create Reverse RSP {}", renderedServicePath.getName());
@@ -359,15 +260,15 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
 
         // Add Path name to SFF operational state
         if (revRspSuccessful
-                && SfcProviderServiceForwarderAPI.addPathToServiceForwarderStateExecutor(revRenderedServicePath)) {
+                && SfcProviderServiceForwarderAPI.addPathToServiceForwarderState(revRenderedServicePath)) {
             addRevPathToSffStateSuccessul = true;
         } else {
-            SfcProviderRenderedPathAPI.deleteRenderedServicePathExecutor(revRenderedServicePath.getName());
+            SfcProviderRenderedPathAPI.deleteRenderedServicePath(revRenderedServicePath.getName());
         }
 
         // Add Path to SF operational state
         if (addRevPathToSffStateSuccessul
-                && SfcProviderServiceFunctionAPI.addPathToServiceFunctionStateExecutor(revRenderedServicePath)) {
+                && SfcProviderServiceFunctionAPI.addPathToServiceFunctionState(revRenderedServicePath)) {
 
             addRevPathToSfStateSuccessul = true;
             // Send to SB REST
@@ -377,21 +278,21 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
              */
         } else {
             SfcProviderServiceForwarderAPI
-                .deletePathFromServiceForwarderStateExecutor(revRenderedServicePath.getName());
-            SfcProviderRenderedPathAPI.deleteRenderedServicePathExecutor(revRenderedServicePath.getName());
+                .deletePathFromServiceForwarderState(revRenderedServicePath.getName());
+            SfcProviderRenderedPathAPI.deleteRenderedServicePath(revRenderedServicePath.getName());
 
         }
         // Add RSP to SFP operational state
-        if (addRevPathToSfStateSuccessul && SfcProviderServicePathAPI.addRenderedPathToServicePathStateExecutor(
+        if (addRevPathToSfStateSuccessul && SfcProviderServicePathAPI.addRenderedPathToServicePathState(
                 renderedServicePath.getParentServiceFunctionPath(), revRenderedServicePath.getName())) {
             addRevPathToSfpStateSuccessul = true;
 
         } else {
             SfcProviderServiceFunctionAPI
-                .deleteServicePathFromServiceFunctionStateExecutor(revRenderedServicePath.getName());
+                .deleteServicePathFromServiceFunctionState(revRenderedServicePath.getName());
             SfcProviderServiceForwarderAPI
-                .deletePathFromServiceForwarderStateExecutor(revRenderedServicePath.getName());
-            SfcProviderRenderedPathAPI.deleteRenderedServicePathExecutor(revRenderedServicePath.getName());
+                .deletePathFromServiceForwarderState(revRenderedServicePath.getName());
+            SfcProviderRenderedPathAPI.deleteRenderedServicePath(revRenderedServicePath.getName());
 
         }
         return revRenderedServicePath;
@@ -405,7 +306,7 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
      * @param serviceIndex Starting index
      * @return List of {@link RenderedServicePathHop}
      */
-    protected List<RenderedServicePathHop> createRenderedServicePathHopList(List<String> serviceFunctionNameList,
+    protected static List<RenderedServicePathHop> createRenderedServicePathHopList(List<String> serviceFunctionNameList,
             List<String> sfgNameList, int serviceIndex) {
         List<RenderedServicePathHop> renderedServicePathHopArrayList = new ArrayList<>();
         RenderedServicePathHopBuilder renderedServicePathHopBuilder = new RenderedServicePathHopBuilder();
@@ -421,14 +322,14 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
         if (sfgNameList != null) {
             boolean loopBroken = false;
             for (String sfgName : sfgNameList) {
-                ServiceFunctionGroup sfg = SfcProviderServiceFunctionGroupAPI.readServiceFunctionGroupExecutor(sfgName);
+                ServiceFunctionGroup sfg = SfcProviderServiceFunctionGroupAPI.readServiceFunctionGroup(sfgName);
                 if (sfg == null) {
                     LOG.error("Could not find suitable SFG in data store by name: {}", sfgName);
                     loopBroken = true;
                     break;
                 }
                 ServiceFunction serviceFunction = SfcProviderServiceFunctionAPI
-                    .readServiceFunctionExecutor(sfg.getSfcServiceFunction().get(0).getName());
+                    .readServiceFunction(sfg.getSfcServiceFunction().get(0).getName());
                 if (serviceFunction == null) {
                     LOG.error("Could not find suitable SF in data store by name: {}",
                             sfg.getSfcServiceFunction().get(0).getName());
@@ -449,7 +350,7 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
         } else {
             for (String serviceFunctionName : serviceFunctionNameList) {
                 ServiceFunction serviceFunction =
-                        SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(serviceFunctionName);
+                        SfcProviderServiceFunctionAPI.readServiceFunction(serviceFunctionName);
                 if (serviceFunction == null) {
                     LOG.error("Could not find suitable SF in data store by name: {}", serviceFunctionName);
                     return null;
@@ -465,25 +366,25 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
         return renderedServicePathHopArrayList;
     }
 
-    private void createSFHopBuilder(int serviceIndex, RenderedServicePathHopBuilder renderedServicePathHopBuilder,
+    private static void createSFHopBuilder(int serviceIndex, RenderedServicePathHopBuilder renderedServicePathHopBuilder,
             short posIndex, String serviceFunctionName, ServiceFunction serviceFunction) {
         createHopBuilderInternal(serviceIndex, renderedServicePathHopBuilder, posIndex, serviceFunction);
         renderedServicePathHopBuilder.setServiceFunctionName(serviceFunctionName);
     }
 
-    private void createSFGHopBuilder(int serviceIndex, RenderedServicePathHopBuilder renderedServicePathHopBuilder,
+    private static void createSFGHopBuilder(int serviceIndex, RenderedServicePathHopBuilder renderedServicePathHopBuilder,
             short posIndex, String serviceFunctionGroupName, ServiceFunction serviceFunction) {
         createHopBuilderInternal(serviceIndex, renderedServicePathHopBuilder, posIndex, serviceFunction);
         renderedServicePathHopBuilder.setServiceFunctionGroupName(serviceFunctionGroupName);
     }
 
-    private void createHopBuilderInternal(int serviceIndex, RenderedServicePathHopBuilder renderedServicePathHopBuilder,
+    private static void createHopBuilderInternal(int serviceIndex, RenderedServicePathHopBuilder renderedServicePathHopBuilder,
             short posIndex, ServiceFunction serviceFunction) {
         String serviceFunctionForwarderName =
                 serviceFunction.getSfDataPlaneLocator().get(0).getServiceFunctionForwarder();
 
         ServiceFunctionForwarder serviceFunctionForwarder =
-                SfcProviderServiceForwarderAPI.readServiceFunctionForwarderExecutor(serviceFunctionForwarderName);
+                SfcProviderServiceForwarderAPI.readServiceFunctionForwarder(serviceFunctionForwarderName);
         if (serviceFunctionForwarder != null && serviceFunctionForwarder.getSffDataPlaneLocator() != null
                 && serviceFunctionForwarder.getSffDataPlaneLocator().get(0) != null) {
             renderedServicePathHopBuilder
@@ -505,7 +406,7 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
      * @param scheduler SfcServiceFunctionSchedulerAPI object
      * @return RenderedServicePath
      */
-    protected RenderedServicePath createRenderedServicePathEntry(ServiceFunctionPath serviceFunctionPath,
+    protected static RenderedServicePath createRenderedServicePathEntry(ServiceFunctionPath serviceFunctionPath,
             CreateRenderedPathInput createRenderedPathInput, SfcServiceFunctionSchedulerAPI scheduler) {
 
         printTraceStart(LOG);
@@ -625,8 +526,7 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
      * @param renderedServicePath RSP object
      * @return Nothing
      */
-    @SfcReflection
-    public RenderedServicePath createReverseRenderedServicePathEntry(RenderedServicePath renderedServicePath) {
+    public static RenderedServicePath createReverseRenderedServicePathEntry(RenderedServicePath renderedServicePath) {
 
         RenderedServicePath ret = null;
         String revPathName;
@@ -709,30 +609,6 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
 
     }
 
-    @SuppressWarnings("unused")
-    public static RenderedServicePath readRenderedServicePathExecutor(String rspName) {
-
-        printTraceStart(LOG);
-        RenderedServicePath ret = null;
-
-        Object[] rspNameObj = {rspName};
-        Class[] rspNameClass = {String.class};
-
-        SfcProviderRenderedPathAPI sfcProviderRenderedPathAPI =
-                SfcProviderRenderedPathAPI.getReadRenderedServicePath(rspNameObj, rspNameClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderRenderedPathAPI);
-        try {
-            ret = (RenderedServicePath) future.get();
-        } catch (InterruptedException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        } catch (ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        return ret;
-    }
-
     /**
      * This function reads a RSP from the datastore
      * <p>
@@ -762,8 +638,6 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
      * @param servicePaths SffServicePath object
      * @return Nothing.
      */
-    @SuppressWarnings("unused")
-    @SfcReflection
     public static boolean deleteRenderedServicePaths(List<String> servicePaths) {
 
         printTraceStart(LOG);
@@ -785,40 +659,6 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * Wrapper API to deletes a list of Service Paths. It includes Executor creation
-     * and response management
-     * <p>
-     *
-     * @param servicePaths SffServicePath object
-     * @return Nothing.
-     */
-    @SuppressWarnings("unused")
-    public static boolean deleteRenderedServicePathsExecutor(List<String> servicePaths) {
-
-        printTraceStart(LOG);
-        boolean ret = true;
-
-        // SFF deletion is a critical event. If a SFF is deleted we delete all associated SFPs
-        Object[] servicePathObj = {servicePaths};
-        Class[] servicePathClass = {List.class};
-
-        SfcProviderRenderedPathAPI sfcProviderRenderedPathAPI =
-                SfcProviderRenderedPathAPI.getDeleteRenderedServicePaths(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderRenderedPathAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeleteRenderedServicePaths: {}", ret);
-        } catch (InterruptedException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        } catch (ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        return ret;
-    }
-
     /**
      * This method deletes a RSP from the datastore and frees the Path ID
      * <p>
@@ -854,40 +694,6 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * This method is an executor wrapper around a method that
-     * deletes a RSP from the datastore
-     * <p>
-     *
-     * @param renderedServicePathName RSP name
-     * @return Nothing.
-     */
-    public static boolean deleteRenderedServicePathExecutor(String renderedServicePathName) {
-        boolean ret = false;
-        printTraceStart(LOG);
-        Object[] servicePathObj = {renderedServicePathName};
-        Class[] servicePathClass = {String.class};
-        SfcProviderRenderedPathAPI sfcProviderRenderedPathAPI =
-                SfcProviderRenderedPathAPI.getDeleteRenderedServicePath(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderRenderedPathAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeleteRenderedServicePath: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        } catch (ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        if (!ret) {
-            LOG.error("{}: Failed to delete RSP {}", Thread.currentThread().getStackTrace()[1],
-                    renderedServicePathName);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * This method provides all necessary information for a system to construct
      * a NSH header and associated overlay packet to target the first
@@ -1027,7 +833,7 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
         }
 
         /* Read service chain sfcName if it exists */
-        serviceFunctionChain = SfcProviderServiceChainAPI.readServiceFunctionChainExecutor(sfcName);
+        serviceFunctionChain = SfcProviderServiceChainAPI.readServiceFunctionChain(sfcName);
 
         /* Create service chain sfcName if it doesn't exist */
         if (serviceFunctionChain == null) {
@@ -1035,7 +841,7 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
             ServiceFunctionChainBuilder sfcBuilder = new ServiceFunctionChainBuilder();
             sfcBuilder.setName(sfcName).setSfcServiceFunction(sfcServiceFunctionArrayList);
             serviceFunctionChain = sfcBuilder.build();
-            ret = SfcProviderServiceChainAPI.putServiceFunctionChainExecutor(serviceFunctionChain);
+            ret = SfcProviderServiceChainAPI.putServiceFunctionChain(serviceFunctionChain);
             if (ret == false) {
                 LOG.error("Failed to create ServiceFunctionChain: {}", sfcName);
                 return null;
@@ -1043,7 +849,7 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
         }
 
         /* Read ServiceFunctionPath pathName if it exists */
-        ServiceFunctionPath serviceFunctionPath = SfcProviderServicePathAPI.readServiceFunctionPathExecutor(pathName);
+        ServiceFunctionPath serviceFunctionPath = SfcProviderServicePathAPI.readServiceFunctionPath(pathName);
 
         /* Create ServiceFunctionPath pathName if it doesn't exist */
         if (serviceFunctionPath == null) {
@@ -1051,7 +857,7 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
             ServiceFunctionPathBuilder pathBuilder = new ServiceFunctionPathBuilder();
             pathBuilder.setName(pathName).setServiceChainName(sfcName);
             serviceFunctionPath = pathBuilder.build();
-            ret = SfcProviderServicePathAPI.putServiceFunctionPathExecutor(serviceFunctionPath);
+            ret = SfcProviderServicePathAPI.putServiceFunctionPath(serviceFunctionPath);
             if (ret == false) {
                 LOG.error("Failed to create ServiceFunctionPath: {}", pathName);
                 return null;
@@ -1075,8 +881,8 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
         }
 
         if ((serviceFunctionPath.getClassifier() != null) && SfcProviderServiceClassifierAPI
-            .readServiceClassifierExecutor(serviceFunctionPath.getClassifier()) != null) {
-            SfcProviderServiceClassifierAPI.addRenderedPathToServiceClassifierStateExecutor(
+            .readServiceClassifier(serviceFunctionPath.getClassifier()) != null) {
+            SfcProviderServiceClassifierAPI.addRenderedPathToServiceClassifierState(
                     serviceFunctionPath.getClassifier(), renderedServicePath.getName());
         } else {
             LOG.warn("Classifier not provided or does not exist");
@@ -1088,8 +894,8 @@ public class SfcProviderRenderedPathAPI extends SfcProviderAbstractAPI {
             if (revRenderedServicePath == null) {
                 LOG.error("Failed to create symmetric RenderedServicePath for ServiceFunctionPath: {}", pathName);
             } else if ((serviceFunctionPath.getSymmetricClassifier() != null) && SfcProviderServiceClassifierAPI
-                .readServiceClassifierExecutor(serviceFunctionPath.getSymmetricClassifier()) != null) {
-                SfcProviderServiceClassifierAPI.addRenderedPathToServiceClassifierStateExecutor(
+                .readServiceClassifier(serviceFunctionPath.getSymmetricClassifier()) != null) {
+                SfcProviderServiceClassifierAPI.addRenderedPathToServiceClassifierState(
                         serviceFunctionPath.getSymmetricClassifier(), revRenderedServicePath.getName());
             } else {
                 LOG.warn("Symmetric Classifier not provided or does not exist");
index fd8e87a836189b0f04dd945355d2119602db148d..8be5af179958238e1eb39525d2cc3cddd17cbeaf 100755 (executable)
@@ -12,11 +12,8 @@ import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStart;
 import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
 
 import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
 
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.sfc.provider.OpendaylightSfc;
 import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.ServiceFunctionSchedulerTypeIdentity;
 import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.ServiceFunctionSchedulerTypes;
 import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.service.function.scheduler.types.ServiceFunctionSchedulerType;
@@ -34,142 +31,28 @@ import org.slf4j.LoggerFactory;
  * @version 0.1
  * @since 2015-03-20
  */
-public class SfcProviderScheduleTypeAPI extends SfcProviderAbstractAPI {
+public class SfcProviderScheduleTypeAPI {
 
     private static final Logger LOG = LoggerFactory.getLogger(SfcProviderScheduleTypeAPI.class);
-    private static final OpendaylightSfc ODL_SFC = OpendaylightSfc.getOpendaylightSfcObj();
 
-    SfcProviderScheduleTypeAPI(Object[] params, String m) {
-        super(params, m);
-    }
-
-    SfcProviderScheduleTypeAPI(Object[] params, Class[] paramsTypes, String m) {
-        super(params, paramsTypes, m);
-    }
-
-    public static SfcProviderScheduleTypeAPI getPut(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderScheduleTypeAPI(params, paramsTypes, "putServiceFunctionScheduleType");
-    }
-
-    public static SfcProviderScheduleTypeAPI getRead(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderScheduleTypeAPI(params, paramsTypes, "readServiceFunctionScheduleType");
-    }
-
-    public static SfcProviderScheduleTypeAPI getDelete(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderScheduleTypeAPI(params, paramsTypes, "deleteServiceFunctionScheduleType");
-    }
-
-    public static SfcProviderScheduleTypeAPI getReadAll(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderScheduleTypeAPI(params, paramsTypes, "readAllServiceFunctionScheduleTypes");
-    }
-
-    /**
-     * This method puts service function schedule type.
-     *
-     * @return True if ST was put, false otherwise
-     */
-    public static boolean putServiceFunctionScheduleTypeExecutor(
-            ServiceFunctionSchedulerType serviceFunctionSchedulerType) {
-        printTraceStart(LOG);
-        boolean ret = false;
-        Object[] servicePathObj = {serviceFunctionSchedulerType};
-        Class[] servicePathClass = {ServiceFunctionSchedulerType.class};
-        SfcProviderScheduleTypeAPI sfcProviderScheduleTypeAPI =
-                SfcProviderScheduleTypeAPI.getPut(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderScheduleTypeAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeleteServiceFunctionState: {}", future.get());
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn("failed to ....", e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    /**
-     * This method deletes service function schedule type.
-     *
-     * @return True if ST was deleted, false otherwise
-     */
-    public static boolean deleteServiceFunctionScheduleTypeExecutor(
-            Class<? extends ServiceFunctionSchedulerTypeIdentity> serviceFunctionSchedulerType) {
-        printTraceStart(LOG);
-        boolean ret = false;
-        Object[] servicePathObj = {serviceFunctionSchedulerType};
-        Class[] servicePathClass = {serviceFunctionSchedulerType.getClass()};
-        SfcProviderScheduleTypeAPI sfcProviderScheduleTypeAPI =
-                SfcProviderScheduleTypeAPI.getDelete(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderScheduleTypeAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeleteServiceFunctionState: {}", future.get());
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn("failed to ....", e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    /**
-     * This method reads service function schedule type.
-     *
-     * @return If ST was read successfully, returns that ST
-     */
-    public static ServiceFunctionSchedulerType readServiceFunctionScheduleTypeExecutor(
-            Class<? extends ServiceFunctionSchedulerTypeIdentity> serviceFunctionSchedulerType) {
-        printTraceStart(LOG);
+    public static ServiceFunctionSchedulerType readEnabledServiceFunctionScheduleTypeEntry() {
         ServiceFunctionSchedulerType ret = null;
-        Object[] servicePathObj = {serviceFunctionSchedulerType};
-        Class[] servicePathClass = {serviceFunctionSchedulerType.getClass()};
-        SfcProviderScheduleTypeAPI sfcProviderScheduleTypeAPI =
-                SfcProviderScheduleTypeAPI.getRead(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderScheduleTypeAPI);
-        try {
-            ret = (ServiceFunctionSchedulerType) future.get();
-            LOG.debug("getDeleteServiceFunctionState: {}", future.get());
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn("failed to ....", e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    public static ServiceFunctionSchedulerType readEnabledServiceFunctionScheduleTypeEntryExecutor() {
-        ServiceFunctionSchedulerType ret = null;
-        Object[] sfstObj = {};
-        Class[] sfstClass = {};
-
         printTraceStart(LOG);
-        SfcProviderScheduleTypeAPI sfcProviderScheduleTypeAPI =
-                SfcProviderScheduleTypeAPI.getReadAll(sfstObj, sfstClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderScheduleTypeAPI);
-        try {
-            LOG.debug("getReadAll returns: {}", future.get());
-            ServiceFunctionSchedulerTypes serviceFunctionSchedulerTypes = (ServiceFunctionSchedulerTypes) future.get();
-            List<ServiceFunctionSchedulerType> sfScheduleTypeList =
-                    serviceFunctionSchedulerTypes.getServiceFunctionSchedulerType();
-            for (ServiceFunctionSchedulerType serviceFunctionSchedulerType : sfScheduleTypeList) {
-                if (serviceFunctionSchedulerType.isEnabled()) {
-                    ret = serviceFunctionSchedulerType;
-                    break;
-                }
+        ServiceFunctionSchedulerTypes serviceFunctionSchedulerTypes =
+                SfcProviderScheduleTypeAPI.readAllServiceFunctionScheduleTypes();
+        List<ServiceFunctionSchedulerType> sfScheduleTypeList =
+                serviceFunctionSchedulerTypes.getServiceFunctionSchedulerType();
+        for (ServiceFunctionSchedulerType serviceFunctionSchedulerType : sfScheduleTypeList) {
+            if (serviceFunctionSchedulerType.isEnabled()) {
+                ret = serviceFunctionSchedulerType;
+                break;
             }
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn("failed to ....", e);
         }
-
         printTraceStop(LOG);
         return ret;
     }
 
-    protected boolean putServiceFunctionScheduleType(ServiceFunctionSchedulerType serviceFunctionSchedulerType) {
+    public static boolean putServiceFunctionScheduleType(ServiceFunctionSchedulerType serviceFunctionSchedulerType) {
         boolean ret;
         printTraceStart(LOG);
 
@@ -185,7 +68,7 @@ public class SfcProviderScheduleTypeAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    protected boolean deleteServiceFunctionScheduleType(
+    public static boolean deleteServiceFunctionScheduleType(
             Class<? extends ServiceFunctionSchedulerTypeIdentity> serviceFunctionSchedulerType) {
         printTraceStart(LOG);
         boolean ret = false;
@@ -207,7 +90,7 @@ public class SfcProviderScheduleTypeAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    protected ServiceFunctionSchedulerType readServiceFunctionScheduleType(
+    public static ServiceFunctionSchedulerType readServiceFunctionScheduleType(
             Class<? extends ServiceFunctionSchedulerTypeIdentity> serviceFunctionSchedulerTypeIdentity) {
         printTraceStart(LOG);
         ServiceFunctionSchedulerType serviceFunctionSchedulerType;
@@ -226,7 +109,7 @@ public class SfcProviderScheduleTypeAPI extends SfcProviderAbstractAPI {
         return serviceFunctionSchedulerType;
     }
 
-    protected ServiceFunctionSchedulerTypes readAllServiceFunctionScheduleTypes() {
+    public static ServiceFunctionSchedulerTypes readAllServiceFunctionScheduleTypes() {
         ServiceFunctionSchedulerTypes serviceFunctionSchedulerTypes;
         printTraceStart(LOG);
 
index b457d50106c633c15b32574883012d7ffef0c520..5ece86f84aff2f5236ed44cef9c4db56febbf241 100755 (executable)
@@ -11,11 +11,7 @@ package org.opendaylight.sfc.provider.api;
 import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStart;
 import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
 
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.sfc.provider.OpendaylightSfc;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.ServiceFunctionChains;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.ServiceFunctionChainsState;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.service.function.chain.grouping.ServiceFunctionChain;
@@ -43,77 +39,9 @@ import org.slf4j.LoggerFactory;
  * @see org.opendaylight.sfc.provider.SfcProviderSfEntryDataListener
  * @since 2014-06-30
  */
-public class SfcProviderServiceChainAPI extends SfcProviderAbstractAPI {
+public class SfcProviderServiceChainAPI {
 
     private static final Logger LOG = LoggerFactory.getLogger(SfcProviderServiceChainAPI.class);
-    private static final OpendaylightSfc ODL_SFC = OpendaylightSfc.getOpendaylightSfcObj();
-    private static final String FAILED_TO_STR = "failed to ...";
-
-    SfcProviderServiceChainAPI(Object[] params, String m) {
-        super(params, m);
-    }
-
-    SfcProviderServiceChainAPI(Object[] params, Class[] paramsTypes, String m) {
-        super(params, paramsTypes, m);
-    }
-
-    public static SfcProviderServiceChainAPI getPut(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceChainAPI(params, paramsTypes, "putServiceFunctionChain");
-    }
-
-    public static SfcProviderServiceChainAPI getRead(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceChainAPI(params, paramsTypes, "readServiceFunctionChain");
-    }
-
-    public static SfcProviderServiceChainAPI getDelete(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceChainAPI(params, paramsTypes, "deleteServiceFunctionChain");
-    }
-
-    public static SfcProviderServiceChainAPI getPutAll(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceChainAPI(params, paramsTypes, "putAllServiceFunctionChains");
-    }
-
-    public static SfcProviderServiceChainAPI getReadAll(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceChainAPI(params, paramsTypes, "readAllServiceFunctionChains");
-    }
-
-    public static SfcProviderServiceChainAPI getDeleteAll(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceChainAPI(params, paramsTypes, "deleteAllServiceFunctionChains");
-    }
-
-    public static SfcProviderServiceChainAPI getSfcRef(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceChainAPI(params, paramsTypes, "getServiceFunctionChainsRef");
-    }
-
-    public static SfcProviderServiceChainAPI getSfcStateRef(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceChainAPI(params, paramsTypes, "getServiceFunctionChainsStateRef");
-    }
-
-    /**
-     * This method creates a service chain by Executor, it includes
-     * Executor creation and response management.
-     *
-     * @param serviceFunctionChain a ServiceFunctionChain object
-     * @return true if serviceFunctionChain was created, false otherwise
-     */
-    @SuppressWarnings("unused")
-    public static boolean putServiceFunctionChainExecutor(ServiceFunctionChain serviceFunctionChain) {
-        boolean ret = false;
-        Object[] sfcParameters = {serviceFunctionChain};
-        Class[] sfcParameterTypes = {ServiceFunctionChain.class};
-
-        printTraceStart(LOG);
-        try {
-            Object result = ODL_SFC.getExecutor()
-                .submit(SfcProviderServiceChainAPI.getPut(sfcParameters, sfcParameterTypes))
-                .get();
-            ret = (boolean) result;
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
 
     /**
      * This method reads the service function chain specified by the given name from
@@ -138,32 +66,6 @@ public class SfcProviderServiceChainAPI extends SfcProviderAbstractAPI {
         return sfc;
     }
 
-    /**
-     * This method reads the operational state for a service function.
-     *
-     * @param serviceFunctionName SF name
-     * @return A ServiceFunctionState object that is a list of all paths using
-     *         this service function, null otherwise
-     */
-    public static ServiceFunctionChain readServiceFunctionChainExecutor(String serviceFunctionName) {
-
-        printTraceStart(LOG);
-        ServiceFunctionChain ret = null;
-        Object[] servicePathObj = {serviceFunctionName};
-        Class[] servicePathClass = {String.class};
-        SfcProviderServiceChainAPI sfcProviderServiceChainAPI =
-                SfcProviderServiceChainAPI.getRead(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceChainAPI);
-        try {
-            ret = (ServiceFunctionChain) future.get();
-            LOG.debug("getRead: {}", future.get());
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn("failed to ....", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * This method deletes a single service path name from the Service Function
      * Chain operational data store
@@ -173,7 +75,6 @@ public class SfcProviderServiceChainAPI extends SfcProviderAbstractAPI {
      * @return A ServiceFunctionState object that is a list of all paths using
      *         this service function, null otherwise
      */
-    @SuppressWarnings("unused")
     public static boolean deletePathFromServiceFunctionChainState(String serviceFunctionChainName,
             String servicePathName) {
 
@@ -203,7 +104,6 @@ public class SfcProviderServiceChainAPI extends SfcProviderAbstractAPI {
      * @return A ServiceFunctionState object that is a list of all paths using
      *         this service function, null otherwise
      */
-    @SuppressWarnings("unused")
     public static boolean addPathToServiceFunctionChainState(String serviceFunctionChainName, String servicePathName) {
 
         printTraceStart(LOG);
@@ -228,49 +128,13 @@ public class SfcProviderServiceChainAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    public static ServiceFunctionChains getServiceFunctionChainsRefExecutor() {
-        printTraceStart(LOG);
-        ServiceFunctionChains ret = null;
-        Object[] servicePathObj = {};
-        Class[] servicePathClass = {};
-        SfcProviderServiceChainAPI sfcProviderServiceChainAPI =
-                SfcProviderServiceChainAPI.getSfcRef(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceChainAPI);
-        try {
-            ret = (ServiceFunctionChains) future.get();
-            LOG.debug("getRead: {}", future.get());
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn("failed to ....", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    public static ServiceFunctionChainsState getServiceFunctionChainsStateRefExecutor() {
-        printTraceStart(LOG);
-        ServiceFunctionChainsState ret = null;
-        Object[] servicePathObj = {};
-        Class[] servicePathClass = {};
-        SfcProviderServiceChainAPI sfcProviderServiceChainAPI =
-                SfcProviderServiceChainAPI.getSfcStateRef(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceChainAPI);
-        try {
-            ret = (ServiceFunctionChainsState) future.get();
-            LOG.debug("getRead: {}", future.get());
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn("failed to ....", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * This method creates a SFC from the datastore.
      *
      * @param serviceFunctionChain SFC object
      * @return true if SFC was created, false otherwise
      */
-    protected boolean putServiceFunctionChain(ServiceFunctionChain serviceFunctionChain) {
+    public static boolean putServiceFunctionChain(ServiceFunctionChain serviceFunctionChain) {
         boolean ret = false;
         printTraceStart(LOG);
 
@@ -295,8 +159,7 @@ public class SfcProviderServiceChainAPI extends SfcProviderAbstractAPI {
      * @param serviceFunctionChainName SFC name
      * @return true if SF was deleted, false otherwise
      */
-    @SuppressWarnings("unused")
-    protected boolean deleteServiceFunctionChain(String serviceFunctionChainName) {
+    protected static boolean deleteServiceFunctionChain(String serviceFunctionChainName) {
         boolean ret = false;
         printTraceStart(LOG);
         ServiceFunctionChainKey serviceFunctionChainKey = new ServiceFunctionChainKey(serviceFunctionChainName);
@@ -321,8 +184,7 @@ public class SfcProviderServiceChainAPI extends SfcProviderAbstractAPI {
      * @return A ServiceFunctionState object that is a list of all paths using
      *         this service function, null otherwise
      */
-    @SuppressWarnings("unused")
-    protected boolean putAllServiceFunctionChains(ServiceFunctionChains sfcs) {
+    protected static boolean putAllServiceFunctionChains(ServiceFunctionChains sfcs) {
         boolean ret = false;
         printTraceStart(LOG);
 
@@ -342,8 +204,7 @@ public class SfcProviderServiceChainAPI extends SfcProviderAbstractAPI {
      *
      * @return ServiceFunctionChains A object that contains all Service Functions Object
      */
-    @SuppressWarnings("unused")
-    protected ServiceFunctionChains readAllServiceFunctionChains() {
+    protected static ServiceFunctionChains readAllServiceFunctionChains() {
         ServiceFunctionChains sfcs;
         printTraceStart(LOG);
         InstanceIdentifier<ServiceFunctionChains> sfcsIID =
@@ -370,7 +231,7 @@ public class SfcProviderServiceChainAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    public ServiceFunctionChains getServiceFunctionChainsRef() {
+    public static ServiceFunctionChains getServiceFunctionChainsRef() {
         printTraceStart(LOG);
 
         InstanceIdentifier<ServiceFunctionChains> sfcsIID;
@@ -383,7 +244,7 @@ public class SfcProviderServiceChainAPI extends SfcProviderAbstractAPI {
         return sfc;
     }
 
-    protected ServiceFunctionChainsState getServiceFunctionChainsStateRef() {
+    protected static ServiceFunctionChainsState getServiceFunctionChainsStateRef() {
         printTraceStart(LOG);
 
         InstanceIdentifier<ServiceFunctionChainsState> sfcsIID;
index ded4e732ae34710f6ffb808e10c39f68e6a21be7..3dc23fd78a38d0102af08dc6aac684c2bd24ff33 100644 (file)
@@ -8,8 +8,10 @@
 
 package org.opendaylight.sfc.provider.api;
 
+import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStart;
+import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
+
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.sfc.provider.SfcReflection;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.scf.rev140701.ServiceFunctionClassifiers;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.scf.rev140701.ServiceFunctionClassifiersState;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.scf.rev140701.service.function.classifiers.ServiceFunctionClassifier;
@@ -23,12 +25,6 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
-import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStart;
-import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
-
 
 /**
  * This class has the APIs to operate on the Service Classifier datastore.
@@ -42,28 +38,9 @@ import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
  * <p>
  * @since 2014-11-04
  */
-public class SfcProviderServiceClassifierAPI extends SfcProviderAbstractAPI {
+public class SfcProviderServiceClassifierAPI {
 
     private static final Logger LOG = LoggerFactory.getLogger(SfcProviderServiceClassifierAPI.class);
-    private static final String FAILED_TO_STR = "failed to ...";
-
-    SfcProviderServiceClassifierAPI(Object[] params, String m) {
-        super(params, m);
-    }
-
-    SfcProviderServiceClassifierAPI(Object[] params, Class[] paramsTypes, String m) {
-        super(params, paramsTypes, m);
-    }
-
-
-    public static SfcProviderServiceClassifierAPI getRead(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceClassifierAPI(params, paramsTypes, "readServiceClassifier");
-    }
-
-    public static SfcProviderServiceClassifierAPI getAddRenderedPathToServiceClassifierStateExecutor
-            (Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceClassifierAPI(params, paramsTypes, "addRenderedPathToServiceClassifierState");
-    }
 
     /**
      * We iterate through all service paths that use this service function and if
@@ -73,8 +50,7 @@ public class SfcProviderServiceClassifierAPI extends SfcProviderAbstractAPI {
      * @param renderedPathName Rendered Path name
      * @return Nothing.
      */
-    @SuppressWarnings("unused")
-    public static boolean addRenderedPathToServiceClassifierState (String serviceClassifierName, String renderedPathName) {
+    public static boolean addRenderedPathToServiceClassifierState(String serviceClassifierName, String renderedPathName) {
 
         printTraceStart(LOG);
         InstanceIdentifier<SclRenderedServicePath> sclIID;
@@ -101,44 +77,13 @@ public class SfcProviderServiceClassifierAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * We iterate through all service paths that use this service function and if
-     * necessary, remove them.
-     * <p>
-     * @param serviceClassifierName Service Function Classifier name
-     * @param renderedPathName Rendered Path name
-     * @return Nothing.
-     */
-    @SuppressWarnings("unused")
-    public static boolean addRenderedPathToServiceClassifierStateExecutor (String serviceClassifierName, String renderedPathName) {
-
-        printTraceStart(LOG);
-        boolean ret = true;
-        Object[] functionParams = {serviceClassifierName, renderedPathName};
-        Class[] functionParamsTypes = {String.class, String.class};
-        Future future = ODL_SFC.getExecutor().submit(SfcProviderServiceClassifierAPI
-                .getAddRenderedPathToServiceClassifierStateExecutor(functionParams, functionParamsTypes));
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getAddRenderedPathToServiceClassifierStateExecutor returns: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn(FAILED_TO_STR , e);
-        } catch (ExecutionException e) {
-            LOG.warn(FAILED_TO_STR , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * This method reads a classifier from DataStore
      * <p>
      * @param serviceClassifierName Classifier name
      * @return SF object or null if not found
      */
-    @SuppressWarnings("unused")
-    @SfcReflection
-    protected ServiceFunctionClassifier readServiceClassifier(String serviceClassifierName) {
+    public static ServiceFunctionClassifier readServiceClassifier(String serviceClassifierName) {
         printTraceStart(LOG);
         ServiceFunctionClassifier scl;
         InstanceIdentifier<ServiceFunctionClassifier> sclIID;
@@ -153,33 +98,4 @@ public class SfcProviderServiceClassifierAPI extends SfcProviderAbstractAPI {
     }
 
 
-    /**
-     * Wrapper API to reads a service function classifier from datastore
-     * <p>
-     * @param serviceClassifierName Service Classifier Name
-     * @return A ServiceFunctionState object that is a list of all paths using
-     * this service function, null otherwise
-     */
-    public static ServiceFunctionClassifier readServiceClassifierExecutor(String serviceClassifierName) {
-
-        printTraceStart(LOG);
-        ServiceFunctionClassifier ret = null;
-        Object[] servicePathObj = {serviceClassifierName};
-        Class[] servicePathClass = {String.class};
-        SfcProviderServiceClassifierAPI sfcProviderServiceClassifierAPI = SfcProviderServiceClassifierAPI
-                .getRead(servicePathObj, servicePathClass);
-        Future future  = ODL_SFC.getExecutor().submit(sfcProviderServiceClassifierAPI);
-        try {
-            ret = (ServiceFunctionClassifier) future.get();
-            LOG.debug("getRead: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-
 }
index e66fd632546296ca44ba948a0de49c7c764d5e8d..18a0963dea6d54cfd6ef7509ab1a98c9c47cbb39 100755 (executable)
@@ -9,10 +9,15 @@
 
 package org.opendaylight.sfc.provider.api;
 
-import com.google.common.base.Preconditions;
+import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStart;
+import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.sfc.provider.OpendaylightSfc;
-import org.opendaylight.sfc.provider.SfcReflection;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.rendered.service.paths.RenderedServicePath;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.rendered.service.paths.rendered.service.path.RenderedServicePathHop;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.functions.ServiceFunction;
@@ -35,14 +40,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
-import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStart;
-import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
+import com.google.common.base.Preconditions;
 
 /**
  * This class has the APIs to operate on the ServiceFunction
@@ -59,70 +57,9 @@ import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
  * <p>
  * @since 2014-06-30
  */
-public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
+public class SfcProviderServiceForwarderAPI {
 
     private static final Logger LOG = LoggerFactory.getLogger(SfcProviderServiceForwarderAPI.class);
-    private static final String FAILED_TO_STR = "failed to ...";
-
-
-    SfcProviderServiceForwarderAPI(Object[] params, String m) {
-        super(params, m);
-    }
-
-    SfcProviderServiceForwarderAPI(Object[] params, Class[] paramsTypes, String m) {
-        super(params, paramsTypes, m);
-    }
-
-
-    public static SfcProviderServiceForwarderAPI getPut(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceForwarderAPI(params, paramsTypes, "putServiceFunctionForwarder");
-    }
-    public static SfcProviderServiceForwarderAPI getRead(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceForwarderAPI(params, paramsTypes, "readServiceFunctionForwarder");
-    }
-    public static SfcProviderServiceForwarderAPI getReadSffState(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceForwarderAPI(params, paramsTypes, "readSffState");
-    }
-    @SuppressWarnings("unused")
-    public static SfcProviderServiceForwarderAPI getDelete(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceForwarderAPI(params, paramsTypes, "deleteServiceFunctionForwarder");
-    }
-    @SuppressWarnings("unused")
-    public static SfcProviderServiceForwarderAPI getPutAll(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceForwarderAPI(params, paramsTypes, "putAllServiceFunctionForwarders");
-    }
-    @SuppressWarnings("unused")
-    public static SfcProviderServiceForwarderAPI getReadAll(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceForwarderAPI(params, paramsTypes, "readAllServiceFunctionForwarders");
-    }
-    public static SfcProviderServiceForwarderAPI getDeleteAll(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceForwarderAPI(params, paramsTypes, "deleteAllServiceFunctionForwarders");
-    }
-    @SuppressWarnings("unused")
-    public static SfcProviderServiceForwarderAPI getDeleteServiceFunctionFromForwarder(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceForwarderAPI(params, paramsTypes, "deleteServiceFunctionFromForwarder");
-    }
-    public static SfcProviderServiceForwarderAPI getCheckServiceForwarderAPI(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceForwarderAPI(params, paramsTypes, "checkServiceFunctionForwarder");
-    }
-    public static SfcProviderServiceForwarderAPI getUpdate(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceForwarderAPI(params, paramsTypes, "updateServiceFunctionForwarder");
-    }
-    public static SfcProviderServiceForwarderAPI getAddPathToServiceForwarderState(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceForwarderAPI(params, paramsTypes, "addPathToServiceForwarderState");
-    }
-    public static SfcProviderServiceForwarderAPI getDeletePathFromServiceForwarderState(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceForwarderAPI(params, paramsTypes, "deletePathFromServiceForwarderState");
-    }
-    public static SfcProviderServiceForwarderAPI getDeletePathsUsedByServiceForwarder(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceForwarderAPI(params, paramsTypes, "deleteRenderedPathsUsedByServiceForwarder");
-    }
-    public static SfcProviderServiceForwarderAPI getDeleteServiceFunctionForwarderState(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceForwarderAPI(params, paramsTypes, "deleteServiceFunctionForwarderState");
-    }
-    public static SfcProviderServiceForwarderAPI getDeleteSffDataPlaneLocator(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceForwarderAPI(params, paramsTypes, "deleteSffDataPlaneLocator");
-    }
 
     /**
      * This method creates a SFF in the data store
@@ -130,7 +67,7 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
      * @param sff SFF object
      * @return true if SFF was created, false otherwise
      */
-    protected boolean putServiceFunctionForwarder(ServiceFunctionForwarder sff) {
+    public static boolean putServiceFunctionForwarder(ServiceFunctionForwarder sff) {
         boolean ret;
         printTraceStart(LOG);
         InstanceIdentifier<ServiceFunctionForwarder> sffEntryIID = InstanceIdentifier.builder(ServiceFunctionForwarders.class).
@@ -142,36 +79,6 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * Creates a executor and calls appropriate function
-     * to put SFF into DataStore
-     *
-     * <p>
-     * @param serviceFunctionForwarder Service Function Forwarder Object
-     * @return Nothing.
-     */
-    public static boolean putServiceFunctionForwarderExecutor(ServiceFunctionForwarder serviceFunctionForwarder) {
-
-        printTraceStart(LOG);
-        boolean ret = false;
-        Object[] servicePathObj = {serviceFunctionForwarder};
-        Class[] servicePathClass = {ServiceFunctionForwarder.class};
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = SfcProviderServiceForwarderAPI
-                .getPut(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceForwarderAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getPut: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-
     /**
      * This method searches for a data plane locator of a given name within a SFF
      * <p>
@@ -203,7 +110,7 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
      * @param sffLocatorName SffDataPlaneLocator name
      * @return true if SffDataPlane locator was deleted, false otherwise
      */
-    protected boolean deleteSffDataPlaneLocator(String sffName, String sffLocatorName) {
+    protected static boolean deleteSffDataPlaneLocator(String sffName, String sffLocatorName) {
         boolean ret = false;
         printTraceStart(LOG);
 
@@ -225,35 +132,6 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * Creates a executor and calls appropriate function
-     * to delete SffDataPlaneLocator from SFF stored in configuraiton DataStore
-     *
-     * <p>
-     * @param sffName SFF name
-     * @param sffLocatorName SffDataPlaneLocator name
-     * @return true if SffDataPlane locator was deleted, false otherwise
-     */
-    public static boolean deleteSffDataPlaneLocatorExecutor(String sffName, String sffLocatorName) {
-        printTraceStart(LOG);
-        boolean ret = false;
-        Object[] methodObjects = {sffName, sffLocatorName};
-        Class[] methodClasses = {String.class, String.class};
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = SfcProviderServiceForwarderAPI
-                .getDeleteSffDataPlaneLocator(methodObjects, methodClasses);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceForwarderAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeleteSffDataPlaneLocator: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * This method reads a SFF from the datastore
      * <p>
@@ -279,7 +157,7 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
      * @param serviceFunctionForwarderName SFF name
      * @return true if SF was deleted, false otherwise
      */
-    protected boolean deleteServiceFunctionForwarder(String serviceFunctionForwarderName) {
+    public static boolean deleteServiceFunctionForwarder(String serviceFunctionForwarderName) {
         boolean ret = false;
         printTraceStart(LOG);
         ServiceFunctionForwarderKey serviceFunctionForwarderKey = new ServiceFunctionForwarderKey(serviceFunctionForwarderName);
@@ -295,42 +173,13 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * Creates a executor and calls appropriate function
-     * to delete SFF from DataStore
-     *
-     * <p>
-     * @param serviceFunctionForwarderName Service Function Forwarder Name
-     * @return Nothing.
-     */
-    public static boolean deleteServiceFunctionForwarderExecutor(String serviceFunctionForwarderName) {
-
-        printTraceStart(LOG);
-        boolean ret = false;
-        Object[] servicePathObj = {serviceFunctionForwarderName};
-        Class[] servicePathClass = {String.class};
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = SfcProviderServiceForwarderAPI
-                .getDelete(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceForwarderAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDelete: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * Put all Service Function Forwarders in the data store
      *
      * <p>
      * @return true is all SFFs were created, false otherwise
      */
-    protected boolean putAllServiceFunctionForwarders(ServiceFunctionForwarders sffs) {
+    public static boolean putAllServiceFunctionForwarders(ServiceFunctionForwarders sffs) {
         boolean ret;
         printTraceStart(LOG);
 
@@ -340,42 +189,13 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * Creates a wrapper executor around a method to add a ServiceFunctionForwarder
-     * object to into DataStore
-     *
-     * <p>
-     * @param serviceFunctionForwarders Service Function Forwarders Object
-     * @return Nothing.
-     */
-    public static boolean putAllServiceFunctionForwardersExecutor(ServiceFunctionForwarders serviceFunctionForwarders) {
-
-        printTraceStart(LOG);
-        boolean ret = false;
-        Object[] servicePathObj = {serviceFunctionForwarders};
-        Class[] servicePathClass = {ServiceFunctionForwarders.class};
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = SfcProviderServiceForwarderAPI
-                .getPutAll(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceForwarderAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("putAllServiceFunctionForwardersExecutor: {}", ret);
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * Read all Service Function Forwarders
      * devices
      * <p>
      * @return ServiceFunctionForwarders object
      */
-    protected ServiceFunctionForwarders readAllServiceFunctionForwarders() {
+    protected static ServiceFunctionForwarders readAllServiceFunctionForwarders() {
         ServiceFunctionForwarders sffs;
         printTraceStart(LOG);
         InstanceIdentifier<ServiceFunctionForwarders> sffsIID =
@@ -387,33 +207,6 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
         return sffs;
     }
 
-    /**
-     * This method creates an executor and reads all the Service Function
-     * Forwarders from SFC datastore
-     * <p>
-     * @return ServiceFunctionForwarders object including all Service Function
-     * Forwarders
-     */
-    public static ServiceFunctionForwarders readAllServiceFunctionForwardersExecutor() {
-        printTraceStart(LOG);
-        ServiceFunctionForwarders ret = null;
-        Object[] servicePathObj = {};
-        Class[] servicePathClass = {};
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = SfcProviderServiceForwarderAPI
-                .getReadAll(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceForwarderAPI);
-        try {
-            ret = (ServiceFunctionForwarders) future.get();
-            LOG.debug("getReadAll: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * Delete All Service Function Forwarders in the data store
      * devices
@@ -423,14 +216,10 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
     protected boolean deleteAllServiceFunctionForwarders() {
         boolean ret = false;
         printTraceStart(LOG);
-        if (ODL_SFC.getDataProvider() != null) {
-
-            InstanceIdentifier<ServiceFunctionForwarders> sffsIID =
-                    InstanceIdentifier.builder(ServiceFunctionForwarders.class).build();
-
-            if (SfcDataStoreAPI.deleteTransactionAPI(sffsIID, LogicalDatastoreType.CONFIGURATION)) {
-                ret = true;
-            }
+        InstanceIdentifier<ServiceFunctionForwarders> sffsIID =
+                InstanceIdentifier.builder(ServiceFunctionForwarders.class).build();
+        if (SfcDataStoreAPI.deleteTransactionAPI(sffsIID, LogicalDatastoreType.CONFIGURATION)) {
+            ret = true;
         }
         printTraceStop(LOG);
         return ret;
@@ -476,7 +265,7 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
      * @param serviceFunctionForwarder ServiceFunctionForwarder object
      * @return true if SFF was updated, false otherwise
      */
-    public boolean updateServiceFunctionForwarder(ServiceFunctionForwarder serviceFunctionForwarder) {
+    public static boolean updateServiceFunctionForwarder(ServiceFunctionForwarder serviceFunctionForwarder) {
         printTraceStart(LOG);
 
         Preconditions.checkNotNull(serviceFunctionForwarder);
@@ -496,35 +285,6 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * Creates a executor and calls appropriate function to update
-     * SFF configuration
-     *
-     * <p>
-     * @param serviceFunctionForwarder Service Function Forwarder Object
-     * @return true if SFF was updated, false otherwise.
-     */
-    public static boolean updateServiceFunctionForwarderExecutor(ServiceFunctionForwarder serviceFunctionForwarder) {
-
-        printTraceStart(LOG);
-        boolean ret = false;
-        Object[] serviceForwarderObject = {serviceFunctionForwarder};
-        Class[] serviceForwarderClass = {ServiceFunctionForwarder.class};
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = SfcProviderServiceForwarderAPI
-                .getUpdate(serviceForwarderObject, serviceForwarderClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceForwarderAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getUpdate: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * We add the path name to the operational store of each SFF.
      *
@@ -532,7 +292,7 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
      * @param pathName Service Function Path Object
      * @return Nothing.
      */
-    public boolean addPathToServiceForwarderState(String pathName) {
+    public static boolean addPathToServiceForwarderState(String pathName) {
 
         printTraceStart(LOG);
 
@@ -577,7 +337,7 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
      * @param renderedServicePath RSP Object
      * @return Nothing.
      */
-    public boolean addPathToServiceForwarderState(RenderedServicePath renderedServicePath) {
+    public static boolean addPathToServiceForwarderState(RenderedServicePath renderedServicePath) {
 
         printTraceStart(LOG);
 
@@ -613,62 +373,6 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * We add the path name to the operational store of each SFF.
-     *
-     * <p>
-     * @param pathName Service Function Path Object
-     * @return Nothing.
-     */
-    public static boolean addPathToServiceForwarderStateExecutor(String pathName) {
-
-        printTraceStart(LOG);
-        boolean ret = false;
-        Object[] servicePathObj = {pathName};
-        Class[] servicePathClass = {String.class};
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = SfcProviderServiceForwarderAPI
-                .getAddPathToServiceForwarderState(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceForwarderAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getAddPathToServiceForwarderState: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    /**
-     * We add the path name to the operational store of each SFF.
-     *
-     * <p>
-     * @param renderedServicePath RSP Object
-     * @return Nothing.
-     */
-    public static boolean addPathToServiceForwarderStateExecutor(RenderedServicePath renderedServicePath) {
-
-        printTraceStart(LOG);
-        boolean ret = false;
-        Object[] servicePathObj = {renderedServicePath};
-        Class[] servicePathClass = {RenderedServicePath.class};
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = SfcProviderServiceForwarderAPI
-                .getAddPathToServiceForwarderState(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceForwarderAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getAddPathToServiceForwarderState: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * When a SFF is deleted we need to delete all SFPs from the
      * associated SFF operational state
@@ -677,8 +381,7 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
      * @param serviceFunctionPath SFP object
      * @return true if all paths were deleted, false otherwise.
      */
-    @SuppressWarnings("unused")
-    public boolean deletePathFromServiceForwarderState(ServiceFunctionPath serviceFunctionPath) {
+    public static boolean deletePathFromServiceForwarderState(ServiceFunctionPath serviceFunctionPath) {
 
         printTraceStart(LOG);
 
@@ -754,100 +457,6 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * Creates a executor and calls appropriate function to to remove
-     * SFF operational state for given Service Path
-     *
-     * <p>
-     * @param serviceFunctionPath Service Function Path Object
-     * @return Nothing.
-     */
-    public static boolean deletePathFromServiceForwarderStateExecutor(ServiceFunctionPath serviceFunctionPath) {
-
-        printTraceStart(LOG);
-        boolean ret = false;
-        Object[] servicePathObj = {serviceFunctionPath};
-        Class[] servicePathClass = {ServiceFunctionPath.class};
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = SfcProviderServiceForwarderAPI
-                .getDeletePathFromServiceForwarderState(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceForwarderAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeletePathFromServiceForwarderState: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    /**
-     * Creates a executor and calls appropriate function to to remove
-     * the given list of service paths from SFF operational state
-     *
-     * <p>
-     * @param servicePaths String List of Service Path names
-     * @return True if paths were deleted, false otherwise
-     */
-    public static boolean deletePathFromServiceForwarderStateExecutor(List<String> servicePaths) {
-
-        printTraceStart(LOG);
-        boolean ret = false;
-
-        Object[] servicePathObj = {servicePaths};
-        Class[] servicePathClass = {List.class};
-
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = SfcProviderServiceForwarderAPI
-                .getDeletePathFromServiceForwarderState(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceForwarderAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeletePathFromServiceForwarderState: {}", ret);
-        } catch (InterruptedException e) {
-            LOG.warn(FAILED_TO_STR , e);
-        } catch (ExecutionException e) {
-            LOG.warn(FAILED_TO_STR , e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        return ret;
-    }
-
-
-    /**
-     * Creates a executor and calls appropriate function to to remove
-     * SFF operational state for given Service Path
-     *
-     * <p>
-     * @param rspName Service Function Path Object
-     * @return Nothing.
-     */
-    public static boolean deletePathFromServiceForwarderStateExecutor(String rspName) {
-
-        printTraceStart(LOG);
-        boolean ret = false;
-        Object[] servicePathObj = {rspName};
-        Class[] servicePathClass = {String.class};
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = SfcProviderServiceForwarderAPI
-                .getDeletePathFromServiceForwarderState(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceForwarderAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeletePathFromServiceForwarderState: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-
     /**
      * When a SFF is deleted we need to delete all SFPs from the
      * associated SFF operational state
@@ -856,8 +465,6 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
      * @param rspName SFP object
      * @return true if all path was deleted, false otherwise.
      */
-    @SuppressWarnings("unused")
-    @SfcReflection
     public static boolean deletePathFromServiceForwarderState(String rspName) {
 
         printTraceStart(LOG);
@@ -932,32 +539,6 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * This method deletes the operational state for the given SFF name.
-     * <p>
-     * @param sffName SFF name
-     * @return true if state was deletes, false otherwise
-     */
-    public static boolean deleteServiceFunctionForwarderStateExecutor(String sffName) {
-        printTraceStart(LOG);
-        boolean ret = false;
-        Object[] servicePathObj = {sffName};
-        Class[] servicePathClass = {String.class};
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = SfcProviderServiceForwarderAPI
-                .getDeleteServiceFunctionForwarderState(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceForwarderAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeleteServiceFunctionForwarderState: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * Returns the list of SFPs anchored by a SFF
      *
@@ -988,63 +569,6 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * Wrapper API to read the list of SFPs anchored by the given SFF name. It
-     * includes Executor creation and response management
-     *
-     * <p>
-     * @param sffName SFF name
-     * @return ServiceFunctionState.
-     */
-    public static List<SffServicePath> readSffStateExecutor(String sffName) {
-        printTraceStart(LOG);
-        List<SffServicePath> ret = null;
-
-        // SFF deletion is a critical event. If a SFF is deleted we delete all associated SFPs
-        Object[] serviceForwarderObj = {sffName};
-        Class[] serviceForwarderClass = {String.class};
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = SfcProviderServiceForwarderAPI
-                .getReadSffState(serviceForwarderObj, serviceForwarderClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceForwarderAPI);
-        try {
-            ret = (List<SffServicePath>) future.get();
-            LOG.debug("getReadSffState: {}", ret);
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        return ret;
-    }
-
-    /**
-     * Wrapper API to read a SFF given the SFF name. It
-     * includes Executor creation and response management
-     *
-     * <p>
-     * @param sffName SFF name
-     * @return ServiceFunctionForwarder.
-     */
-    public static ServiceFunctionForwarder readServiceFunctionForwarderExecutor(String sffName) {
-        printTraceStart(LOG);
-        ServiceFunctionForwarder ret = null;
-
-        Object[] serviceFunctionForwarderObj = {sffName};
-        Class[] serviceFunctionForwarderClass = {String.class};
-        SfcProviderServiceForwarderAPI sfcProviderServiceFunctionForwarderAPI = SfcProviderServiceForwarderAPI
-                .getRead(serviceFunctionForwarderObj, serviceFunctionForwarderClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceFunctionForwarderAPI);
-        try {
-            ret = (ServiceFunctionForwarder) future.get();
-            LOG.debug("getReadServiceFunctionForwarder: {}", ret);
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        return ret;
-    }
-
     /**
      * Deletes all RSPs used by the given SFF object
      *
@@ -1052,8 +576,6 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
      * @param serviceFunctionForwarder SFF Object
      * @return true if all RSPs were deleted, false otherwise
      */
-    @SuppressWarnings("unused")
-    @SfcReflection
     public static boolean deleteRenderedPathsUsedByServiceForwarder(ServiceFunctionForwarder serviceFunctionForwarder) {
 
         printTraceStart(LOG);
@@ -1084,68 +606,6 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
     }
 
     /**
-     * Attaches the path name to the operational store of each SFF.
-     *
-     * <p>
-     * @param sfpName SF name
-     * @param sffName SFF name
-     * @return Nothing.
-     */
-    @SuppressWarnings("unused")
-    @SfcReflection
-    public static boolean deletePathFromServiceForwarderStateExecutor(String sfpName, String sffName) {
-
-        printTraceStart(LOG);
-        boolean ret = false;
-        Object[] servicePathObj = {sfpName, sffName};
-        Class[] servicePathClass = {String.class, String.class};
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = SfcProviderServiceForwarderAPI
-                .getDeletePathFromServiceForwarderState(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceForwarderAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeletePathFromServiceForwarderState: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    /**
-     * This method deletes all RSPs used by the given SFF
-     *
-     * <p>
-     * @param serviceFunctionForwarder SFF object
-     * @return Nothing.
-     */
-    @SuppressWarnings("unused")
-    public static boolean deletePathsUsedByServiceForwarderExecutor(ServiceFunctionForwarder serviceFunctionForwarder) {
-
-        printTraceStart(LOG);
-        boolean ret = true;
-
-        // SFF deletion is a critical event. If a SFF is deleted we delete all associated SFPs
-        Object[] serviceForwarderObj = {serviceFunctionForwarder};
-        Class[] serviceForwarderClass = {ServiceFunctionForwarder.class};
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = SfcProviderServiceForwarderAPI
-                .getDeletePathsUsedByServiceForwarder(serviceForwarderObj, serviceForwarderClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceForwarderAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.info("getDeletePathsUsedByServiceForwarder: {}", ret);
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-     /**
      * When a SFF is deleted we need to delete all SFPs from the
      * associated SFF operational state
      *
@@ -1154,8 +614,6 @@ public class SfcProviderServiceForwarderAPI extends SfcProviderAbstractAPI {
      * @param sffName SFF name
      * @return true if all paths were deleted, false otherwise.
      */
-    @SuppressWarnings("unused")
-    @SfcReflection
     public static boolean deletePathFromServiceForwarderState(String rspName, String sffName) {
 
         printTraceStart(LOG);
index cb523b49343506f0c1126337bd179aa2e605e184..a733af79e670dfb25283e5062b27e9bfc5964ff2 100755 (executable)
@@ -8,9 +8,14 @@
 
 package org.opendaylight.sfc.provider.api;
 
+import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStart;
+import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
+
+import java.util.ArrayList;
+import java.util.List;
+
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.sfc.provider.OpendaylightSfc;
-import org.opendaylight.sfc.provider.SfcReflection;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.rendered.service.paths.RenderedServicePath;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.rendered.service.paths.rendered.service.path.RenderedServicePathHop;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctions;
@@ -30,14 +35,6 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
-import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStart;
-import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
-
 /**
  * This class has the APIs to operate on the ServiceFunction
  * datastore.
@@ -52,57 +49,10 @@ import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
  * @see org.opendaylight.sfc.provider.SfcProviderSfEntryDataListener
  * @since 2014-06-30
  */
-public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
+public class SfcProviderServiceFunctionAPI {
 
     private static final Logger LOG = LoggerFactory.getLogger(SfcProviderServiceFunctionAPI.class);
 
-    SfcProviderServiceFunctionAPI(Object[] params, String m) {
-        super(params, m);
-    }
-
-    SfcProviderServiceFunctionAPI(Object[] params, Class[] paramsTypes, String m) {
-        super(params, paramsTypes, m);
-    }
-
-    public static SfcProviderServiceFunctionAPI getDeleteServicePathFromServiceFunctionState(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionAPI(params, paramsTypes, "deleteServicePathFromServiceFunctionState");
-    }
-    public static SfcProviderServiceFunctionAPI getPut(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionAPI(params, paramsTypes, "putServiceFunction");
-    }
-    public static SfcProviderServiceFunctionAPI getRead(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionAPI(params, paramsTypes, "readServiceFunction");
-    }
-    public static SfcProviderServiceFunctionAPI getReadServiceFunctionState(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionAPI(params, paramsTypes, "readServiceFunctionState");
-    }
-    public static SfcProviderServiceFunctionAPI getReadServiceFunctionStateAsStringList(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionAPI(params, paramsTypes, "readServiceFunctionStateAsStringList");
-    }
-    public static SfcProviderServiceFunctionAPI getDelete(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionAPI(params, paramsTypes, "deleteServiceFunction");
-    }
-    public static SfcProviderServiceFunctionAPI getDeleteServiceFunctionState(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionAPI(params, paramsTypes, "deleteServiceFunctionState");
-    }
-    public static SfcProviderServiceFunctionAPI getPutAll(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionAPI(params, paramsTypes, "putAllServiceFunctions");
-    }
-    public static SfcProviderServiceFunctionAPI getReadAll(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionAPI(params, paramsTypes, "readAllServiceFunctions");
-    }
-    public static SfcProviderServiceFunctionAPI getDeleteAll(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionAPI(params, paramsTypes, "deleteAllServiceFunctions");
-    }
-    public static SfcProviderServiceFunctionAPI getAddPathToServiceFunctionState(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionAPI(params, paramsTypes, "addPathToServiceFunctionState");
-    }
-    public static SfcProviderServiceFunctionAPI getReadServiceFunctionDescriptionMonitor(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionAPI(params, paramsTypes, "readServiceFunctionDescriptionMonitor");
-    }
-    public static SfcProviderServiceFunctionAPI getReadAllServiceFunctionsState(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionAPI(params, paramsTypes, "readAllServiceFunctionStates");
-    }
     /**
      * This method reads the operational state for a service function.
      * <p>
@@ -133,37 +83,6 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-
-    /**
-     * This method reads the operational state for a service function.
-     * <p>
-     * @param serviceFunctionName SF name
-     * @return A ServiceFunctionState object that is a list of all paths using
-     * this service function, null otherwise
-     */
-    public static List<SfServicePath> readServiceFunctionStateExecutor(String serviceFunctionName) {
-
-        printTraceStart(LOG);
-        List<SfServicePath> ret = null;
-        Object[] serviceFunctionObj = {serviceFunctionName};
-        Class[] serviceFunctionClass = {String.class};
-        SfcProviderServiceFunctionAPI sfcProviderServiceFunctionAPI = SfcProviderServiceFunctionAPI
-                .getReadServiceFunctionState(serviceFunctionObj, serviceFunctionClass);
-        Future future  = ODL_SFC.getExecutor().submit(sfcProviderServiceFunctionAPI);
-        try {
-            ret = (List<SfServicePath>) future.get();
-            LOG.debug("getRead: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * This method reads the operational state for a service function.
      * <p>
@@ -200,36 +119,6 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
 
     }
 
-    /**
-     * This method reads the operational state for a service function as a
-     * string list of service function paths
-     * <p>
-     * @param serviceFunctionName SF name
-     * @return A string list of service function paths
-     */
-    public static List<String> readServiceFunctionStateAsStringListExecutor(String serviceFunctionName) {
-
-        printTraceStart(LOG);
-        List<String> ret = null;
-        Object[] serviceFunctionNameObj = {serviceFunctionName};
-        Class[] serviceFunctionNameClass = {String.class};
-        SfcProviderServiceFunctionAPI sfcProviderServiceFunctionAPI = SfcProviderServiceFunctionAPI
-                .getReadServiceFunctionStateAsStringList(serviceFunctionNameObj, serviceFunctionNameClass);
-        Future future  = ODL_SFC.getExecutor().submit(sfcProviderServiceFunctionAPI);
-        try {
-            ret = (List<String>) future.get();
-            LOG.debug("getReadServiceFunctionStateAsStringList: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * This method reads the operational state for a service function.
      * <p>
@@ -260,36 +149,6 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * This method reads the operational state for a service function.
-     * <p>
-     * @param serviceFunctionName SF name
-     * @return service function description and monitor information
-     * null otherwise
-     */
-    public static SfcSfDescMon readServiceFunctionDescriptionMonitorExecutor(String serviceFunctionName) {
-
-        printTraceStart(LOG);
-        SfcSfDescMon ret = null;
-        Object[] serviceFunctionNameObj = {serviceFunctionName};
-        Class[] serviceFunctionNameClass = {String.class};
-        SfcProviderServiceFunctionAPI sfcProviderServiceFunctionAPI = SfcProviderServiceFunctionAPI
-                .getReadServiceFunctionDescriptionMonitor(serviceFunctionNameObj, serviceFunctionNameClass);
-        Future future  = ODL_SFC.getExecutor().submit(sfcProviderServiceFunctionAPI);
-        try {
-            ret = (SfcSfDescMon) future.get();
-            LOG.debug("getReadServiceFunctionDescriptionMonitor: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     protected ServiceFunctionsState readAllServiceFunctionStates() {
         ServiceFunctionsState sfsState = null;
         printTraceStart(LOG);
@@ -304,34 +163,6 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
         return sfsState;
     }
 
-    /**
-     * This method deletes the operational state for a service function.
-     * <p>
-     * @param serviceFunctionName SF name
-     * @return True if SF state was deleted, false otherwise
-     */
-    public static boolean deleteServiceFunctionStateExecutor(String serviceFunctionName) {
-        printTraceStart(LOG);
-        boolean ret = false;
-        Object[] serviceFunctionNameObj = {serviceFunctionName};
-        Class[] serviceFunctionNameClass = {String.class};
-        SfcProviderServiceFunctionAPI sfcProviderServiceFunctionAPI = SfcProviderServiceFunctionAPI
-                .getDeleteServiceFunctionState(serviceFunctionNameObj, serviceFunctionNameClass);
-        Future future  = ODL_SFC.getExecutor().submit(sfcProviderServiceFunctionAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeleteServiceFunctionState: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * This method deletes the operational state for a service function.
      * <p>
@@ -339,7 +170,6 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
      * @return A ServiceFunctionState object that is a list of all paths using
      * this service function, null otherwise
      */
-    @SuppressWarnings("unused")
     public static boolean deleteServiceFunctionState(String serviceFunctionName) {
         printTraceStart(LOG);
         boolean ret = false;
@@ -365,7 +195,6 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
      * @param pathName SFP name
      * @return true if SFP was added, false otherwise
      */
-    @SuppressWarnings("unused")
     public static boolean addPathToServiceFunctionState(String pathName) {
 
         boolean ret =  false;
@@ -419,7 +248,6 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
      * @param renderedServicePath RSP object
      * @return true if SFP was added, false otherwise
      */
-    @SuppressWarnings("unused")
     public static boolean addPathToServiceFunctionState(RenderedServicePath renderedServicePath) {
 
         boolean ret =  false;
@@ -467,63 +295,6 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
 
 
 
-    /**
-     * This method adds a RSP name to the corresponding SF operational state.
-     * <p>
-     * @param pathName RSP name
-     * @return true if RSP name was added, false otherwise
-     */
-    public static boolean addPathToServiceFunctionStateExecutor(String pathName) {
-        boolean ret =  false;
-        printTraceStart(LOG);
-
-        Object[] servicePathObj = {pathName};
-        Class[] servicePathClass = {String.class};
-        SfcProviderServiceFunctionAPI sfcProviderServiceFunctionAPI = SfcProviderServiceFunctionAPI
-                .getAddPathToServiceFunctionState(servicePathObj, servicePathClass);
-        Future future  = ODL_SFC.getExecutor().submit(sfcProviderServiceFunctionAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getAddPathToServiceFunctionState: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    /**
-     * This method adds a SFP name to the corresponding SF operational state.
-     * <p>
-     * @param renderedServicePath RSP object
-     * @return true if SFP was added, false otherwise
-     */
-    public static boolean addPathToServiceFunctionStateExecutor(RenderedServicePath renderedServicePath) {
-        boolean ret =  false;
-        printTraceStart(LOG);
-
-        Object[] servicePathObj = {renderedServicePath};
-        Class[] servicePathClass = {RenderedServicePath.class};
-        SfcProviderServiceFunctionAPI sfcProviderServiceFunctionAPI = SfcProviderServiceFunctionAPI
-                .getAddPathToServiceFunctionState(servicePathObj, servicePathClass);
-        Future future  = ODL_SFC.getExecutor().submit(sfcProviderServiceFunctionAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getAddPathToServiceFunctionState: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ....", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-
     /**
      * This method puts a SF to data store.
      * <p>
@@ -543,31 +314,6 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * Wrapper executor method adds a SF to the data store.
-     * <p>
-     * @param sf Service Function
-     * @return true if SF was added, false otherwise
-     */
-    public static boolean putServiceFunctionExecutor(ServiceFunction sf) {
-        boolean ret =  false;
-        printTraceStart(LOG);
-
-        Object[] serviceFunctionObj = {sf};
-        Class[] serviceFunctionClass = {ServiceFunction.class};
-        SfcProviderServiceFunctionAPI sfcProviderServiceFunctionAPI = SfcProviderServiceFunctionAPI
-                .getPut(serviceFunctionObj, serviceFunctionClass);
-        Future future  = ODL_SFC.getExecutor().submit(sfcProviderServiceFunctionAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("putServiceFunctionExecutor: {}", ret);
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * Add ServiceFunctionState to datastore
      * <p>
@@ -606,7 +352,6 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    @SuppressWarnings("unused")
     protected static boolean mergeServiceFunction(ServiceFunction sf) {
         boolean ret;
         printTraceStart(LOG);
@@ -625,9 +370,7 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
      * @param serviceFunctionName SF name
      * @return SF object or null if not found
      */
-    @SuppressWarnings("unused")
-    @SfcReflection
-    protected ServiceFunction readServiceFunction(String serviceFunctionName) {
+    public static ServiceFunction readServiceFunction(String serviceFunctionName) {
         printTraceStart(LOG);
         ServiceFunction sf;
         InstanceIdentifier<ServiceFunction> sfIID;
@@ -641,45 +384,13 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
         return sf;
     }
 
-    /**
-     * This method reads the operational state for a service function.
-     * <p>
-     * @param serviceFunctionName SF name
-     * @return A ServiceFunctionState object that is a list of all paths using
-     * this service function, null otherwise
-     */
-    public static ServiceFunction readServiceFunctionExecutor(String serviceFunctionName) {
-
-        printTraceStart(LOG);
-        ServiceFunction ret = null;
-        Object[] serviceFunctionObj = {serviceFunctionName};
-        Class[] serviceFunctionClass = {String.class};
-        SfcProviderServiceFunctionAPI sfcProviderServiceFunctionAPI = SfcProviderServiceFunctionAPI
-                .getRead(serviceFunctionObj, serviceFunctionClass);
-        Future future  = ODL_SFC.getExecutor().submit(sfcProviderServiceFunctionAPI);
-        try {
-            ret = (ServiceFunction) future.get();
-            LOG.debug("getRead: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-
     /**
      * This method deletes a SF from the datastore
      * <p>
      * @param serviceFunctionName SF name
      * @return true if SF was deleted, false otherwise
      */
-    @SuppressWarnings("unused")
-    protected boolean deleteServiceFunction(String serviceFunctionName) {
+    public static boolean deleteServiceFunction(String serviceFunctionName) {
         boolean ret = false;
         printTraceStart(LOG);
         ServiceFunctionKey serviceFunctionKey = new ServiceFunctionKey(serviceFunctionName);
@@ -695,36 +406,6 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * This method deletes a SF from the datastore
-     * <p>
-     * @param serviceFunctionName SF name
-     * @return true if SF was deleted, false otherwise
-     */
-    @SuppressWarnings("unused")
-    public static boolean deleteServiceFunctionExecutor(String serviceFunctionName) {
-        boolean ret = false;
-        printTraceStart(LOG);
-        Object[] servicePathObj = {serviceFunctionName};
-        Class[] servicePathClass = {String.class};
-        SfcProviderServiceFunctionAPI sfcProviderServiceFunctionAPI = SfcProviderServiceFunctionAPI
-                .getDelete(servicePathObj, servicePathClass);
-        Future future  = ODL_SFC.getExecutor().submit(sfcProviderServiceFunctionAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getRead: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-
     /**
      * This method adds a ServiceFunctions Object (collection of SFs) to the data store
      *
@@ -732,9 +413,7 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
      * @param  sfs Object holding ServiceFunctions
      * @return true is ServiceFunctions added to the datatore, false otherwise
      */
-    @SuppressWarnings("unused")
-    @SfcReflection
-    protected boolean putAllServiceFunctions(ServiceFunctions sfs) {
+    public static boolean putAllServiceFunctions(ServiceFunctions sfs) {
         boolean ret = false;
         printTraceStart(LOG);
         //InstanceIdentifier<ServiceFunctions> sfsIID = InstanceIdentifier.builder(ServiceFunctions.class).build();
@@ -747,36 +426,7 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * This method creates an executor wrapper that adds the ServiceFunctions to
-     * the datastore
-     *
-     * <p>
-     * @param  serviceFunctions Object holding ServiceFunctions
-     * @return true is ServiceFunctions added to the datatore, false otherwise
-     */
-    public static boolean putAllServiceFunctionsExecutor(ServiceFunctions serviceFunctions) {
-        printTraceStart(LOG);
-        boolean ret = false;
-        Object[] serviceFunctionsObj = {serviceFunctions};
-        Class[] serviceFunctionsClass = {ServiceFunctions.class};
-        SfcProviderServiceFunctionAPI sfcProviderServiceFunctionAPI = SfcProviderServiceFunctionAPI
-                .getPutAll(serviceFunctionsObj, serviceFunctionsClass);
-        Future future  = ODL_SFC.getExecutor().submit(sfcProviderServiceFunctionAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getPutAll: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-
-    protected ServiceFunctions readAllServiceFunctions() {
+    protected static ServiceFunctions readAllServiceFunctions() {
         ServiceFunctions sfs = null;
         printTraceStart(LOG);
         InstanceIdentifier<ServiceFunctions> sfsIID =
@@ -788,32 +438,6 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
         return sfs;
     }
 
-    /**
-     * This method creates an executor and reads all the Service Functions
-     * from SFC datastore
-     * <p>
-     * @return ServiceFunctions object including all Service Functions
-     */
-    public static ServiceFunctions readAllServiceFunctionsExecutor() {
-        printTraceStart(LOG);
-        ServiceFunctions ret = null;
-        Object[] serviceFunctionsObj = {};
-        Class[] serviceFunctionsClass = {};
-        SfcProviderServiceFunctionAPI sfcProviderServiceFunctionAPI = SfcProviderServiceFunctionAPI
-                .getReadAll(serviceFunctionsObj, serviceFunctionsClass);
-        Future future  = ODL_SFC.getExecutor().submit(sfcProviderServiceFunctionAPI);
-        try {
-            ret = (ServiceFunctions) future.get();
-            LOG.debug("getReadAll: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     protected boolean deleteAllServiceFunctions() {
         boolean ret = false;
         printTraceStart(LOG);
@@ -827,74 +451,6 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * Wrapper API to delete the given service path name from the all Service Functions
-     * that are used by the associated path. It includes Executes creation and response
-     * management.
-     * <p>
-     * @param serviceFunctionPath SFP object
-     * @return true if SF was deleted, false otherwise
-     */
-    @SuppressWarnings("unused")
-    public static boolean deleteServicePathFromServiceFunctionStateExecutor(ServiceFunctionPath serviceFunctionPath) {
-
-        boolean ret =  false;
-        printTraceStart(LOG);
-
-        Object[] servicePathObj = {serviceFunctionPath};
-        Class[] servicePathClass = {ServiceFunctionPath.class};
-        SfcProviderServiceFunctionAPI sfcProviderServiceFunctionAPI = SfcProviderServiceFunctionAPI
-                .getDeleteServicePathFromServiceFunctionState(servicePathObj, servicePathClass);
-        Future future  = ODL_SFC.getExecutor().submit(sfcProviderServiceFunctionAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeleteServicePathFromServiceFunctionState: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    /**
-     * Wrapper API to delete the given service path name from the all Service Functions
-     * that are used by the associated path. It includes Executes creation and response
-     * management.
-     *
-     * <p>
-     * @param rspList List of service path names
-     * @return true if SF was deleted, false otherwise
-     */
-    @SuppressWarnings("unused")
-    public static boolean deleteServicePathFromServiceFunctionStateExecutor(List<String> rspList) {
-
-        boolean ret =  false;
-        printTraceStart(LOG);
-
-        Object[] servicePathObj = {rspList};
-        Class[] servicePathClass = {List.class};
-        SfcProviderServiceFunctionAPI sfcProviderServiceFunctionAPI = SfcProviderServiceFunctionAPI
-                .getDeleteServicePathFromServiceFunctionState(servicePathObj, servicePathClass);
-        Future future  = ODL_SFC.getExecutor().submit(sfcProviderServiceFunctionAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeleteServicePathFromServiceFunctionState: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-
     /**
      * Delete the given service path name from the all Service Functions that are used by
      * the associated path
@@ -902,9 +458,7 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
      * @param serviceFunctionPath RSP object
      * @return true if SF was deleted, false otherwise
      */
-    @SuppressWarnings("unused")
-    @SfcReflection
-    public boolean deleteServicePathFromServiceFunctionState(ServiceFunctionPath serviceFunctionPath) {
+    public static boolean deleteServicePathFromServiceFunctionState(ServiceFunctionPath serviceFunctionPath) {
 
         boolean ret = true;
         RenderedServicePath renderedServicePath = SfcProviderRenderedPathAPI.readRenderedServicePath(serviceFunctionPath.getName());
@@ -947,38 +501,6 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * When a Service Path is deleted directly (not as a consequence of deleting a SF), we need
-     * to remove its reference from all the ServiceFunction states.
-     * <p>
-     * @param sfpName RSP List
-     * @return true if SF was deleted, false otherwise
-     */
-    @SuppressWarnings("unused")
-    public static boolean deleteServicePathFromServiceFunctionStateExecutor(String sfpName) {
-
-        boolean ret =  false;
-        printTraceStart(LOG);
-
-        Object[] servicePathObj = {sfpName};
-        Class[] servicePathClass = {String.class};
-        SfcProviderServiceFunctionAPI sfcProviderServiceFunctionAPI = SfcProviderServiceFunctionAPI
-                .getDeleteServicePathFromServiceFunctionState(servicePathObj, servicePathClass);
-        Future future  = ODL_SFC.getExecutor().submit(sfcProviderServiceFunctionAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeleteServicePathFromServiceFunctionState: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * This method removes the given Service Path from the all SF operational
      * states that use it.
@@ -991,8 +513,7 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
      * @param sfpName SFP name
      * @return true if SF was deleted, false otherwise
      */
-    @SuppressWarnings("unused")
-    public boolean deleteServicePathFromServiceFunctionState(String sfpName) {
+    public static boolean deleteServicePathFromServiceFunctionState(String sfpName) {
 
         printTraceStart(LOG);
         boolean ret = true;
@@ -1038,8 +559,6 @@ public class SfcProviderServiceFunctionAPI extends SfcProviderAbstractAPI {
      * @param sfName  SF name
      * @return true if SF was deleted, false otherwise
      */
-    @SuppressWarnings("unused")
-    @SfcReflection
     public static boolean deleteServicePathFromServiceFunctionState(String rspName, String sfName) {
 
         boolean ret;
index 26a198be1392ec4b4239ea25f4b38778a8ff55e6..cf60e3ef590cd12127029abdb65299b2c7aa10d3 100644 (file)
@@ -13,8 +13,6 @@ import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
 
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.service.function.chain.grouping.ServiceFunctionChain;
@@ -40,126 +38,10 @@ import org.slf4j.LoggerFactory;
  *          <p>
  * @since 2015-02-14
  */
-public class SfcProviderServiceFunctionGroupAPI extends SfcProviderAbstractAPI {
+public class SfcProviderServiceFunctionGroupAPI {
 
     private static final Logger LOG = LoggerFactory.getLogger(SfcProviderServiceFunctionGroupAPI.class);
 
-    SfcProviderServiceFunctionGroupAPI(Object[] params, String m) {
-        super(params, m);
-    }
-
-    @SuppressWarnings("rawtypes")
-    SfcProviderServiceFunctionGroupAPI(Object[] params, Class[] paramsTypes, String m) {
-        super(params, paramsTypes, m);
-    }
-
-    @SuppressWarnings("rawtypes")
-    public static SfcProviderServiceFunctionGroupAPI getPut(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionGroupAPI(params, paramsTypes, "putServiceFunctionGroup");
-    }
-
-    @SuppressWarnings("rawtypes")
-    public static SfcProviderServiceFunctionGroupAPI getRead(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionGroupAPI(params, paramsTypes, "readServiceFunctionGroup");
-    }
-
-    @SuppressWarnings("rawtypes")
-    public static SfcProviderServiceFunctionGroupAPI getByType(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionGroupAPI(params, paramsTypes, "getServiceFunctionGroupByType");
-    }
-
-    @SuppressWarnings("rawtypes")
-    public static SfcProviderServiceFunctionGroupAPI getDelete(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionGroupAPI(params, paramsTypes, "deleteServiceFunctionGroup");
-    }
-
-    @SuppressWarnings("rawtypes")
-    public static SfcProviderServiceFunctionGroupAPI getAddSF(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionGroupAPI(params, paramsTypes, "addServiceFunctionToGroup");
-    }
-
-    @SuppressWarnings("rawtypes")
-    public static SfcProviderServiceFunctionGroupAPI getRemoveSF(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionGroupAPI(params, paramsTypes, "removeServiceFunctionFromGroup");
-    }
-
-    public static ServiceFunctionGroup getServiceFunctionGroupbyTypeExecutor(
-            Class<? extends ServiceFunctionTypeIdentity> sft) {
-
-        printTraceStart(LOG);
-        ServiceFunctionGroup ret = null;
-        Object[] servicePathObj = {sft.getName()};
-        Class[] servicePathClass = {String.class};
-        SfcProviderServiceFunctionGroupAPI sfcProviderServiceFunctionGroupAPI =
-                SfcProviderServiceFunctionGroupAPI.getByType(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceFunctionGroupAPI);
-        try {
-            ret = (ServiceFunctionGroup) future.get();
-            LOG.debug("getRead: {}", future.get());
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn("failed to ....", e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    /**
-     * Puts a SFG in the datastore
-     * <p>
-     *
-     * @param sfg the ServiceFunctionGroup to put
-     * @return boolean success or failure
-     */
-    public static boolean putServiceFunctionGroupExecutor(ServiceFunctionGroup sfg) {
-
-        printTraceStart(LOG);
-        boolean ret = false;
-        Object[] servicePathObj = {sfg};
-        Class[] servicePathClass = {ServiceFunctionGroup.class};
-        SfcProviderServiceFunctionGroupAPI sfcProviderServiceFunctionGroupAPI =
-                SfcProviderServiceFunctionGroupAPI.getPut(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceFunctionGroupAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getRead: {}", future.get());
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn("failed to ....", e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    /**
-     * This method reads the service function group corresponding to the name.
-     *
-     * @param serviceFunctionGroupName SFG name
-     * @return service function group corresponding to the name
-     */
-    @SuppressWarnings("rawtypes")
-    public static ServiceFunctionGroup readServiceFunctionGroupExecutor(String serviceFunctionGroupName) {
-
-        printTraceStart(LOG);
-        ServiceFunctionGroup ret = null;
-        Object[] sfgObj = {serviceFunctionGroupName};
-        Class[] sfgClass = {String.class};
-        SfcProviderServiceFunctionGroupAPI sfgAPI = SfcProviderServiceFunctionGroupAPI.getRead(sfgObj, sfgClass);
-        Future future = ODL_SFC.getExecutor().submit(sfgAPI);
-        try {
-            ret = (ServiceFunctionGroup) future.get();
-            LOG.debug("getRead: {}", future.get());
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn("failed to ....", e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     public static List<String> getSfgNameList(ServiceFunctionChain serviceFunctionChain) {
         List<String> ret = new ArrayList<>();
         List<SfcServiceFunction> sfcServiceFunction = serviceFunctionChain.getSfcServiceFunction();
@@ -168,7 +50,7 @@ public class SfcProviderServiceFunctionGroupAPI extends SfcProviderAbstractAPI {
         if (sfcServiceFunction != null) {
             for (SfcServiceFunction sf : sfcServiceFunction) {
                 ServiceFunctionGroup sfg =
-                        SfcProviderServiceFunctionGroupAPI.getServiceFunctionGroupbyTypeExecutor(sf.getType());
+                        SfcProviderServiceFunctionGroupAPI.getServiceFunctionGroupByType(sf.getType());
                 LOG.debug("look for service function group of type {} and found {}", sf.getType(), sfg);
                 if (sfg != null) {
                     ret.add(sfg.getName());
@@ -187,7 +69,7 @@ public class SfcProviderServiceFunctionGroupAPI extends SfcProviderAbstractAPI {
      * @param serviceFunctionGroupName name
      * @return ServiceFunctionGroup object or null if not found
      */
-    protected ServiceFunctionGroup readServiceFunctionGroup(String serviceFunctionGroupName) {
+    public static ServiceFunctionGroup readServiceFunctionGroup(String serviceFunctionGroupName) {
         printTraceStart(LOG);
         ServiceFunctionGroup sfg;
         InstanceIdentifier<ServiceFunctionGroup> sfgIID;
@@ -208,7 +90,7 @@ public class SfcProviderServiceFunctionGroupAPI extends SfcProviderAbstractAPI {
      * @param serviceFunctionType function type
      * @return ServiceFunctionGroup object or null if not found
      */
-    protected ServiceFunctionGroup getServiceFunctionGroupByType(String serviceFunctionType) {
+    protected static ServiceFunctionGroup getServiceFunctionGroupByType(Class<? extends ServiceFunctionTypeIdentity> serviceFunctionType) {
         printTraceStart(LOG);
         ServiceFunctionGroup sfg = null;
         InstanceIdentifier<ServiceFunctionGroups> sfgIID;
@@ -218,7 +100,7 @@ public class SfcProviderServiceFunctionGroupAPI extends SfcProviderAbstractAPI {
 
         if (sfgs != null) {
             for (ServiceFunctionGroup element : sfgs.getServiceFunctionGroup()) {
-                if (element.getType().getName().equals(serviceFunctionType)) {
+                if (element.getType().equals(serviceFunctionType)) {
                     sfg = element;
                     LOG.debug("found group " + sfg + " that matches type " + serviceFunctionType);
                     break;
@@ -239,7 +121,7 @@ public class SfcProviderServiceFunctionGroupAPI extends SfcProviderAbstractAPI {
      * @param sfg the ServiceFunctionGroup to put
      * @return boolean success or failure
      */
-    protected boolean putServiceFunctionGroup(ServiceFunctionGroup sfg) {
+    public static boolean putServiceFunctionGroup(ServiceFunctionGroup sfg) {
         boolean ret;
         printTraceStart(LOG);
         InstanceIdentifier<ServiceFunctionGroup> sfgEntryIID = InstanceIdentifier.builder(ServiceFunctionGroups.class)
@@ -259,7 +141,7 @@ public class SfcProviderServiceFunctionGroupAPI extends SfcProviderAbstractAPI {
      * @param serviceFunctionGroupName SFG name
      * @return boolean success of failure
      */
-    protected boolean deleteServiceFunctionGroup(String serviceFunctionGroupName) {
+    protected static boolean deleteServiceFunctionGroup(String serviceFunctionGroupName) {
         boolean ret = false;
         printTraceStart(LOG);
         ServiceFunctionGroupKey serviceFunctionGroupKey = new ServiceFunctionGroupKey(serviceFunctionGroupName);
@@ -285,7 +167,7 @@ public class SfcProviderServiceFunctionGroupAPI extends SfcProviderAbstractAPI {
      * @param serviceFunctionName name of SF to add
      * @return boolean success of failure
      */
-    protected boolean addServiceFunctionToGroup(String serviceFunctionGroupName, String serviceFunctionName) {
+    protected static boolean addServiceFunctionToGroup(String serviceFunctionGroupName, String serviceFunctionName) {
         boolean ret = false;
         printTraceStart(LOG);
 
@@ -303,7 +185,7 @@ public class SfcProviderServiceFunctionGroupAPI extends SfcProviderAbstractAPI {
      * @param serviceFunctionName name of SF to remove
      * @return boolean success of failure
      */
-    protected boolean removeServiceFunctionFromGroup(String serviceFunctionGroupName, String serviceFunctionName) {
+    protected static boolean removeServiceFunctionFromGroup(String serviceFunctionGroupName, String serviceFunctionName) {
         boolean ret = false;
         printTraceStart(LOG);
 
index bf65d14e8de5656bac9d1ee4ab8630a255aa26bf..e7ce5b02237e6ab67943803ee7815543f2d3a529 100644 (file)
@@ -11,9 +11,6 @@ package org.opendaylight.sfc.provider.api;
 import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStart;
 import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
 
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.sfc.provider.OpendaylightSfc;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfg.alg.rev150214.ServiceFunctionGroupAlgorithms;
@@ -31,40 +28,17 @@ import org.slf4j.LoggerFactory;
  * @version 0.1 <p>
  * @since 2015-02-14
  */
-public class SfcProviderServiceFunctionGroupAlgAPI extends SfcProviderAbstractAPI {
+public class SfcProviderServiceFunctionGroupAlgAPI {
 
     private static final Logger LOG = LoggerFactory.getLogger(SfcProviderServiceFunctionGroupAlgAPI.class);
     private static final OpendaylightSfc ODL_SFC = OpendaylightSfc.getOpendaylightSfcObj();
 
-    SfcProviderServiceFunctionGroupAlgAPI(Object[] params, String m) {
-        super(params, m);
-    }
-
-    SfcProviderServiceFunctionGroupAlgAPI(Object[] params, Class[] paramsTypes, String m) {
-        super(params, paramsTypes, m);
-    }
-
-    @SuppressWarnings("rawtypes")
-    public static SfcProviderServiceFunctionGroupAlgAPI getPut(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionGroupAlgAPI(params, paramsTypes, "putServiceFunctionGroupAlgorithm");
-    }
-
-    @SuppressWarnings("rawtypes")
-    public static SfcProviderServiceFunctionGroupAlgAPI getRead(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionGroupAlgAPI(params, paramsTypes, "readServiceFunctionGroupAlgorithm");
-    }
-
-    @SuppressWarnings("rawtypes")
-    public static SfcProviderServiceFunctionGroupAlgAPI getDelete(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionGroupAlgAPI(params, paramsTypes, "deleteServiceFunctionGroupAlgorithm");
-    }
-
     /**
      * Reads a SFG Algorithm from the datastore <p>
      * @param serviceFunctionGroupAlgorithmName name
      * @return ServiceFunctionGroupAlgorithm object or null if not found
      */
-    protected ServiceFunctionGroupAlgorithm readServiceFunctionGroupAlgorithm(String serviceFunctionGroupAlgorithmName) {
+    protected static ServiceFunctionGroupAlgorithm readServiceFunctionGroupAlgorithm(String serviceFunctionGroupAlgorithmName) {
         printTraceStart(LOG);
         ServiceFunctionGroupAlgorithm sfgAlg;
         InstanceIdentifier<ServiceFunctionGroupAlgorithm> sfgAlgIID;
@@ -81,7 +55,7 @@ public class SfcProviderServiceFunctionGroupAlgAPI extends SfcProviderAbstractAP
      * @param sfgAlg the ServiceFunctionGroupAlgorithm to put
      * @return boolean success or failure
      */
-    protected boolean putServiceFunctionGroupAlgorithm(ServiceFunctionGroupAlgorithm sfgAlg) {
+    protected static boolean putServiceFunctionGroupAlgorithm(ServiceFunctionGroupAlgorithm sfgAlg) {
         boolean ret;
         printTraceStart(LOG);
         InstanceIdentifier<ServiceFunctionGroupAlgorithm> sfgAlgEntryIID = InstanceIdentifier.builder(ServiceFunctionGroupAlgorithms.class).child(ServiceFunctionGroupAlgorithm.class, sfgAlg.getKey()).toInstance();
@@ -97,7 +71,7 @@ public class SfcProviderServiceFunctionGroupAlgAPI extends SfcProviderAbstractAP
      * @param serviceFunctionGroupAlgorithmName SFG Algorithm name
      * @return boolean success of failure
      */
-    protected boolean deleteServiceFunctionGroupAlgorithm(String serviceFunctionGroupAlgorithmName) {
+    protected static boolean deleteServiceFunctionGroupAlgorithm(String serviceFunctionGroupAlgorithmName) {
         boolean ret = false;
         printTraceStart(LOG);
         ServiceFunctionGroupAlgorithmKey serviceFunctionGroupAlgorithmKey = new ServiceFunctionGroupAlgorithmKey(serviceFunctionGroupAlgorithmName);
@@ -112,25 +86,11 @@ public class SfcProviderServiceFunctionGroupAlgAPI extends SfcProviderAbstractAP
         return ret;
     }
 
-    @SuppressWarnings("rawtypes")
     public static ServiceFunctionGroupAlgorithm readServiceFunctionGroupAlg(String serviceFunctionGroupAlgName) {
-
         printTraceStart(LOG);
-        ServiceFunctionGroupAlgorithm ret = null;
-        Object[] sfgObj = { serviceFunctionGroupAlgName};
-        Class[] sfgClass = { String.class };
-        SfcProviderServiceFunctionGroupAlgAPI sfgAPI = SfcProviderServiceFunctionGroupAlgAPI.getRead(sfgObj, sfgClass);
-        Future future = ODL_SFC.getExecutor().submit(sfgAPI);
-        try {
-            ret = (ServiceFunctionGroupAlgorithm) future.get();
-            LOG.debug("getRead: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ....", e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ....", e);
-        } catch (Exception e) {
-            LOG.error("Unexpected exception", e);
-        }
+        ServiceFunctionGroupAlgorithm ret =
+                SfcProviderServiceFunctionGroupAlgAPI.readServiceFunctionGroupAlgorithm(serviceFunctionGroupAlgName);
+        LOG.debug("getRead: {}", ret);
         printTraceStop(LOG);
         return ret;
     }
index 804d8b1ab4137cf05598b2095d6e5b5323d0ebd5..9741c5c0b9ec1ea228b29fa0dd63dee1980a3f18 100644 (file)
@@ -8,23 +8,18 @@
 
 package org.opendaylight.sfc.provider.api;
 
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStart;
 import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
 
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.sfc.provider.SfcReflection;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.md.rev140701.ServiceFunctionMetadata;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.md.rev140701.service.function.metadata.ContextMetadata;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.md.rev140701.service.function.metadata.ContextMetadataKey;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.md.rev140701.service.function.metadata.VariableMetadata;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.md.rev140701.service.function.metadata.VariableMetadataKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -39,47 +34,11 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.md.rev14070
  * <p>
  * @since 2015-10-10
  */
-public class SfcProviderServiceFunctionMetadataAPI extends SfcProviderAbstractAPI {
+public class SfcProviderServiceFunctionMetadataAPI {
 
     private static final Logger LOG = LoggerFactory.getLogger(SfcProviderServiceFunctionMetadataAPI.class);
-    private static final String FAILED_TO_STR = "failed to ...";
-
-    SfcProviderServiceFunctionMetadataAPI(Object[] params, String m) {
-        super(params, m);
-    }
-
-    SfcProviderServiceFunctionMetadataAPI(Object[] params, Class[] paramsTypes, String m) {
-        super(params, paramsTypes, m);
-    }
-
-    public static SfcProviderServiceFunctionMetadataAPI getPutContextMetadata(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionMetadataAPI(params, paramsTypes, "putContextMetadata");
-    }
-
-    public static SfcProviderServiceFunctionMetadataAPI getReadContextMetadata(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionMetadataAPI(params, paramsTypes, "readContextMetadata");
-    }
-
-    public static SfcProviderServiceFunctionMetadataAPI getDeleteContextMetadata(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionMetadataAPI(params, paramsTypes, "deleteContextMetadata");
-    }
-
-    public static SfcProviderServiceFunctionMetadataAPI getPutVariableMetadata(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionMetadataAPI(params, paramsTypes, "putVariableMetadata");
-    }
 
-    public static SfcProviderServiceFunctionMetadataAPI getReadVariableMetadata(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionMetadataAPI(params, paramsTypes, "readVariableMetadata");
-    }
-
-
-    public static SfcProviderServiceFunctionMetadataAPI getDeleteVariableMetadata(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceFunctionMetadataAPI(params, paramsTypes, "deleteVariableMetadata");
-    }
-
-    @SuppressWarnings("unused")
-    @SfcReflection
-    protected boolean putContextMetadata(ContextMetadata md) {
+    protected static boolean putContextMetadata(ContextMetadata md) {
         boolean ret = false;
         InstanceIdentifier<ContextMetadata> mdIID;
 
@@ -93,29 +52,7 @@ public class SfcProviderServiceFunctionMetadataAPI extends SfcProviderAbstractAP
         return ret;
     }
 
-    public static boolean putContextMetadataExecutor(ContextMetadata md) {
-        boolean ret = false;
-        Object[] functionParamsObj = {md};
-        Class[] functionParamsClass = {ContextMetadata.class};
-
-        printTraceStart(LOG);
-        Future future  = ODL_SFC.getExecutor().submit(SfcProviderServiceFunctionMetadataAPI
-                .getPutContextMetadata(functionParamsObj, functionParamsClass));
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getPutContextMetadata: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    @SuppressWarnings("unused")
-    @SfcReflection
-    protected ContextMetadata readContextMetadata(String mdName) {
+    protected static ContextMetadata readContextMetadata(String mdName) {
         printTraceStart(LOG);
         ContextMetadata md;
         InstanceIdentifier<ContextMetadata> mdIID;
@@ -129,26 +66,6 @@ public class SfcProviderServiceFunctionMetadataAPI extends SfcProviderAbstractAP
         return md;
     }
 
-    public static ContextMetadata readContextMetadataExecutor(String mdName) {
-        printTraceStart(LOG);
-        ContextMetadata ret = null;
-        Object[] functionParamsObj = {mdName};
-        Class[] functionParamsClass = {String.class};
-        Future future  = ODL_SFC.getExecutor().submit(SfcProviderServiceFunctionMetadataAPI
-                .getReadContextMetadata(functionParamsObj, functionParamsClass));
-        try {
-            ret = (ContextMetadata) future.get();
-            LOG.debug("getReadContextMetadata: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    @SuppressWarnings("unused")
     public static boolean deleteContextMetadata (String mdName) {
         boolean ret = false;
         printTraceStart(LOG);
@@ -168,30 +85,7 @@ public class SfcProviderServiceFunctionMetadataAPI extends SfcProviderAbstractAP
         return ret;
     }
 
-    @SuppressWarnings("unused")
-    public static boolean deleteContextMetadataExecutor (String mdName) {
-        boolean ret = false;
-        Object[] functionParams = {mdName};
-        Class[] functionParamsTypes = {String.class};
-
-        printTraceStart(LOG);
-        Future future = ODL_SFC.getExecutor().submit(SfcProviderServiceFunctionMetadataAPI
-                .getDeleteContextMetadata(functionParams, functionParamsTypes));
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeleteContextMetadata returns: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn(FAILED_TO_STR , e);
-        } catch (ExecutionException e) {
-            LOG.warn(FAILED_TO_STR , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    @SuppressWarnings("unused")
-    @SfcReflection
-    protected boolean putVariableMetadata(VariableMetadata md) {
+    protected static boolean putVariableMetadata(VariableMetadata md) {
         boolean ret = false;
         InstanceIdentifier<VariableMetadata> mdIID;
 
@@ -205,29 +99,7 @@ public class SfcProviderServiceFunctionMetadataAPI extends SfcProviderAbstractAP
         return ret;
     }
 
-    public static boolean putVariableMetadataExecutor(VariableMetadata md) {
-        boolean ret = false;
-        Object[] functionParamsObj = {md};
-        Class[] functionParamsClass = {VariableMetadata.class};
-
-        printTraceStart(LOG);
-        Future future  = ODL_SFC.getExecutor().submit(SfcProviderServiceFunctionMetadataAPI
-                .getPutVariableMetadata(functionParamsObj, functionParamsClass));
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getPutVariableMetadata: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    @SuppressWarnings("unused")
-    @SfcReflection
-    protected VariableMetadata readVariableMetadata(String mdName) {
+    protected static VariableMetadata readVariableMetadata(String mdName) {
         VariableMetadata md;
         InstanceIdentifier<VariableMetadata> mdIID;
 
@@ -242,27 +114,6 @@ public class SfcProviderServiceFunctionMetadataAPI extends SfcProviderAbstractAP
         return md;
     }
 
-    public static VariableMetadata readVariableMetadataExecutor(String mdName) {
-        VariableMetadata ret = null;
-        Object[] functionParamsObj = {mdName};
-        Class[] functionParamsClass = {String.class};
-
-        printTraceStart(LOG);
-        Future future  = ODL_SFC.getExecutor().submit(SfcProviderServiceFunctionMetadataAPI
-                .getReadVariableMetadata(functionParamsObj, functionParamsClass));
-        try {
-            ret = (VariableMetadata) future.get();
-            LOG.debug("getReadVariableMetadata: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn("failed to ...." , e);
-        } catch (ExecutionException e) {
-            LOG.warn("failed to ...." , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-
     @SuppressWarnings("unused")
     public static boolean deleteVariableMetadata (String mdName) {
         boolean ret = false;
@@ -284,25 +135,4 @@ public class SfcProviderServiceFunctionMetadataAPI extends SfcProviderAbstractAP
         printTraceStop(LOG);
         return ret;
     }
-
-    @SuppressWarnings("unused")
-    public static boolean deleteVariableMetadataExecutor (String mdName) {
-        boolean ret = false;
-        Object[] functionParams = {mdName};
-        Class[] functionParamsTypes = {String.class};
-
-        printTraceStart(LOG);
-        Future future = ODL_SFC.getExecutor().submit(SfcProviderServiceFunctionMetadataAPI
-                .getDeleteVariableMetadata(functionParams, functionParamsTypes));
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeleteVariableMetadata returns: {}", future.get());
-        } catch (InterruptedException e) {
-            LOG.warn(FAILED_TO_STR , e);
-        } catch (ExecutionException e) {
-            LOG.warn(FAILED_TO_STR , e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
 }
index dffeafeddbc6f90d5dcb36f149982ebb8fe1f6c4..6164dfa3971b821f726b08f0df03c9fd601b3bc4 100755 (executable)
@@ -12,13 +12,8 @@ import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStart;
 import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
 
 import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
 
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.sfc.provider.OpendaylightSfc;
-import org.opendaylight.sfc.provider.SfcReflection;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.rendered.service.paths.RenderedServicePath;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.functions.ServiceFunction;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.functions.state.service.function.state.SfServicePath;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev140701.ServiceFunctionPaths;
@@ -46,87 +41,9 @@ import org.slf4j.LoggerFactory;
  * @version 0.1
  * @since 2014-06-30
  */
-public class SfcProviderServicePathAPI extends SfcProviderAbstractAPI {
+public class SfcProviderServicePathAPI {
 
     private static final Logger LOG = LoggerFactory.getLogger(SfcProviderServicePathAPI.class);
-    private static final OpendaylightSfc ODL_SFC = OpendaylightSfc.getOpendaylightSfcObj();
-    private static final String FAILED_TO_STR = "failed to ...";
-
-    SfcProviderServicePathAPI(Object[] params, Class[] paramsTypes, String m) {
-        super(params, paramsTypes, m);
-    }
-
-    @SuppressWarnings("unused")
-    public static SfcProviderServicePathAPI getPut(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServicePathAPI(params, paramsTypes, "putServiceFunctionPath");
-    }
-
-    @SuppressWarnings("unused")
-    public static SfcProviderServicePathAPI getRead(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServicePathAPI(params, paramsTypes, "readServiceFunctionPath");
-    }
-
-    public static SfcProviderServicePathAPI getDelete(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServicePathAPI(params, paramsTypes, "deleteServiceFunctionPath");
-    }
-
-    @SuppressWarnings("unused")
-    public static SfcProviderServicePathAPI getPutAll(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServicePathAPI(params, paramsTypes, "putAllServiceFunctionPaths");
-    }
-
-    @SuppressWarnings("unused")
-    public static SfcProviderServicePathAPI getReadAll(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServicePathAPI(params, paramsTypes, "readAllServiceFunctionPaths");
-    }
-
-    @SuppressWarnings("unused")
-    public static SfcProviderServicePathAPI getDeleteAll(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServicePathAPI(params, paramsTypes, "deleteAllServiceFunctionPaths");
-    }
-
-    public static SfcProviderServicePathAPI getDeleteServicePathContainingFunction(Object[] params,
-            Class[] paramsTypes) {
-        return new SfcProviderServicePathAPI(params, paramsTypes, "deleteServicePathContainingFunction");
-    }
-
-    @SuppressWarnings("unused")
-    public static SfcProviderServicePathAPI getDeleteServicePathInstantiatedFromChain(Object[] params,
-            Class[] paramsTypes) {
-        return new SfcProviderServicePathAPI(params, paramsTypes, "deleteServicePathInstantiatedFromChain");
-    }
-
-    public static SfcProviderServicePathAPI getCreateServicePathAPI(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServicePathAPI(params, paramsTypes, "createServiceFunctionPathEntry");
-    }
-
-    @SuppressWarnings("unused")
-    public static SfcProviderServicePathAPI getUpdateServicePathInstantiatedFromChain(Object[] params,
-            Class[] paramsTypes) {
-        return new SfcProviderServicePathAPI(params, paramsTypes, "updateServicePathInstantiatedFromChain");
-    }
-
-    public static SfcProviderServicePathAPI getUpdateServicePathContainingFunction(Object[] params,
-            Class[] paramsTypes) {
-        return new SfcProviderServicePathAPI(params, paramsTypes, "updateServicePathContainingFunction");
-    }
-
-    public static SfcProviderServicePathAPI getCheckServicePathAPI(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServicePathAPI(params, paramsTypes, "checkServiceFunctionPath");
-    }
-
-    public static SfcProviderServicePathAPI getAddRenderedPathToServicePathStateExecutor(Object[] params,
-            Class[] paramsTypes) {
-        return new SfcProviderServicePathAPI(params, paramsTypes, "addRenderedPathToServicePathState");
-    }
-
-    public static SfcProviderServicePathAPI getDeleteServicePathStateExecutor(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServicePathAPI(params, paramsTypes, "deleteServicePathState");
-    }
-
-    public static SfcProviderServicePathAPI getReadServicePathStateExecutor(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServicePathAPI(params, paramsTypes, "readServicePathState");
-    }
 
     /**
      * This function checks if the Service Path has any constraints
@@ -149,8 +66,7 @@ public class SfcProviderServicePathAPI extends SfcProviderAbstractAPI {
      * @param servicePathName Service Path Name
      * @return List of RSP name objects
      */
-    @SuppressWarnings("unused")
-    protected static List<SfpRenderedServicePath> readServicePathState(String servicePathName) {
+    public static List<SfpRenderedServicePath> readServicePathState(String servicePathName) {
 
         printTraceStart(LOG);
         InstanceIdentifier<ServiceFunctionPathState> sfpIID;
@@ -172,41 +88,12 @@ public class SfcProviderServicePathAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * Wrapper API to read the Service Function Path operational state
-     *
-     * @param servicePathName Service Path Name
-     * @return Nothing.
-     */
-    @SuppressWarnings("unused")
-    public static List<SfpRenderedServicePath> readServicePathStateExecutor(String servicePathName) {
-
-        printTraceStart(LOG);
-        List<SfpRenderedServicePath> ret = null;
-
-        Object[] servicePathObj = {servicePathName};
-        Class[] servicePathClass = {String.class};
-
-        SfcProviderServicePathAPI sfcProviderServicePathAPI =
-                SfcProviderServicePathAPI.getReadServicePathStateExecutor(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServicePathAPI);
-        try {
-            ret = (List<SfpRenderedServicePath>) future.get();
-            LOG.debug("getReadServicePathStateExecutor: {}", ret);
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * Wrapper API to delete the Service Function Path operational state
      *
      * @param servicePathName Service Path Name
      * @return Nothing.
      */
-    @SuppressWarnings("unused")
     protected static boolean deleteServicePathState(String servicePathName) {
 
         printTraceStart(LOG);
@@ -229,35 +116,6 @@ public class SfcProviderServicePathAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * Wrapper API to delete the Service Function Path operational state
-     *
-     * @param servicePathName Service Path Name
-     * @return Nothing.
-     */
-    @SfcReflection
-    @SuppressWarnings("unused")
-    public static boolean deleteServicePathStateExecutor(String servicePathName) {
-
-        printTraceStart(LOG);
-        boolean ret = true;
-
-        Object[] servicePathObj = {servicePathName};
-        Class[] servicePathClass = {String.class};
-
-        SfcProviderServicePathAPI sfcProviderServicePathAPI =
-                SfcProviderServicePathAPI.getDeleteServicePathStateExecutor(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServicePathAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeleteServicePathStateExecutor: {}", ret);
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * We iterate through all service paths that use this service function and if
      * necessary, remove them.
@@ -266,8 +124,6 @@ public class SfcProviderServicePathAPI extends SfcProviderAbstractAPI {
      * @param renderedPathName Rendered Path name
      * @return Nothing.
      */
-    @SfcReflection
-    @SuppressWarnings("unused")
     public static boolean addRenderedPathToServicePathState(String servicePathName, String renderedPathName) {
 
         printTraceStart(LOG);
@@ -296,59 +152,6 @@ public class SfcProviderServicePathAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * We iterate through all service paths that use this service function and if
-     * necessary, remove them.
-     *
-     * @param servicePathName Service Function Path name
-     * @param renderedPathName Rendered Path name
-     * @return Nothing.
-     */
-    @SuppressWarnings("unused")
-    public static boolean addRenderedPathToServicePathStateExecutor(String servicePathName, String renderedPathName) {
-
-        printTraceStart(LOG);
-        boolean ret = true;
-        Object[] functionParams = {servicePathName, renderedPathName};
-        Class[] functionParamsTypes = {String.class, String.class};
-        Future future = ODL_SFC.getExecutor().submit(SfcProviderServicePathAPI
-            .getAddRenderedPathToServicePathStateExecutor(functionParams, functionParamsTypes));
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getAddRenderedPathToServicePathStateExecutor returns: {}", future.get());
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    /**
-     * This method creates a ServiceFunctionPath by Executor, it includes
-     * Executor creation and response management
-     *
-     * @param sfp a ServiceFunctionPath object
-     * @return true if sfp is created, false otherwise
-     */
-    @SuppressWarnings("unused")
-    public static boolean putServiceFunctionPathExecutor(ServiceFunctionPath sfp) {
-        boolean ret = false;
-        Object[] sfcParameters = {sfp};
-        Class[] sfcParameterTypes = {ServiceFunctionPath.class};
-
-        printTraceStart(LOG);
-        try {
-            Object result = ODL_SFC.getExecutor()
-                .submit(SfcProviderServicePathAPI.getPut(sfcParameters, sfcParameterTypes))
-                .get();
-            ret = (boolean) result;
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * This function reads a SFP from the datastore
      *
@@ -369,32 +172,6 @@ public class SfcProviderServicePathAPI extends SfcProviderAbstractAPI {
         return sfp;
     }
 
-    /**
-     * This method reads the operational state for a service function.
-     *
-     * @param serviceFunctionName SF name
-     * @return A ServiceFunctionState object that is a list of all paths using
-     *         this service function, null otherwise
-     */
-    public static ServiceFunctionPath readServiceFunctionPathExecutor(String serviceFunctionName) {
-
-        printTraceStart(LOG);
-        ServiceFunctionPath ret = null;
-        Object[] servicePathObj = {serviceFunctionName};
-        Class[] servicePathClass = {String.class};
-        SfcProviderServicePathAPI sfcProviderServicePathAPI =
-                SfcProviderServicePathAPI.getRead(servicePathObj, servicePathClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServicePathAPI);
-        try {
-            ret = (ServiceFunctionPath) future.get();
-            LOG.debug("readServiceFunctionPathExecutor: {}", future.get());
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn("failed to ....", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
     /**
      * This function deletes a SFP from the datastore
      *
@@ -418,55 +195,6 @@ public class SfcProviderServicePathAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    /**
-     * This function deletes a SFP from the datastore
-     *
-     * @param serviceFunctionPathName SFP name
-     * @return Nothing.
-     */
-    public static boolean deleteServiceFunctionPathExecutor(String serviceFunctionPathName) {
-        boolean ret = false;
-        Object[] sfcParameters = {serviceFunctionPathName};
-        Class[] sfcParameterTypes = {String.class};
-
-        printTraceStart(LOG);
-        try {
-            Object result = ODL_SFC.getExecutor()
-                .submit(SfcProviderServicePathAPI.getDelete(sfcParameters, sfcParameterTypes))
-                .get();
-            ret = (boolean) result;
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    /**
-     * This function put service function paths to the datastore
-     *
-     * @param serviceFunctionPaths SFP name
-     * @return Nothing.
-     */
-    public static boolean putServiceFunctionPathsExecutor(ServiceFunctionPaths serviceFunctionPaths) {
-        boolean ret = false;
-        Object[] sfcParameters = {serviceFunctionPaths};
-        Class[] sfcParameterTypes = {ServiceFunctionPaths.class};
-
-        printTraceStart(LOG);
-        try {
-            Object result = ODL_SFC.getExecutor()
-                .submit(SfcProviderServicePathAPI.getPutAll(sfcParameters, sfcParameterTypes))
-                .get();
-            ret = (boolean) result;
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    @SuppressWarnings("unused")
     public static ServiceFunctionPaths readAllServiceFunctionPaths() {
         ServiceFunctionPaths sfps;
         printTraceStart(LOG);
@@ -479,141 +207,7 @@ public class SfcProviderServicePathAPI extends SfcProviderAbstractAPI {
         return sfps;
     }
 
-    /**
-     * This function read service function paths from the datastore
-     *
-     * @return Nothing.
-     */
-    public static ServiceFunctionPaths readAllServiceFunctionPathsExecutor() {
-        ServiceFunctionPaths ret = null;
-        Object[] sfcParameters = {};
-        Class[] sfcParameterTypes = {};
-
-        printTraceStart(LOG);
-        try {
-            Object result = ODL_SFC.getExecutor()
-                .submit(SfcProviderServicePathAPI.getReadAll(sfcParameters, sfcParameterTypes))
-                .get();
-            ret = (ServiceFunctionPaths) result;
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    /**
-     * This function read service function paths from the datastore
-     *
-     * @return Nothing.
-     */
-    public static boolean deleteAllServiceFunctionPathsExecutor() {
-        boolean ret = false;
-        Object[] sfcParameters = {};
-        Class[] sfcParameterTypes = {};
-
-        printTraceStart(LOG);
-        try {
-            Object result = ODL_SFC.getExecutor()
-                .submit(SfcProviderServicePathAPI.getDeleteAll(sfcParameters, sfcParameterTypes))
-                .get();
-            ret = (boolean) result;
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    /**
-     * Check a SFF for consistency after datastore creation
-     *
-     * @param serviceFunctionPath SFP object
-     * @param operation HttpMethod
-     * @return Nothing
-     */
-    // calls non-existing method
-    public static boolean checkServiceFunctionPathExecutor(ServiceFunctionPath serviceFunctionPath, String operation) {
-
-        printTraceStart(LOG);
-        boolean ret = false;
-
-        // Send to SB REST
-        RenderedServicePath renderedServicePath =
-                SfcProviderRenderedPathAPI.readRenderedServicePath(serviceFunctionPath.getName());
-        if (renderedServicePath == null) {
-            LOG.error("Failed to find RSP:  {}", serviceFunctionPath.getName());
-            return false;
-        }
-        Object[] renderedPathObj = {renderedServicePath, operation};
-        Class[] renderedPathClass = {RenderedServicePath.class, String.class};
-        Future future = ODL_SFC.getExecutor()
-            .submit(SfcProviderServicePathAPI.getCheckServicePathAPI(renderedPathObj, renderedPathClass));
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getCheckServicePathAPI returns: {}", future.get());
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    /**
-     * Check a SFF for consistency after datastore creation
-     *
-     * @param renderedServicePath RSP object
-     * @param operation HttpMethod
-     * @return Nothing
-     */
-    // calls non-existing method
-    public static boolean checkServiceFunctionPathExecutor(RenderedServicePath renderedServicePath, String operation) {
-
-        printTraceStart(LOG);
-        boolean ret = false;
-
-        Object[] renderedPathObj = {renderedServicePath, operation};
-        Class[] renderedPathClass = {RenderedServicePath.class, String.class};
-        Future future = ODL_SFC.getExecutor()
-            .submit(SfcProviderServicePathAPI.getCheckServicePathAPI(renderedPathObj, renderedPathClass));
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getCheckServicePathAPI returns: {}", future.get());
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    /**
-     * We iterate through all service paths that use this service function and if
-     * necessary, remove them.
-     *
-     * @param serviceFunction Service Function Object
-     * @return Nothing.
-     */
-    @SuppressWarnings("unused")
-    public static boolean deleteServicePathContainingFunctionExecutor(ServiceFunction serviceFunction) {
-
-        printTraceStart(LOG);
-        boolean ret = true;
-        Object[] functionParams = {serviceFunction};
-        Class[] functionParamsTypes = {ServiceFunction.class};
-        Future future = ODL_SFC.getExecutor().submit(
-                SfcProviderServicePathAPI.getDeleteServicePathContainingFunction(functionParams, functionParamsTypes));
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeleteServicePathContainingFunction returns: {}", future.get());
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    @SuppressWarnings("unused")
-    protected boolean putServiceFunctionPath(ServiceFunctionPath sfp) {
+    public static boolean putServiceFunctionPath(ServiceFunctionPath sfp) {
         boolean ret = false;
         printTraceStart(LOG);
 
@@ -632,8 +226,7 @@ public class SfcProviderServicePathAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    @SuppressWarnings("unused")
-    protected boolean putAllServiceFunctionPaths(ServiceFunctionPaths sfps) {
+    protected static boolean putAllServiceFunctionPaths(ServiceFunctionPaths sfps) {
         boolean ret = false;
         printTraceStart(LOG);
 
@@ -647,8 +240,7 @@ public class SfcProviderServicePathAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    @SuppressWarnings("unused")
-    protected boolean deleteAllServiceFunctionPaths() {
+    protected static boolean deleteAllServiceFunctionPaths() {
         boolean ret = false;
         printTraceStart(LOG);
 
@@ -669,9 +261,7 @@ public class SfcProviderServicePathAPI extends SfcProviderAbstractAPI {
      * @param serviceFunction Service Function Object
      * @return Nothing.
      */
-    @SuppressWarnings("unused")
-    @SfcReflection
-    public boolean deleteServicePathContainingFunction(ServiceFunction serviceFunction) {
+    public static boolean deleteServicePathContainingFunction(ServiceFunction serviceFunction) {
 
         printTraceStart(LOG);
         boolean ret = true;
index 4264f08b6bea28b302dc296a492a8deb1c9935b9..b61bfce213f09e6021edc1571c8cc402db0601d6 100755 (executable)
@@ -12,11 +12,8 @@ import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStart;
 import static org.opendaylight.sfc.provider.SfcProviderDebug.printTraceStop;
 
 import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
 
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.sfc.provider.OpendaylightSfc;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.functions.ServiceFunction;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.ServiceFunctionTypeIdentity;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.ServiceFunctionTypes;
@@ -42,140 +39,9 @@ import org.slf4j.LoggerFactory;
  * @see org.opendaylight.sfc.provider.SfcProviderSfEntryDataListener
  * @since 2014-06-30
  */
-public class SfcProviderServiceTypeAPI extends SfcProviderAbstractAPI {
+public class SfcProviderServiceTypeAPI {
 
     private static final Logger LOG = LoggerFactory.getLogger(SfcProviderServiceTypeAPI.class);
-    private static final OpendaylightSfc ODL_SFC = OpendaylightSfc.getOpendaylightSfcObj();
-    private static final String FAILED_TO_STR = "failed to ...";
-
-    SfcProviderServiceTypeAPI(Object[] params, String m) {
-        super(params, m);
-    }
-
-    SfcProviderServiceTypeAPI(Object[] params, Class[] paramsTypes, String m) {
-        super(params, paramsTypes, m);
-    }
-
-    public static SfcProviderServiceTypeAPI getPut(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceTypeAPI(params, paramsTypes, "putServiceFunctionType");
-    }
-
-    public static SfcProviderServiceTypeAPI getRead(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceTypeAPI(params, paramsTypes, "readServiceFunctionType");
-    }
-
-    public static SfcProviderServiceTypeAPI getDelete(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceTypeAPI(params, paramsTypes, "deleteServiceFunctionType");
-    }
-
-    public static SfcProviderServiceTypeAPI getPutAll(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceTypeAPI(params, paramsTypes, "putAllServiceFunctionTypes");
-    }
-
-    public static SfcProviderServiceTypeAPI getReadAll(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceTypeAPI(params, paramsTypes, "readAllServiceFunctionTypes");
-    }
-
-    public static SfcProviderServiceTypeAPI getDeleteAll(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceTypeAPI(params, paramsTypes, "deleteAllServiceFunctionTypes");
-    }
-
-    public static SfcProviderServiceTypeAPI getCreateServiceFunctionTypeEntry(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceTypeAPI(params, paramsTypes, "createServiceFunctionTypeEntry");
-    }
-
-    public static SfcProviderServiceTypeAPI getDeleteServiceFunctionTypeEntry(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceTypeAPI(params, paramsTypes, "deleteServiceFunctionTypeEntry");
-    }
-
-    public static SfcProviderServiceTypeAPI getDeleteServiceFunctionFromServiceType(Object[] params,
-            Class[] paramsTypes) {
-        return new SfcProviderServiceTypeAPI(params, paramsTypes, "deleteServiceFunctionTypeEntry");
-    }
-
-    public static boolean putServiceFunctionTypeExecutor(ServiceFunctionType sft) {
-
-        printTraceStart(LOG);
-        boolean ret = false;
-        Object[] serviceTypeObj = {sft};
-        Class[] serviceTypeClass = {ServiceFunctionType.class};
-        SfcProviderServiceTypeAPI sfcProviderServiceTypeAPI =
-                SfcProviderServiceTypeAPI.getPut(serviceTypeObj, serviceTypeClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceTypeAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getRead: {}", future.get());
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn("failed to ....", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    /**
-     * This method reads the operational state for a service function.
-     *
-     * @param serviceFunctionTypeIdentity SF name
-     * @return A ServiceFunctionType object
-     */
-    public static ServiceFunctionType readServiceFunctionTypeExecutor(
-            Class<? extends ServiceFunctionTypeIdentity> serviceFunctionTypeIdentity) {
-
-        printTraceStart(LOG);
-        ServiceFunctionType ret = null;
-        Object[] serviceTypeObj = {serviceFunctionTypeIdentity};
-        Class[] serviceTypeClass = {Class.class};
-        SfcProviderServiceTypeAPI sfcProviderServiceTypeAPI =
-                SfcProviderServiceTypeAPI.getRead(serviceTypeObj, serviceTypeClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceTypeAPI);
-        try {
-            ret = (ServiceFunctionType) future.get();
-            LOG.debug("getRead: {}", future.get());
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn("failed to ....", e);
-        }
-        printTraceStop(LOG);
-        return ret;
-    }
-
-    public static boolean deleteServiceFunctionTypeEntryExecutor(ServiceFunction serviceFunction) {
-        boolean ret = false;
-        Object[] serviceTypeObj = {serviceFunction};
-        Class[] serviceTypeClass = {ServiceFunction.class};
-        SfcProviderServiceTypeAPI sfcProviderServiceTypeAPI =
-                SfcProviderServiceTypeAPI.getDeleteServiceFunctionTypeEntry(serviceTypeObj, serviceTypeClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceTypeAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("getDeleteServiceFunctionTypeEntry: {}", future.get());
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        }
-        return ret;
-    }
-
-    /**
-     * Wrapper method that creates an executor that will execute a method to add a
-     * SFType to the datatore
-     *
-     * @param serviceFunction Service Function Object
-     * @return Nothing.
-     */
-    public static boolean createServiceFunctionTypeEntryExecutor(ServiceFunction serviceFunction) {
-        boolean ret = false;
-        Object[] serviceTypeObj = {serviceFunction};
-        Class[] serviceTypeClass = {ServiceFunction.class};
-        SfcProviderServiceTypeAPI sfcProviderServiceTypeAPI =
-                SfcProviderServiceTypeAPI.getCreateServiceFunctionTypeEntry(serviceTypeObj, serviceTypeClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderServiceTypeAPI);
-        try {
-            ret = (boolean) future.get();
-            LOG.debug("createServiceFunctionTypeEntryExecutor: {}", future.get());
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.warn(FAILED_TO_STR, e);
-        }
-        return ret;
-    }
 
     /**
      * This method creates a Service function Type entry from a Service
@@ -217,7 +83,7 @@ public class SfcProviderServiceTypeAPI extends SfcProviderAbstractAPI {
         return ret;
     }
 
-    protected boolean putServiceFunctionType(ServiceFunctionType sft) {
+    public static boolean putServiceFunctionType(ServiceFunctionType sft) {
         boolean ret;
         printTraceStart(LOG);
 
index dc664e20f065aebd3fd98d26768ecd585646868c..5f42faaf23ab076550945eb487bf2087dbe96e24 100644 (file)
@@ -50,14 +50,14 @@ public class SfcServiceFunctionLoadBalanceSchedulerAPI extends SfcServiceFunctio
             sfName = curSftServiceFunctionName.getName();
 
             /* Check next one if curSftServiceFunctionName doesn't exist */
-            ServiceFunction serviceFunction = SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(sfName);
+            ServiceFunction serviceFunction = SfcProviderServiceFunctionAPI.readServiceFunction(sfName);
             if (serviceFunction == null) {
                 LOG.error("ServiceFunction {} doesn't exist", sfName);
                 continue;
             }
 
             /* Read ServiceFunctionMonitor information */
-            SfcSfDescMon sfcSfDescMon = SfcProviderServiceFunctionAPI.readServiceFunctionDescriptionMonitorExecutor(sfName);
+            SfcSfDescMon sfcSfDescMon = SfcProviderServiceFunctionAPI.readServiceFunctionDescriptionMonitor(sfName);
             if (sfcSfDescMon == null) {
                 sftServiceFunctionName = sfName;
                 LOG.error("Read monitor information from Data Store failed! serviceFunction: {}", sfName);
@@ -105,7 +105,7 @@ public class SfcServiceFunctionLoadBalanceSchedulerAPI extends SfcServiceFunctio
              */
 
             ServiceFunctionType serviceFunctionType;
-            serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionTypeExecutor(sfcServiceFunction.getType());
+            serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionType(sfcServiceFunction.getType());
             if (serviceFunctionType != null) {
                 List<SftServiceFunctionName> sftServiceFunctionNameList = serviceFunctionType.getSftServiceFunctionName();
                 if (!sftServiceFunctionNameList.isEmpty()) {
index 4b588fd9b8395f8fc0451b5f76934a6a20d58261..33673060eca01c288c9642c1a5314fef038eec8b 100644 (file)
@@ -48,7 +48,7 @@ public class SfcServiceFunctionRandomSchedulerAPI extends SfcServiceFunctionSche
 
         while (maxTries > 0) {
             serviceFunctionName = sftServiceFunctionNameList.get(start).getName();
-            serviceFunction = SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(serviceFunctionName);
+            serviceFunction = SfcProviderServiceFunctionAPI.readServiceFunction(serviceFunctionName);
             if (serviceFunction != null) {
                 break;
             } else {
@@ -90,7 +90,7 @@ public class SfcServiceFunctionRandomSchedulerAPI extends SfcServiceFunctionSche
              */
 
             ServiceFunctionType serviceFunctionType;
-            serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionTypeExecutor(sfcServiceFunction.getType());
+            serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionType(sfcServiceFunction.getType());
             if (serviceFunctionType != null) {
                 List<SftServiceFunctionName> sftServiceFunctionNameList = serviceFunctionType.getSftServiceFunctionName();
                 if (!sftServiceFunctionNameList.isEmpty()) {
index c9a96f483f83778911bf48467f4692080b5b1061..6d6aa926a5dbacde035068ac36907ab6a3966cc3 100644 (file)
@@ -84,7 +84,7 @@ public class SfcServiceFunctionRoundRobinSchedulerAPI extends SfcServiceFunction
              * we do not hit NULL Pointer exceptions
              */
             ServiceFunctionType serviceFunctionType;
-            serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionTypeExecutor(sfcServiceFunction.getType());
+            serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionType(sfcServiceFunction.getType());
             if (serviceFunctionType != null) {
                 List<SftServiceFunctionName> sftServiceFunctionNameList = serviceFunctionType.getSftServiceFunctionName();
                 if (!sftServiceFunctionNameList.isEmpty()) {
index 69651f1151b1aea3f3b649fbc3cd4f6df074acbc..91888351978d2435d35ac62c7f74089ffcc78fd8 100644 (file)
@@ -150,7 +150,7 @@ public class SfcServiceFunctionShortestPathSchedulerAPI extends SfcServiceFuncti
         String toSffName;
 
         /* Add all the ServiceFunction nodes */
-        ServiceFunctions sfs = SfcProviderServiceFunctionAPI.readAllServiceFunctionsExecutor();
+        ServiceFunctions sfs = SfcProviderServiceFunctionAPI.readAllServiceFunctions();
         List<ServiceFunction> serviceFunctionList = sfs.getServiceFunction();
         for (ServiceFunction serviceFunction : serviceFunctionList) {
             sfName = serviceFunction.getName();
@@ -158,7 +158,7 @@ public class SfcServiceFunctionShortestPathSchedulerAPI extends SfcServiceFuncti
             LOG.debug("Add ServiceFunction: {}", sfName);
         }
 
-        ServiceFunctionForwarders sffs = SfcProviderServiceForwarderAPI.readAllServiceFunctionForwardersExecutor();
+        ServiceFunctionForwarders sffs = SfcProviderServiceForwarderAPI.readAllServiceFunctionForwarders();
         List<ServiceFunctionForwarder> serviceFunctionForwarderList = sffs.getServiceFunctionForwarder();
 
         /* Add edges and node for every ServiceFunctionForwarder */
@@ -239,7 +239,7 @@ public class SfcServiceFunctionShortestPathSchedulerAPI extends SfcServiceFuncti
             }
 
             ServiceFunctionType serviceFunctionType =
-                    SfcProviderServiceTypeAPI.readServiceFunctionTypeExecutor(sfcServiceFunction.getType());
+                    SfcProviderServiceTypeAPI.readServiceFunctionType(sfcServiceFunction.getType());
             if (serviceFunctionType != null) {
                 List<SftServiceFunctionName> sftServiceFunctionNameList =
                         serviceFunctionType.getSftServiceFunctionName();
index f16f4f1cc804f568eb408995908b5a21ba35825f..38fab329f16461417a6ab8867dae2ec7a5552d44 100644 (file)
@@ -8,11 +8,41 @@
 
 package org.opendaylight.sfc.provider;
 
+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 java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.sfc.provider.api.*;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.*;
+import org.opendaylight.sfc.provider.api.SfcDataStoreAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderRenderedPathAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderServiceChainAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderServiceChainAPITest;
+import org.opendaylight.sfc.provider.api.SfcProviderServiceForwarderAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderServiceFunctionAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderServiceFunctionGroupAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderServicePathAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderServiceTypeAPI;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.CreateRenderedPathInput;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.CreateRenderedPathInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.CreateRenderedPathOutput;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.DeleteRenderedPathInput;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.DeleteRenderedPathInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.DeleteRenderedPathOutput;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.ReadRenderedServicePathFirstHopInput;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.ReadRenderedServicePathFirstHopInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.ReadRenderedServicePathFirstHopOutput;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.ReadRspFirstHopBySftListInput;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.ReadRspFirstHopBySftListInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.ReadRspFirstHopBySftListOutput;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.rendered.service.paths.RenderedServicePath;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.rendered.service.paths.rendered.service.path.RenderedServicePathHop;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.scf.rev140701.ServiceFunctionClassifiers;
@@ -24,7 +54,13 @@ 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.state.ServiceFunctionClassifierStateKey;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.scf.rev140701.service.function.classifiers.state.service.function.classifier.state.SclRenderedServicePath;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.scf.rev140701.service.function.classifiers.state.service.function.classifier.state.SclRenderedServicePathKey;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.*;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.PutServiceFunctionInput;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.PutServiceFunctionInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ReadServiceFunctionInput;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ReadServiceFunctionInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ReadServiceFunctionOutput;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctions;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.entry.SfDataPlaneLocator;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.entry.SfDataPlaneLocatorBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.entry.SfDataPlaneLocatorKey;
@@ -32,7 +68,11 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev14070
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.functions.ServiceFunctionBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.functions.ServiceFunctionKey;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.functions.state.service.function.state.SfServicePath;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.*;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.InstantiateServiceFunctionChainInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.PutServiceFunctionChainsInput;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.PutServiceFunctionChainsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.ServiceFunctionChains;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.ServiceFunctionChainsBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.service.function.chain.grouping.ServiceFunctionChain;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.service.function.chain.grouping.ServiceFunctionChainBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.service.function.chain.grouping.ServiceFunctionChainKey;
@@ -44,7 +84,14 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev1407
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderKey;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.*;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ConnectedSffDictionary;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ConnectedSffDictionaryBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionary;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryKey;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocator;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocatorBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocatorKey;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocator;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocatorBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.sff.data.plane.locator.DataPlaneLocatorBuilder;
@@ -55,7 +102,12 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev1407
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev140701.service.function.paths.ServiceFunctionPathBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev140701.service.function.paths.ServiceFunctionPathKey;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev140701.service.function.paths.state.service.function.path.state.SfpRenderedServicePath;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.*;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Dpi;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Firewall;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.HttpHeaderEnrichment;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Napt44;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Qos;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.ServiceFunctionTypeIdentity;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.service.function.types.ServiceFunctionTypeBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.service.function.types.ServiceFunctionTypeKey;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.service.function.types.service.function.type.SftServiceFunctionName;
@@ -71,13 +123,6 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
-import static org.junit.Assert.*;
-
 public class SfcProviderRpcTest extends AbstractDataStoreManager {
 
     private final String[] sffNames = {"sff1", "sff2", "sff3", "sff4"};
@@ -154,7 +199,7 @@ public class SfcProviderRpcTest extends AbstractDataStoreManager {
 
         // Create ServiceFunctionTypeEntry for all ServiceFunctions
         for (ServiceFunction serviceFunction : sfList) {
-            boolean ret = SfcProviderServiceTypeAPI.createServiceFunctionTypeEntryExecutor(serviceFunction);
+            boolean ret = SfcProviderServiceTypeAPI.createServiceFunctionTypeEntry(serviceFunction);
             LOG.debug("call createServiceFunctionTypeEntryExecutor for {}", serviceFunction.getName());
             assertTrue("Must be true", ret);
         }
@@ -246,7 +291,7 @@ public class SfcProviderRpcTest extends AbstractDataStoreManager {
                 .setSymmetric(true).setClassifier(SFP_NAME).setSymmetricClassifier(SFP_NAME);
         ServiceFunctionPath serviceFunctionPath = pathBuilder.build();
         assertNotNull("Must be not null", serviceFunctionPath);
-        boolean ret = SfcProviderServicePathAPI.putServiceFunctionPathExecutor(serviceFunctionPath);
+        boolean ret = SfcProviderServicePathAPI.putServiceFunctionPath(serviceFunctionPath);
         assertTrue("Must be true", ret);
     }
 
@@ -255,7 +300,7 @@ public class SfcProviderRpcTest extends AbstractDataStoreManager {
         init();
 
         ServiceFunctionPath serviceFunctionPath =
-                SfcProviderServicePathAPI.readServiceFunctionPathExecutor(SFP_NAME);
+                SfcProviderServicePathAPI.readServiceFunctionPath(SFP_NAME);
         assertNotNull("Must be not null", serviceFunctionPath);
 
         CreateRenderedPathInputBuilder createRenderedPathInputBuilder = new CreateRenderedPathInputBuilder();
@@ -268,16 +313,16 @@ public class SfcProviderRpcTest extends AbstractDataStoreManager {
                 serviceFunctionPath, createRenderedPathInput);
 
         //check if SFF oper contains RSP
-        List<SffServicePath> sffServicePathList = SfcProviderServiceForwarderAPI.readSffStateExecutor(SFF_NAMES[1]);
+        List<SffServicePath> sffServicePathList = SfcProviderServiceForwarderAPI.readSffState(SFF_NAMES[1]);
         assertNotNull("Must be not null", sffServicePathList);
         assertEquals(sffServicePathList.get(0).getName(), RSP_NAME);
 
         //check if SF oper contains RSP
-        List<SfServicePath> sfServicePathList = SfcProviderServiceFunctionAPI.readServiceFunctionStateExecutor("unittest-fw-1");
+        List<SfServicePath> sfServicePathList = SfcProviderServiceFunctionAPI.readServiceFunctionState("unittest-fw-1");
         assertEquals(sfServicePathList.get(0).getName(), RSP_NAME);
 
         //check if SFP oper contains RSP
-        List<SfpRenderedServicePath> sfpRenderedServicePathList = SfcProviderServicePathAPI.readServicePathStateExecutor(SFP_NAME);
+        List<SfpRenderedServicePath> sfpRenderedServicePathList = SfcProviderServicePathAPI.readServicePathState(SFP_NAME);
         assertEquals(sfpRenderedServicePathList.get(0).getName(), RSP_NAME);
 
         SfcProviderRpc sfcProviderRpc = new SfcProviderRpc();
@@ -321,7 +366,7 @@ public class SfcProviderRpcTest extends AbstractDataStoreManager {
         init();
 
         ServiceFunctionPath serviceFunctionPath =
-                SfcProviderServicePathAPI.readServiceFunctionPathExecutor(SFP_NAME);
+                SfcProviderServicePathAPI.readServiceFunctionPath(SFP_NAME);
         assertNotNull("Must be not null", serviceFunctionPath);
 
         CreateRenderedPathInputBuilder createRenderedPathInputBuilder = new CreateRenderedPathInputBuilder();
@@ -334,16 +379,16 @@ public class SfcProviderRpcTest extends AbstractDataStoreManager {
                 serviceFunctionPath, createRenderedPathInput);
 
         //check if SFF oper contains RSP
-        List<SffServicePath> sffServicePathList = SfcProviderServiceForwarderAPI.readSffStateExecutor(SFF_NAMES[1]);
+        List<SffServicePath> sffServicePathList = SfcProviderServiceForwarderAPI.readSffState(SFF_NAMES[1]);
         assertNotNull("Must be not null", sffServicePathList);
         assertEquals(sffServicePathList.get(0).getName(), RSP_NAME);
 
         //check if SF oper contains RSP
-        List<SfServicePath> sfServicePathList = SfcProviderServiceFunctionAPI.readServiceFunctionStateExecutor("unittest-fw-1");
+        List<SfServicePath> sfServicePathList = SfcProviderServiceFunctionAPI.readServiceFunctionState("unittest-fw-1");
         assertEquals(sfServicePathList.get(0).getName(), RSP_NAME);
 
         //check if SFP oper contains RSP
-        List<SfpRenderedServicePath> sfpRenderedServicePathList = SfcProviderServicePathAPI.readServicePathStateExecutor(SFP_NAME);
+        List<SfpRenderedServicePath> sfpRenderedServicePathList = SfcProviderServicePathAPI.readServicePathState(SFP_NAME);
         assertEquals(sfpRenderedServicePathList.get(0).getName(), RSP_NAME);
 
         SfcProviderRpc sfcProviderRpc = new SfcProviderRpc();
@@ -819,7 +864,7 @@ public class SfcProviderRpcTest extends AbstractDataStoreManager {
         ServiceFunctionTypeBuilder serviceFunctionTypeBuilder = new ServiceFunctionTypeBuilder();
         serviceFunctionTypeBuilder.setKey(new ServiceFunctionTypeKey(serviceType))
                 .setSftServiceFunctionName(sftServiceFunctionNames);
-        return SfcProviderServiceTypeAPI.putServiceFunctionTypeExecutor(serviceFunctionTypeBuilder.build());
+        return SfcProviderServiceTypeAPI.putServiceFunctionType(serviceFunctionTypeBuilder.build());
     }
 
     /*
@@ -839,7 +884,7 @@ public class SfcProviderRpcTest extends AbstractDataStoreManager {
         serviceFunctionForwarderBuilder.setName(forwarderName)
                 .setKey(new ServiceFunctionForwarderKey(forwarderName))
                 .setSffDataPlaneLocator(sffDataPlaneLocator);
-        return SfcProviderServiceForwarderAPI.putServiceFunctionForwarderExecutor(serviceFunctionForwarderBuilder.build());
+        return SfcProviderServiceForwarderAPI.putServiceFunctionForwarder(serviceFunctionForwarderBuilder.build());
     }
 
     /*
@@ -861,7 +906,7 @@ public class SfcProviderRpcTest extends AbstractDataStoreManager {
                 .setSfDataPlaneLocator(sfDataPlaneLocator)
                 .setType(functionType);
 
-        return SfcProviderServiceFunctionAPI.putServiceFunctionExecutor(serviceFunctionBuilder.build());
+        return SfcProviderServiceFunctionAPI.putServiceFunction(serviceFunctionBuilder.build());
     }
 
     /*
@@ -891,7 +936,7 @@ public class SfcProviderRpcTest extends AbstractDataStoreManager {
                 .setSfcServiceFunction(sfcServiceFunctionList)
                 .setType(groupType);
 
-        return SfcProviderServiceFunctionGroupAPI.putServiceFunctionGroupExecutor(serviceFunctionGroupBuilder.build());
+        return SfcProviderServiceFunctionGroupAPI.putServiceFunctionGroup(serviceFunctionGroupBuilder.build());
     }
 
     /*
@@ -914,7 +959,7 @@ public class SfcProviderRpcTest extends AbstractDataStoreManager {
         for (String sfName : sfNames) {
             sfcSfgServiceFunctionBuilder.setName(sfName)
                     .setKey(new SfcServiceFunctionKey(sfName))
-                    .setType(SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(sfName).getType());
+                    .setType(SfcProviderServiceFunctionAPI.readServiceFunction(sfName).getType());
 
             sfcSfgServiceFunctionList.add(sfcSfgServiceFunctionBuilder.build());
         }
@@ -923,7 +968,7 @@ public class SfcProviderRpcTest extends AbstractDataStoreManager {
                 .setKey(new ServiceFunctionChainKey(chainName))
                 .setSfcServiceFunction(sfcSfgServiceFunctionList);
 
-        return SfcProviderServiceChainAPI.putServiceFunctionChainExecutor(serviceFunctionChainBuilder.build());
+        return SfcProviderServiceChainAPI.putServiceFunctionChain(serviceFunctionChainBuilder.build());
     }
 
     /*
@@ -942,7 +987,7 @@ public class SfcProviderRpcTest extends AbstractDataStoreManager {
                 .setClassifier(classifierName)
                 .setSymmetricClassifier(classifierRevName)
                 .setSymmetric(symmetric);
-        return SfcProviderServicePathAPI.putServiceFunctionPathExecutor(serviceFunctionPathBuilder.build());
+        return SfcProviderServicePathAPI.putServiceFunctionPath(serviceFunctionPathBuilder.build());
     }
 
     /*
index 3071c1d76f1da28a1430fccaf3581aad7958d243..1cc70787c8c1e7a5eb7fa804d7ad43c868498ef1 100644 (file)
@@ -8,6 +8,20 @@
 
 package org.opendaylight.sfc.provider;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -16,7 +30,13 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.sfc.provider.api.*;
+import org.opendaylight.sfc.provider.api.SfcDataStoreAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderRenderedPathAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderServiceChainAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderServiceForwarderAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderServiceFunctionAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderServicePathAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderServiceTypeAPI;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.CreateRenderedPathInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.rendered.service.paths.RenderedServicePath;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctions;
@@ -37,13 +57,25 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev1407
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderKey;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.*;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ConnectedSffDictionary;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ConnectedSffDictionaryBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionary;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryKey;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocator;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocatorBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocatorKey;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocator;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocatorBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.sff.data.plane.locator.DataPlaneLocatorBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev140701.service.function.paths.ServiceFunctionPath;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev140701.service.function.paths.ServiceFunctionPathBuilder;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.*;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Dpi;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Firewall;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.HttpHeaderEnrichment;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Napt44;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Qos;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.ServiceFunctionTypeIdentity;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.service.function.types.service.function.type.SftServiceFunctionName;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.VxlanGpe;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.data.plane.locator.locator.type.IpBuilder;
@@ -56,11 +88,6 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.*;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.when;
-
 
 
 /**
@@ -193,7 +220,7 @@ public class SfcProviderSfEntryDataListenerTest extends AbstractDataStoreManager
         ServiceFunction originalServiceFunction = build_service_function();
         InstanceIdentifier<ServiceFunction> sfEntryIID = InstanceIdentifier.builder(ServiceFunctions.class).
                 child(ServiceFunction.class, originalServiceFunction.getKey()).build();
-        assertTrue(SfcProviderServiceFunctionAPI.putServiceFunctionExecutor(originalServiceFunction));
+        assertTrue(SfcProviderServiceFunctionAPI.putServiceFunction(originalServiceFunction));
         /* Since there is no listener we need to create a Service Function Type Entry */
         assertTrue(SfcProviderServiceTypeAPI.createServiceFunctionTypeEntry(originalServiceFunction));
 
@@ -225,7 +252,7 @@ public class SfcProviderSfEntryDataListenerTest extends AbstractDataStoreManager
 
         //Clean-up
         assertTrue(SfcProviderServiceTypeAPI.deleteServiceFunctionTypeEntry(updatedServiceFunction));
-        assertTrue(SfcProviderServiceFunctionAPI.deleteServiceFunctionExecutor(originalServiceFunction.getName()));
+        assertTrue(SfcProviderServiceFunctionAPI.deleteServiceFunction(originalServiceFunction.getName()));
         Thread.sleep(500);
         assertNull(SfcProviderServiceTypeAPI.readServiceFunctionTypeEntry(originalServiceFunction));
 
@@ -259,7 +286,7 @@ public class SfcProviderSfEntryDataListenerTest extends AbstractDataStoreManager
 
         // Prepare to remove the first SF used by the RSP.
         String sfName = renderedServicePath.getRenderedServicePathHop().get(0).getServiceFunctionName();
-        ServiceFunction serviceFunction = SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(sfName);
+        ServiceFunction serviceFunction = SfcProviderServiceFunctionAPI.readServiceFunction(sfName);
         assertNotNull(serviceFunction);
 
         // Now we prepare to remove the entry through the listener
@@ -278,7 +305,7 @@ public class SfcProviderSfEntryDataListenerTest extends AbstractDataStoreManager
 
         sfEntryDataListener.onDataChanged(dataChangeEvent);
         Thread.sleep(500);
-        assertNull(SfcProviderRenderedPathAPI.readRenderedServicePathExecutor(renderedServicePath.getName()));
+        assertNull(SfcProviderRenderedPathAPI.readRenderedServicePath(renderedServicePath.getName()));
         List<String> sfpNameList = SfcProviderServiceFunctionAPI.
                 readServiceFunctionStateAsStringList(serviceFunction.getName());
         if (sfpNameList != null) {
@@ -324,7 +351,7 @@ public class SfcProviderSfEntryDataListenerTest extends AbstractDataStoreManager
 
         // Prepare to update the first SF used by the RSP.
         String sfName = renderedServicePath.getRenderedServicePathHop().get(0).getServiceFunctionName();
-        ServiceFunction originalServiceFunction = SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(sfName);
+        ServiceFunction originalServiceFunction = SfcProviderServiceFunctionAPI.readServiceFunction(sfName);
         assertNotNull(originalServiceFunction);
 
         // Now we prepare the updated data. We change mgmt address and type
@@ -357,7 +384,7 @@ public class SfcProviderSfEntryDataListenerTest extends AbstractDataStoreManager
 
         //Clean-up
         assertTrue(SfcProviderServiceTypeAPI.deleteServiceFunctionTypeEntry(updatedServiceFunction));
-        assertNull(SfcProviderRenderedPathAPI.readRenderedServicePathExecutor(renderedServicePath.getName()));
+        assertNull(SfcProviderRenderedPathAPI.readRenderedServicePath(renderedServicePath.getName()));
         List<String> sfpNameList = SfcProviderServiceFunctionAPI.
                 readServiceFunctionStateAsStringList(originalServiceFunction.getName());
         if (sfpNameList != null) {
@@ -470,13 +497,13 @@ public class SfcProviderSfEntryDataListenerTest extends AbstractDataStoreManager
         ServiceFunctionsBuilder sfsBuilder = new ServiceFunctionsBuilder();
         sfsBuilder.setServiceFunction(sfList);
 
-        assertTrue(SfcProviderServiceFunctionAPI.putAllServiceFunctionsExecutor(sfsBuilder.build()));
+        assertTrue(SfcProviderServiceFunctionAPI.putAllServiceFunctions(sfsBuilder.build()));
         //executor.submit(SfcProviderServiceFunctionAPI.getPutAll(new Object[]{sfsBuilder.build()}, new Class[]{ServiceFunctions.class})).get();
         Thread.sleep(1000); // Wait they are really created
 
         // Create ServiceFunctionTypeEntry for all ServiceFunctions
         for (ServiceFunction serviceFunction : sfList) {
-            assertTrue(SfcProviderServiceTypeAPI.createServiceFunctionTypeEntryExecutor(serviceFunction));
+            assertTrue(SfcProviderServiceTypeAPI.createServiceFunctionTypeEntry(serviceFunction));
         }
 
         // Create Service Function Forwarders
@@ -532,7 +559,7 @@ public class SfcProviderSfEntryDataListenerTest extends AbstractDataStoreManager
         ServiceFunctionForwardersBuilder serviceFunctionForwardersBuilder = new ServiceFunctionForwardersBuilder();
         serviceFunctionForwardersBuilder.setServiceFunctionForwarder(sffList);
         assertTrue(SfcProviderServiceForwarderAPI.
-                putAllServiceFunctionForwardersExecutor(serviceFunctionForwardersBuilder.build()));
+                putAllServiceFunctionForwarders(serviceFunctionForwardersBuilder.build()));
 
         //Create Service Function Chain
         ServiceFunctionChainKey sfcKey = new ServiceFunctionChainKey(SFC_NAME);
@@ -555,7 +582,7 @@ public class SfcProviderSfEntryDataListenerTest extends AbstractDataStoreManager
 //        Object[] parameters = {sfcBuilder.build()};
 //        Class[] parameterTypes = {ServiceFunctionChain.class};
 
-        assertTrue(SfcProviderServiceChainAPI.putServiceFunctionChainExecutor(sfcBuilder.build()));
+        assertTrue(SfcProviderServiceChainAPI.putServiceFunctionChain(sfcBuilder.build()));
 //        executor.submit(SfcProviderServiceChainAPI
 //                .getPut(parameters, parameterTypes)).get();
         Thread.sleep(1000); // Wait SFC is really crated
@@ -568,7 +595,7 @@ public class SfcProviderSfEntryDataListenerTest extends AbstractDataStoreManager
 //        ServiceFunctionChain sfc2 = (ServiceFunctionChain) result;
 
         ServiceFunctionChain readServiceFunctionChain =
-                SfcProviderServiceChainAPI.readServiceFunctionChainExecutor(SFC_NAME);
+                SfcProviderServiceChainAPI.readServiceFunctionChain(SFC_NAME);
 
         assertNotNull(readServiceFunctionChain);
 
@@ -582,7 +609,7 @@ public class SfcProviderSfEntryDataListenerTest extends AbstractDataStoreManager
                 .setSymmetric(true);
         ServiceFunctionPath serviceFunctionPath = pathBuilder.build();
         assertNotNull("Must be not null", serviceFunctionPath);
-        assertTrue(SfcProviderServicePathAPI.putServiceFunctionPathExecutor(serviceFunctionPath));
+        assertTrue(SfcProviderServicePathAPI.putServiceFunctionPath(serviceFunctionPath));
 //        assertTrue("Must be true", ret);
 
         Thread.sleep(1000); // Wait they are really created
index b6d76a44d77d43c1a05c140031fe2f8ce568d7e1..2e9e1975ee9be7d07738b6d5c0a6ce74e7c681e2 100644 (file)
@@ -8,6 +8,19 @@
 
 package org.opendaylight.sfc.provider;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -15,7 +28,13 @@ import org.mockito.Mockito;
 import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.sfc.provider.api.*;
+import org.opendaylight.sfc.provider.api.SfcDataStoreAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderRenderedPathAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderServiceChainAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderServiceForwarderAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderServiceFunctionAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderServicePathAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderServiceTypeAPI;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.CreateRenderedPathInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.rendered.service.paths.RenderedServicePath;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctionsBuilder;
@@ -37,14 +56,25 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev1407
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderKey;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.*;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ConnectedSffDictionary;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ConnectedSffDictionaryBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionary;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryKey;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocator;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocatorBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocatorKey;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocator;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocatorBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.sff.data.plane.locator.DataPlaneLocatorBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.state.service.function.forwarder.state.SffServicePath;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev140701.service.function.paths.ServiceFunctionPath;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev140701.service.function.paths.ServiceFunctionPathBuilder;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.*;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Dpi;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Firewall;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.HttpHeaderEnrichment;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Napt44;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Qos;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.VxlanGpe;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.data.plane.locator.locator.type.IpBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
@@ -56,11 +86,6 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.*;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.when;
-
 
 /**
  * SfcProviderSfEntryDataListener Tester.
@@ -179,7 +204,7 @@ public class SfcProviderSffEntryDataListenerTest extends AbstractDataStoreManage
         String sffName = renderedServicePath.getRenderedServicePathHop().get(0).getServiceFunctionForwarder();
         LOG.info("sffNme: {}", sffName);
         ServiceFunctionForwarder serviceFunctionForwarder = SfcProviderServiceForwarderAPI.
-                readServiceFunctionForwarderExecutor(sffName);
+                readServiceFunctionForwarder(sffName);
         assertNotNull(serviceFunctionForwarder);
 
         // Now we prepare to remove the entry through the listener
@@ -201,10 +226,10 @@ public class SfcProviderSffEntryDataListenerTest extends AbstractDataStoreManage
         sffEntryDataListener.onDataChanged(dataChangeEvent);
         Thread.sleep(2000);
         // Verify that RSP was removed
-        assertNull(SfcProviderRenderedPathAPI.readRenderedServicePathExecutor(renderedServicePath.getName()));
+        assertNull(SfcProviderRenderedPathAPI.readRenderedServicePath(renderedServicePath.getName()));
 
         // Verify that State was removed
-        List<SffServicePath> sffServicePathList = SfcProviderServiceForwarderAPI.readSffStateExecutor(sffName);
+        List<SffServicePath> sffServicePathList = SfcProviderServiceForwarderAPI.readSffState(sffName);
         assertNull(sffServicePathList);
 /*        for (SffServicePath sffServicePath : sffServicePathList) {
             assertNotEquals(sffServicePath.getName(), renderedServicePath.getName());
@@ -248,7 +273,7 @@ public class SfcProviderSffEntryDataListenerTest extends AbstractDataStoreManage
         // Prepare to remove the first SF used by the RSP.
         String sffName = renderedServicePath.getRenderedServicePathHop().get(0).getServiceFunctionForwarder();
         ServiceFunctionForwarder serviceFunctionForwarder = SfcProviderServiceForwarderAPI.
-                readServiceFunctionForwarderExecutor(sffName);
+                readServiceFunctionForwarder(sffName);
         assertNotNull(serviceFunctionForwarder);
 
         // Now we prepare the updated data. We change mgmt address and type
@@ -277,10 +302,10 @@ public class SfcProviderSffEntryDataListenerTest extends AbstractDataStoreManage
          */
         sffEntryDataListener.onDataChanged(dataChangeEvent);
         Thread.sleep(500);
-        assertNull(SfcProviderRenderedPathAPI.readRenderedServicePathExecutor(renderedServicePath.getName()));
+        assertNull(SfcProviderRenderedPathAPI.readRenderedServicePath(renderedServicePath.getName()));
 
         // Verify that State was removed
-        List<SffServicePath> sffServicePathList = SfcProviderServiceForwarderAPI.readSffStateExecutor(sffName);
+        List<SffServicePath> sffServicePathList = SfcProviderServiceForwarderAPI.readSffState(sffName);
         assertNull(sffServicePathList);
 /*        for (SffServicePath sffServicePath : sffServicePathList) {
             assertNotEquals(sffServicePath.getName(), renderedServicePath.getName());
@@ -361,7 +386,7 @@ public class SfcProviderSffEntryDataListenerTest extends AbstractDataStoreManage
                         .setServiceNode(null) // for consistency only; we are going to get rid of ServiceNodes in the future
                         .build();
 
-        assertTrue(SfcProviderServiceForwarderAPI.putServiceFunctionForwarderExecutor(sff));
+        assertTrue(SfcProviderServiceForwarderAPI.putServiceFunctionForwarder(sff));
 
         return sff;
 
@@ -423,13 +448,13 @@ public class SfcProviderSffEntryDataListenerTest extends AbstractDataStoreManage
         ServiceFunctionsBuilder sfsBuilder = new ServiceFunctionsBuilder();
         sfsBuilder.setServiceFunction(sfList);
 
-        assertTrue(SfcProviderServiceFunctionAPI.putAllServiceFunctionsExecutor(sfsBuilder.build()));
+        assertTrue(SfcProviderServiceFunctionAPI.putAllServiceFunctions(sfsBuilder.build()));
         //executor.submit(SfcProviderServiceFunctionAPI.getPutAll(new Object[]{sfsBuilder.build()}, new Class[]{ServiceFunctions.class})).get();
         Thread.sleep(1000); // Wait they are really created
 
         // Create ServiceFunctionTypeEntry for all ServiceFunctions
         for (ServiceFunction serviceFunction : sfList) {
-            assertTrue(SfcProviderServiceTypeAPI.createServiceFunctionTypeEntryExecutor(serviceFunction));
+            assertTrue(SfcProviderServiceTypeAPI.createServiceFunctionTypeEntry(serviceFunction));
         }
 
         // Create Service Function Forwarders
@@ -483,7 +508,7 @@ public class SfcProviderSffEntryDataListenerTest extends AbstractDataStoreManage
         ServiceFunctionForwardersBuilder serviceFunctionForwardersBuilder = new ServiceFunctionForwardersBuilder();
         serviceFunctionForwardersBuilder.setServiceFunctionForwarder(sffList);
         assertTrue(SfcProviderServiceForwarderAPI.
-                putAllServiceFunctionForwardersExecutor(serviceFunctionForwardersBuilder.build()));
+                putAllServiceFunctionForwarders(serviceFunctionForwardersBuilder.build()));
 
         //Create Service Function Chain
         ServiceFunctionChainKey sfcKey = new ServiceFunctionChainKey(SFC_NAME);
@@ -503,12 +528,12 @@ public class SfcProviderSffEntryDataListenerTest extends AbstractDataStoreManage
                 .setSfcServiceFunction(sfcServiceFunctionList)
                 .setSymmetric(true);
 
-        assertTrue(SfcProviderServiceChainAPI.putServiceFunctionChainExecutor(sfcBuilder.build()));
+        assertTrue(SfcProviderServiceChainAPI.putServiceFunctionChain(sfcBuilder.build()));
 
         Thread.sleep(1000); // Wait SFC is really crated
 
         ServiceFunctionChain readServiceFunctionChain =
-                SfcProviderServiceChainAPI.readServiceFunctionChainExecutor(SFC_NAME);
+                SfcProviderServiceChainAPI.readServiceFunctionChain(SFC_NAME);
 
         assertNotNull(readServiceFunctionChain);
 
@@ -521,7 +546,7 @@ public class SfcProviderSffEntryDataListenerTest extends AbstractDataStoreManage
                 .setSymmetric(true);
         ServiceFunctionPath serviceFunctionPath = pathBuilder.build();
         assertNotNull("Must be not null", serviceFunctionPath);
-        assertTrue(SfcProviderServicePathAPI.putServiceFunctionPathExecutor(serviceFunctionPath));
+        assertTrue(SfcProviderServicePathAPI.putServiceFunctionPath(serviceFunctionPath));
 
         Thread.sleep(1000); // Wait they are really created
 
index ad652931baa51584e1f41aa98cba42ef2f34fb0f..861f5ac63a9e6cb5bde7a89602983f48c0a14720 100644 (file)
@@ -8,6 +8,18 @@
 
 package org.opendaylight.sfc.provider;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -16,25 +28,21 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.sfc.provider.api.*;
-import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.ServiceFunctionSchedulerTypes;
+import org.opendaylight.sfc.provider.api.SfcDataStoreAPI;
+import org.opendaylight.sfc.provider.api.SfcProviderScheduleTypeAPI;
+import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.LoadBalance;
+import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.Random;
+import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.RoundRobin;
 import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.ServiceFunctionSchedulerTypeIdentity;
+import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.ServiceFunctionSchedulerTypes;
 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.ServiceFunctionSchedulerTypeKey;
 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.Random;
-import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.RoundRobin;
-import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.LoadBalance;
+import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.service.function.scheduler.types.ServiceFunctionSchedulerTypeKey;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import java.util.concurrent.Future;
-import java.util.*;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.when;
 
 
 
@@ -82,7 +90,7 @@ public class SfcProviderSfstEntryDataListenerTest extends AbstractDataStoreManag
 
         ServiceFunctionSchedulerType serviceFunctionSchedulerType = build_service_function_scheduler_type();
 
-        assertTrue(SfcProviderScheduleTypeAPI.putServiceFunctionScheduleTypeExecutor(serviceFunctionSchedulerType));
+        assertTrue(SfcProviderScheduleTypeAPI.putServiceFunctionScheduleType(serviceFunctionSchedulerType));
         InstanceIdentifier<ServiceFunctionSchedulerType> sfstEntryIID = InstanceIdentifier.builder(ServiceFunctionSchedulerTypes.class).
                 child(ServiceFunctionSchedulerType.class, serviceFunctionSchedulerType.getKey()).build();
 
@@ -98,12 +106,12 @@ public class SfcProviderSfstEntryDataListenerTest extends AbstractDataStoreManag
         sfstEntryDataListener.onDataChanged(dataChangeEvent);
         Thread.sleep(500);
 
-        ServiceFunctionSchedulerType sfst = SfcProviderScheduleTypeAPI.readServiceFunctionScheduleTypeExecutor(serviceFunctionSchedulerType.getType());
+        ServiceFunctionSchedulerType sfst = SfcProviderScheduleTypeAPI.readServiceFunctionScheduleType(serviceFunctionSchedulerType.getType());
         assertNotNull(sfst);
         assertEquals(serviceFunctionSchedulerType, sfst);
         Thread.sleep(500);
         //Clean-up
-        assertTrue(SfcProviderScheduleTypeAPI.deleteServiceFunctionScheduleTypeExecutor(serviceFunctionSchedulerType.getType()));
+        assertTrue(SfcProviderScheduleTypeAPI.deleteServiceFunctionScheduleType(serviceFunctionSchedulerType.getType()));
         Thread.sleep(500);
     }
 
@@ -140,7 +148,7 @@ public class SfcProviderSfstEntryDataListenerTest extends AbstractDataStoreManag
 
         sfstEntryDataListener.onDataChanged(dataChangeEvent);
         Thread.sleep(500);
-        assertNull(SfcProviderScheduleTypeAPI.readServiceFunctionScheduleTypeExecutor(serviceFunctionSchedulerType.getType()));
+        assertNull(SfcProviderScheduleTypeAPI.readServiceFunctionScheduleType(serviceFunctionSchedulerType.getType()));
     }
 
     /**
@@ -167,7 +175,7 @@ public class SfcProviderSfstEntryDataListenerTest extends AbstractDataStoreManag
 
         InstanceIdentifier<ServiceFunctionSchedulerType> sfstEntryIID = InstanceIdentifier.builder(ServiceFunctionSchedulerTypes.class).
                 child(ServiceFunctionSchedulerType.class, serviceFunctionSchedulerType.getKey()).build();
-        assertTrue(SfcProviderScheduleTypeAPI.putServiceFunctionScheduleTypeExecutor(serviceFunctionSchedulerType));
+        assertTrue(SfcProviderScheduleTypeAPI.putServiceFunctionScheduleType(serviceFunctionSchedulerType));
 
         originalData.put(sfstEntryIID, serviceFunctionSchedulerType);
 
@@ -175,7 +183,7 @@ public class SfcProviderSfstEntryDataListenerTest extends AbstractDataStoreManag
 
         updatedServiceFunctionSchedulerTypeBuilder.setName(SchedulerTypeName);
         ServiceFunctionSchedulerType updatedServiceFunctionSchedulerType = updatedServiceFunctionSchedulerTypeBuilder.build();
-        assertTrue(SfcProviderScheduleTypeAPI.putServiceFunctionScheduleTypeExecutor(updatedServiceFunctionSchedulerType));
+        assertTrue(SfcProviderScheduleTypeAPI.putServiceFunctionScheduleType(updatedServiceFunctionSchedulerType));
         updatedData.put(sfstEntryIID, updatedServiceFunctionSchedulerType);
 
         when(dataChangeEvent.getUpdatedData()).thenReturn(updatedData);
@@ -188,12 +196,12 @@ public class SfcProviderSfstEntryDataListenerTest extends AbstractDataStoreManag
          */
         sfstEntryDataListener.onDataChanged(dataChangeEvent);
         Thread.sleep(500);
-        ServiceFunctionSchedulerType sfst = SfcProviderScheduleTypeAPI.readServiceFunctionScheduleTypeExecutor(updatedServiceFunctionSchedulerType.getType());
+        ServiceFunctionSchedulerType sfst = SfcProviderScheduleTypeAPI.readServiceFunctionScheduleType(updatedServiceFunctionSchedulerType.getType());
         assertNotNull(sfst);
         assertEquals(updatedServiceFunctionSchedulerType.getName(), sfst.getName());
 
         //Clean-up
-        assertTrue(SfcProviderScheduleTypeAPI.deleteServiceFunctionScheduleTypeExecutor(serviceFunctionSchedulerType.getType()));
+        assertTrue(SfcProviderScheduleTypeAPI.deleteServiceFunctionScheduleType(serviceFunctionSchedulerType.getType()));
         Thread.sleep(500);
     }
 
@@ -266,7 +274,7 @@ public class SfcProviderSfstEntryDataListenerTest extends AbstractDataStoreManag
 
             ServiceFunctionSchedulerType serviceFunctionSchedulerType = sfstBuilder.build();
 
-            assertTrue(SfcProviderScheduleTypeAPI.putServiceFunctionScheduleTypeExecutor(serviceFunctionSchedulerType));
+            assertTrue(SfcProviderScheduleTypeAPI.putServiceFunctionScheduleType(serviceFunctionSchedulerType));
             InstanceIdentifier<ServiceFunctionSchedulerType> sfstEntryIID = InstanceIdentifier.builder(ServiceFunctionSchedulerTypes.class).
                 child(ServiceFunctionSchedulerType.class, serviceFunctionSchedulerType.getKey()).build();
 
@@ -286,14 +294,7 @@ public class SfcProviderSfstEntryDataListenerTest extends AbstractDataStoreManag
 
     public int countNumOfEnabledAlgorithmType() throws Exception  {
         int count = 0;
-        OpendaylightSfc ODL_SFC = OpendaylightSfc.getOpendaylightSfcObj();
-        Object[] serviceScheduleTypeObj = {};
-        Class[] serviceScheduleTypeClass = {};
-        SfcProviderScheduleTypeAPI sfcProviderScheduleTypeAPI = SfcProviderScheduleTypeAPI
-                .getReadAll(serviceScheduleTypeObj, serviceScheduleTypeClass);
-        Future future = ODL_SFC.getExecutor().submit(sfcProviderScheduleTypeAPI);
-
-        ServiceFunctionSchedulerTypes sfsts = (ServiceFunctionSchedulerTypes) future.get();
+        ServiceFunctionSchedulerTypes sfsts = SfcProviderScheduleTypeAPI.readAllServiceFunctionScheduleTypes();
         List<ServiceFunctionSchedulerType> sfstList = sfsts.getServiceFunctionSchedulerType();
 
         for (ServiceFunctionSchedulerType sfst: sfstList) {
index 057bb5634ca84901b6fc9d412f3c95253241c323..e540f886c74ba0701f3e9a649466c8f0bda69526 100644 (file)
@@ -8,9 +8,15 @@
 
 package org.opendaylight.sfc.provider.api;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
 import org.junit.Before;
 import org.opendaylight.sfc.provider.AbstractDataStoreManager;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctions;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.entry.SfDataPlaneLocator;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.entry.SfDataPlaneLocatorBuilder;
@@ -27,13 +33,24 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev1407
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderKey;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.*;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ConnectedSffDictionary;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ConnectedSffDictionaryBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionary;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryKey;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocator;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocatorBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocatorKey;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocator;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocatorBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.sff.data.plane.locator.DataPlaneLocatorBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev140701.service.function.paths.ServiceFunctionPath;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev140701.service.function.paths.ServiceFunctionPathBuilder;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.*;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Dpi;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Firewall;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.HttpHeaderEnrichment;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Napt44;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Qos;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.VxlanGpe;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.data.plane.locator.locator.type.IpBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
@@ -42,14 +59,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
 /**
  * Wrapper around DataStore APIs. These methods take care of retries and callbacks
  * automatically.
@@ -90,7 +99,7 @@ public abstract class AbstractSfcRendererServicePathAPITest extends AbstractData
 
     //auxiliary method
 
-    protected void init() throws ExecutionException, InterruptedException {
+    protected void init() {
         // Create Service Functions
         final IpAddress[] ipMgmtAddress = new IpAddress[sfNames.length];
         final IpAddress[] locatorIpAddress = new IpAddress[sfNames.length];
@@ -121,12 +130,11 @@ public abstract class AbstractSfcRendererServicePathAPITest extends AbstractData
         ServiceFunctionsBuilder sfsBuilder = new ServiceFunctionsBuilder();
         sfsBuilder.setServiceFunction(sfList);
 
-        executor.submit(SfcProviderServiceFunctionAPI.getPutAll(new Object[]{sfsBuilder.build()}, new Class[]{ServiceFunctions.class})).get();
-        Thread.sleep(1000); // Wait they are really created
+        SfcProviderServiceFunctionAPI.putAllServiceFunctions(sfsBuilder.build());
 
         // Create ServiceFunctionTypeEntry for all ServiceFunctions
         for (ServiceFunction serviceFunction : sfList) {
-            boolean ret = SfcProviderServiceTypeAPI.createServiceFunctionTypeEntryExecutor(serviceFunction);
+            boolean ret = SfcProviderServiceTypeAPI.createServiceFunctionTypeEntry(serviceFunction);
             LOG.debug("call createServiceFunctionTypeEntryExecutor for {}", serviceFunction.getName());
             assertTrue("Must be true", ret);
         }
@@ -177,7 +185,7 @@ public abstract class AbstractSfcRendererServicePathAPITest extends AbstractData
                     .setConnectedSffDictionary(sffDictionaryList)
                     .setServiceNode(null);
             ServiceFunctionForwarder sff = sffBuilder.build();
-            executor.submit(SfcProviderServiceForwarderAPI.getPut(new Object[]{sff}, new Class[]{ServiceFunctionForwarder.class})).get();
+            SfcProviderServiceForwarderAPI.putServiceFunctionForwarder(sff);
         }
 
         //Create Service Function Chain
@@ -198,19 +206,10 @@ public abstract class AbstractSfcRendererServicePathAPITest extends AbstractData
                 .setSfcServiceFunction(sfcServiceFunctionList)
                 .setSymmetric(true);
 
-        Object[] parameters = {sfcBuilder.build()};
-        Class[] parameterTypes = {ServiceFunctionChain.class};
-
-        executor.submit(SfcProviderServiceChainAPI
-                .getPut(parameters, parameterTypes)).get();
-        Thread.sleep(1000); // Wait SFC is really crated
+        SfcProviderServiceChainAPI.putServiceFunctionChain(sfcBuilder.build());
 
         //Check if Service Function Chain was created
-        Object[] parameters2 = {SFC_NAME};
-        Class[] parameterTypes2 = {String.class};
-        Object result = executor.submit(SfcProviderServiceChainAPI
-                .getRead(parameters2, parameterTypes2)).get();
-        ServiceFunctionChain sfc2 = (ServiceFunctionChain) result;
+        ServiceFunctionChain sfc2 = SfcProviderServiceChainAPI.readServiceFunctionChain(SFC_NAME);
 
         assertNotNull("Must be not null", sfc2);
         assertEquals("Must be equal", sfc2.getSfcServiceFunction(), sfcServiceFunctionList);
@@ -222,10 +221,8 @@ public abstract class AbstractSfcRendererServicePathAPITest extends AbstractData
                 .setSymmetric(true);
         ServiceFunctionPath serviceFunctionPath = pathBuilder.build();
         assertNotNull("Must be not null", serviceFunctionPath);
-        boolean ret = SfcProviderServicePathAPI.putServiceFunctionPathExecutor(serviceFunctionPath);
+        boolean ret = SfcProviderServicePathAPI.putServiceFunctionPath(serviceFunctionPath);
         assertTrue("Must be true", ret);
-
-        Thread.sleep(1000); // Wait they are really created
     }
 
 }
index 6916cba0e7545b5c55128a4a6809a563e4ae039b..e9aa36308938322263af1e32fd71e0726fe83155 100644 (file)
@@ -63,18 +63,6 @@ public class SfcProviderAclAPITest extends AbstractDataStoreManager {
         setOdlSfc();
     }
 
-    @Test
-    //tes SfcProviderAclAPI constructor
-    public void constructorTest() {
-        String methodName = "test string";
-        Object[] params = {methodName};
-        SfcProviderAclAPI sfcProviderAclAPI = new SfcProviderAclAPI(params, methodName);
-
-        assertNotNull("Must not be null", sfcProviderAclAPI);
-        assertEquals("Must be equal", sfcProviderAclAPI.getMethodName(), methodName);
-        assertEquals("Must be  equal", sfcProviderAclAPI.getParameters().getClass(), Object[].class);
-    }
-
     @Test
     //read existing access list from data store
     public void testReadAccessList() throws Exception {
@@ -93,7 +81,7 @@ public class SfcProviderAclAPITest extends AbstractDataStoreManager {
         assertTrue("must be true", transactionSuccessful);
 
         //read access list from data store
-        Acl accessList = SfcProviderAclAPI.readAccessListExecutor(ACL_NAME);
+        Acl accessList = SfcProviderAclAPI.readAccessList(ACL_NAME);
 
         assertNotNull("Must not be null", accessList);
         assertNotNull("Must not be null", accessList.getAccessListEntries());
@@ -131,7 +119,7 @@ public class SfcProviderAclAPITest extends AbstractDataStoreManager {
         assertTrue("must be true", transactionSuccessful);
 
         //read access list state from data store
-        AccessListState accessListState = SfcProviderAclAPI.readAccessListStateExecutor(ACL_STATE_NAME);
+        AccessListState accessListState = SfcProviderAclAPI.readAccessListState(ACL_STATE_NAME);
 
         assertNotNull("Must not be null", accessListState);
         assertEquals("Must be equal", accessListState.getAclName(), ACL_STATE_NAME);
@@ -149,12 +137,12 @@ public class SfcProviderAclAPITest extends AbstractDataStoreManager {
     public void testAddAndDeleteClassifier() throws Exception {
 
         //add classifier
-        boolean result = SfcProviderAclAPI.addClassifierToAccessListStateExecutor(ACL_NAME, CLASSIFIER_NAME);
+        boolean result = SfcProviderAclAPI.addClassifierToAccessListState(ACL_NAME, CLASSIFIER_NAME);
 
         assertTrue("Must be true", result);
 
         //delete classifier
-        result = SfcProviderAclAPI.deleteClassifierFromAccessListStateExecutor(ACL_NAME, CLASSIFIER_NAME);
+        result = SfcProviderAclAPI.deleteClassifierFromAccessListState(ACL_NAME, CLASSIFIER_NAME);
 
         assertTrue("Must be true", result);
     }
index e1fd43ddaa4e15a99a2019821ddb3d13c037c435..a05348b6f40b90fb66e53645467870d75c9fb96e 100755 (executable)
@@ -8,6 +8,14 @@
 
 package org.opendaylight.sfc.provider.api;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
 import org.junit.Test;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.CreateRenderedPathInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.rendered.service.path.first.hop.info.RenderedServicePathFirstHop;
@@ -18,22 +26,24 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev1407
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev140701.service.function.paths.ServiceFunctionPath;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev140701.service.function.paths.ServiceFunctionPathBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev140701.service.function.paths.state.service.function.path.state.SfpRenderedServicePath;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.*;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Dpi;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Firewall;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.HttpHeaderEnrichment;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Napt44;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Qos;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.ServiceFunctionTypeIdentity;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.Mpls;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.VxlanGpe;
 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.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
-import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.*;
+import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.LoadBalance;
+import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.Random;
+import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.RoundRobin;
+import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.ServiceFunctionSchedulerTypeIdentity;
+import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.ShortestPath;
 import org.powermock.reflect.Whitebox;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-import static org.junit.Assert.*;
-
 public class SfcProviderRenderedPathAPITest extends AbstractSfcRendererServicePathAPITest {
 
     @Test
@@ -56,10 +66,10 @@ public class SfcProviderRenderedPathAPITest extends AbstractSfcRendererServicePa
     }
 
     @Test
-    public void testReadRenderedServicePathFirstHop() throws ExecutionException, InterruptedException {
+    public void testReadRenderedServicePathFirstHop() {
         super.init();
 
-        ServiceFunctionPath serviceFunctionPath = SfcProviderServicePathAPI.readServiceFunctionPathExecutor(SFP_NAME);
+        ServiceFunctionPath serviceFunctionPath = SfcProviderServicePathAPI.readServiceFunctionPath(SFP_NAME);
         assertNotNull("Must be not null", serviceFunctionPath);
 
         /* Create RenderedServicePath and reverse RenderedServicePath */
@@ -95,12 +105,12 @@ public class SfcProviderRenderedPathAPITest extends AbstractSfcRendererServicePa
         assertEquals("Must be equal", firstHop.getPort(), new PortNumber(PORT[0]));
         assertEquals("Must be equal", lastHop.getIp(), new IpAddress(new Ipv4Address(SFF_LOCATOR_IP[SFF_LOCATOR_IP.length - 1])));
         assertEquals("Must be equal", lastHop.getPort(), new PortNumber(PORT[PORT.length - 1]));
-        SfcProviderRenderedPathAPI.deleteRenderedServicePathExecutor(renderedServicePath.getName());
-        SfcProviderRenderedPathAPI.deleteRenderedServicePathExecutor(revRenderedServicePath.getName());
+        SfcProviderRenderedPathAPI.deleteRenderedServicePath(renderedServicePath.getName());
+        SfcProviderRenderedPathAPI.deleteRenderedServicePath(revRenderedServicePath.getName());
     }
 
     @Test
-    public void testReadRspFirstHopBySftList() throws ExecutionException, InterruptedException {
+    public void testReadRspFirstHopBySftList() {
         init();
 
         List<Class<? extends ServiceFunctionTypeIdentity>> sftList = new ArrayList<>();
@@ -123,15 +133,14 @@ public class SfcProviderRenderedPathAPITest extends AbstractSfcRendererServicePa
     }
 
     @Test
-    public void testCreateRenderedServicePathHopList() throws ExecutionException, InterruptedException {
+    public void testCreateRenderedServicePathHopList() {
         init();
 
         final String[] tmpSfNames = {"unittest-fw-1", "unittest-dpi-1", "unittest-napt-1"};
         List<String> sfNameList = Arrays.asList(tmpSfNames);
         final int startingIndex = 255;
 
-        Object[] parameters = {};
-        SfcProviderRenderedPathAPI sfcProviderRenderedPathAPI = new SfcProviderRenderedPathAPI(parameters, null);
+        SfcProviderRenderedPathAPI sfcProviderRenderedPathAPI = new SfcProviderRenderedPathAPI();
 
         List<RenderedServicePathHop> rspHopList;
 
@@ -157,11 +166,11 @@ public class SfcProviderRenderedPathAPITest extends AbstractSfcRendererServicePa
     }
 
     @Test
-    public void testCreateRenderedServicePathAndState() throws ExecutionException, InterruptedException {
+    public void testCreateRenderedServicePathAndState() {
         init();
 
         ServiceFunctionPath serviceFunctionPath =
-                SfcProviderServicePathAPI.readServiceFunctionPathExecutor(SFP_NAME);
+                SfcProviderServicePathAPI.readServiceFunctionPath(SFP_NAME);
         assertNotNull("Must be not null", serviceFunctionPath);
 
         CreateRenderedPathInputBuilder createRenderedPathInputBuilder = new CreateRenderedPathInputBuilder();
@@ -171,16 +180,16 @@ public class SfcProviderRenderedPathAPITest extends AbstractSfcRendererServicePa
                 serviceFunctionPath, createRenderedPathInputBuilder.build());
 
         //check if SFF oper contains RSP
-        List<SffServicePath> sffServicePathList = SfcProviderServiceForwarderAPI.readSffStateExecutor(SFF_NAMES[1]);
+        List<SffServicePath> sffServicePathList = SfcProviderServiceForwarderAPI.readSffState(SFF_NAMES[1]);
         assertNotNull("Must be not null", sffServicePathList);
         assertEquals(sffServicePathList.get(0).getName(), RSP_NAME);
 
         //check if SF oper contains RSP
-        List<SfServicePath> sfServicePathList = SfcProviderServiceFunctionAPI.readServiceFunctionStateExecutor("unittest-fw-1");
+        List<SfServicePath> sfServicePathList = SfcProviderServiceFunctionAPI.readServiceFunctionState("unittest-fw-1");
         assertEquals(sfServicePathList.get(0).getName(), RSP_NAME);
 
         //check if SFP oper contains RSP
-        List<SfpRenderedServicePath> sfpRenderedServicePathList = SfcProviderServicePathAPI.readServicePathStateExecutor(SFP_NAME);
+        List<SfpRenderedServicePath> sfpRenderedServicePathList = SfcProviderServicePathAPI.readServicePathState(SFP_NAME);
         assertEquals(sfpRenderedServicePathList.get(0).getName(), RSP_NAME);
     }
 
@@ -192,7 +201,7 @@ public class SfcProviderRenderedPathAPITest extends AbstractSfcRendererServicePa
         Object[] params = new Object[0];
         CreateRenderedPathInputBuilder createRenderedPathInputBuilder = new CreateRenderedPathInputBuilder();
         ServiceFunctionPathBuilder serviceFunctionPathBuilder = new ServiceFunctionPathBuilder();
-        SfcProviderRenderedPathAPI sfcProviderRenderedPathAPI = new SfcProviderRenderedPathAPI(params, null);
+        SfcProviderRenderedPathAPI sfcProviderRenderedPathAPI = new SfcProviderRenderedPathAPI();
         RenderedServicePath testRenderedServicePath;
 
         serviceFunctionPathBuilder.setServiceChainName(null);
@@ -226,7 +235,7 @@ public class SfcProviderRenderedPathAPITest extends AbstractSfcRendererServicePa
         Object[] params = new Object[0];
         CreateRenderedPathInputBuilder createRenderedPathInputBuilder = new CreateRenderedPathInputBuilder();
         ServiceFunctionPathBuilder serviceFunctionPathBuilder = new ServiceFunctionPathBuilder();
-        SfcProviderRenderedPathAPI sfcProviderRenderedPathAPI = new SfcProviderRenderedPathAPI(params, null);
+        SfcProviderRenderedPathAPI sfcProviderRenderedPathAPI = new SfcProviderRenderedPathAPI();
         SfcServiceFunctionSchedulerAPI testScheduler = new SfcServiceFunctionRandomSchedulerAPI();
         RenderedServicePath testRenderedServicePath;
 
@@ -247,7 +256,7 @@ public class SfcProviderRenderedPathAPITest extends AbstractSfcRendererServicePa
         Object[] params = new Object[0];
         CreateRenderedPathInputBuilder createRenderedPathInputBuilder = new CreateRenderedPathInputBuilder();
         ServiceFunctionPathBuilder serviceFunctionPathBuilder = new ServiceFunctionPathBuilder();
-        SfcProviderRenderedPathAPI sfcProviderRenderedPathAPI = new SfcProviderRenderedPathAPI(params, null);
+        SfcProviderRenderedPathAPI sfcProviderRenderedPathAPI = new SfcProviderRenderedPathAPI();
         SfcServiceFunctionSchedulerAPI testScheduler = new SfcServiceFunctionRandomSchedulerAPI();
         RenderedServicePath testRenderedServicePath;
 
@@ -271,7 +280,7 @@ public class SfcProviderRenderedPathAPITest extends AbstractSfcRendererServicePa
         Object[] params = new Object[0];
         CreateRenderedPathInputBuilder createRenderedPathInputBuilder = new CreateRenderedPathInputBuilder();
         ServiceFunctionPathBuilder serviceFunctionPathBuilder = new ServiceFunctionPathBuilder();
-        SfcProviderRenderedPathAPI sfcProviderRenderedPathAPI = new SfcProviderRenderedPathAPI(params, null);
+        SfcProviderRenderedPathAPI sfcProviderRenderedPathAPI = new SfcProviderRenderedPathAPI();
         SfcServiceFunctionSchedulerAPI testScheduler = new SfcServiceFunctionRandomSchedulerAPI();
         RenderedServicePath testRenderedServicePath;
 
index a08dbe95e7c0110f701312e836989101138025cf..3bb1f1188708937634c068e4f5c1c7344e1334eb 100755 (executable)
@@ -8,6 +8,12 @@
 
 package org.opendaylight.sfc.provider.api;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.sfc.provider.AbstractDataStoreManager;
@@ -19,11 +25,6 @@ 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.ServiceFunctionSchedulerTypeBuilder;
 import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.service.function.scheduler.types.ServiceFunctionSchedulerTypeKey;
 
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-import static org.junit.Assert.*;
-
 public class SfcProviderScheduleTypeAPITest extends AbstractDataStoreManager {
 
     @Before
@@ -31,94 +32,8 @@ public class SfcProviderScheduleTypeAPITest extends AbstractDataStoreManager {
         setOdlSfc();
     }
 
-    /* Cannot pass at the moment, will fix later on
-     * Error log:
-     *  ERROR o.o.s.p.api.SfcProviderAbstractAPI - Could not find method readServiceFunctionScheduleType in class
-
     @Test
-    public void testCreateReadScheduleType() throws ExecutionException, InterruptedException {
-        String name = "random-01";
-        Class<? extends ServiceFunctionSchedulerTypeIdentity> type = Random.class;
-        ServiceFunctionSchedulerTypeKey key = new ServiceFunctionSchedulerTypeKey(type);
-
-        ServiceFunctionSchedulerTypeBuilder sfstBuilder = new ServiceFunctionSchedulerTypeBuilder();
-        sfstBuilder.setName(name).setType(type).setKey(key).setEnabled(true);
-
-        Object[] parameters = {sfstBuilder.build()};
-        Class[] parameterTypes = {ServiceFunctionSchedulerType.class};
-
-        try {
-            executor.submit(SfcProviderScheduleTypeAPI
-                    .getPut(parameters, parameterTypes)).get();
-        } catch (ExecutionException ee) {
-            assertEquals("Must be equal", 0, 1);
-        } catch (InterruptedException ie) {
-            assertEquals("Must be equal", 0, 1);
-        }
-
-        Object[] parameters2 = {type};
-        Class[] parameterTypes2 = {ServiceFunctionSchedulerTypeIdentity.class};
-        try {
-            Object result = executor.submit(SfcProviderScheduleTypeAPI
-                    .getRead(parameters2, parameterTypes2)).get();
-            ServiceFunctionSchedulerType sfst2 = (ServiceFunctionSchedulerType) result;
-
-            assertNotNull("Must be not null", sfst2);
-            assertEquals("Must be equal", sfst2.getName(), name);
-            assertEquals("Must be equal", sfst2.getType(), type);
-            assertEquals("Must be equal", sfst2.isEnabled(), true);
-        } catch (ExecutionException ee) {
-            assertEquals("Must be equal", 0, 1);
-        } catch (InterruptedException ie) {
-            assertEquals("Must be equal", 0, 1);
-        }
-    }
-
-    @Test
-    public void testCreateDeleteScheduleType() throws ExecutionException, InterruptedException {
-        String name = "random-01";
-        Class<? extends ServiceFunctionSchedulerTypeIdentity> type = Random.class;
-        ServiceFunctionSchedulerTypeKey key = new ServiceFunctionSchedulerTypeKey(type);
-
-        ServiceFunctionSchedulerTypeBuilder sfstBuilder = new ServiceFunctionSchedulerTypeBuilder();
-        sfstBuilder.setName(name).setType(type).setKey(key).setEnabled(true);
-
-        Object[] parameters = {sfstBuilder.build()};
-        Class[] parameterTypes = {ServiceFunctionSchedulerType.class};
-
-        try {
-            executor.submit(SfcProviderScheduleTypeAPI
-                    .getPut(parameters, parameterTypes)).get();
-        } catch (ExecutionException ee) {
-            assertEquals("Must be equal", 0, 1);
-        } catch (InterruptedException ie) {
-            assertEquals("Must be equal", 0, 1);
-        }
-
-        Object[] parameters2 = {type};
-        Class[] parameterTypes2 = {ServiceFunctionSchedulerTypeIdentity.class};
-        try {
-            Object result = executor.submit(SfcProviderScheduleTypeAPI
-                    .getRead(parameters2, parameterTypes2)).get();
-            ServiceFunctionSchedulerType sfst2 = (ServiceFunctionSchedulerType) result;
-            assertNotNull("Must be not null", sfst2);
-
-            result = executor.submit(SfcProviderScheduleTypeAPI
-                    .getDelete(parameters2, parameterTypes2)).get();
-            result = executor.submit(SfcProviderScheduleTypeAPI
-                    .getRead(parameters2, parameterTypes2)).get();
-            ServiceFunctionSchedulerType sfst3 = (ServiceFunctionSchedulerType) result;
-            assertNull("Must be null", sfst3);
-        } catch (ExecutionException ee) {
-            assertEquals("Must be equal", 0, 1);
-        } catch (InterruptedException ie) {
-            assertEquals("Must be equal", 0, 1);
-        }
-    }
-    */
-
-    @Test
-    public void testCreateReadAllScheduleTypes() throws ExecutionException, InterruptedException {
+    public void testCreateReadAllScheduleTypes() {
         String name1 = "random-01";
         Class<? extends ServiceFunctionSchedulerTypeIdentity> type1 = Random.class;
         ServiceFunctionSchedulerTypeKey key1 = new ServiceFunctionSchedulerTypeKey(type1);
@@ -132,27 +47,16 @@ public class SfcProviderScheduleTypeAPITest extends AbstractDataStoreManager {
         ServiceFunctionSchedulerTypeBuilder sfstBuilder2 = new ServiceFunctionSchedulerTypeBuilder();
         sfstBuilder2.setName(name2).setType(type2).setKey(key2).setEnabled(false);
 
-        Object[] parameters1 = {sfstBuilder1.build()};
-        Object[] parameters2 = {sfstBuilder2.build()};
-        Class[] parameterTypes = {ServiceFunctionSchedulerType.class};
+        SfcProviderScheduleTypeAPI.putServiceFunctionScheduleType(sfstBuilder1.build());
+        SfcProviderScheduleTypeAPI.putServiceFunctionScheduleType(sfstBuilder2.build());
 
-        executor.submit(SfcProviderScheduleTypeAPI
-                .getPut(parameters1, parameterTypes)).get();
-        executor.submit(SfcProviderScheduleTypeAPI
-                .getPut(parameters2, parameterTypes)).get();
-
-        Object[] parameters = {};
-        Class[] parameterTypes2 = {};
-
-        Object result = executor.submit(SfcProviderScheduleTypeAPI
-                .getReadAll(parameters, parameterTypes2)).get();
-        ServiceFunctionSchedulerTypes sfsts = (ServiceFunctionSchedulerTypes) result;
+        ServiceFunctionSchedulerTypes sfsts = SfcProviderScheduleTypeAPI.readAllServiceFunctionScheduleTypes();
         List<ServiceFunctionSchedulerType> sfstList = sfsts.getServiceFunctionSchedulerType();
         assertEquals("Must be equal", sfstList.size(), 2);
     }
 
     @Test
-    public void testCreateReadEnabledScheduleTypeEntryExecutor() throws ExecutionException, InterruptedException {
+    public void testCreateReadEnabledScheduleTypeEntryExecutor() {
         String name1 = "random-01";
         Class<? extends ServiceFunctionSchedulerTypeIdentity> type1 = Random.class;
         ServiceFunctionSchedulerTypeKey key1 = new ServiceFunctionSchedulerTypeKey(type1);
@@ -166,17 +70,10 @@ public class SfcProviderScheduleTypeAPITest extends AbstractDataStoreManager {
         ServiceFunctionSchedulerTypeBuilder sfstBuilder2 = new ServiceFunctionSchedulerTypeBuilder();
         sfstBuilder2.setName(name2).setType(type2).setKey(key2).setEnabled(false);
 
-        Object[] parameters1 = {sfstBuilder1.build()};
-        Object[] parameters2 = {sfstBuilder2.build()};
-        Class[] parameterTypes = {ServiceFunctionSchedulerType.class};
-
-
-        executor.submit(SfcProviderScheduleTypeAPI
-                .getPut(parameters1, parameterTypes)).get();
-        executor.submit(SfcProviderScheduleTypeAPI
-                .getPut(parameters2, parameterTypes)).get();
+        SfcProviderScheduleTypeAPI.putServiceFunctionScheduleType(sfstBuilder1.build());
+        SfcProviderScheduleTypeAPI.putServiceFunctionScheduleType(sfstBuilder2.build());
 
-        Object result = SfcProviderScheduleTypeAPI.readEnabledServiceFunctionScheduleTypeEntryExecutor();
+        Object result = SfcProviderScheduleTypeAPI.readEnabledServiceFunctionScheduleTypeEntry();
         ServiceFunctionSchedulerType sfst = (ServiceFunctionSchedulerType) result;
 
         assertNotNull("Must be not null", sfst);
@@ -195,18 +92,18 @@ public class SfcProviderScheduleTypeAPITest extends AbstractDataStoreManager {
                 .setType(RoundRobin.class);
 
         //write service function scheduler type
-        boolean transactionSuccessful = SfcProviderScheduleTypeAPI.putServiceFunctionScheduleTypeExecutor(serviceFunctionSchedulerTypeBuilder.build());
+        boolean transactionSuccessful = SfcProviderScheduleTypeAPI.putServiceFunctionScheduleType(serviceFunctionSchedulerTypeBuilder.build());
         assertTrue("Must be true", transactionSuccessful);
 
         //read written service function scheduler type
-        ServiceFunctionSchedulerType serviceFunctionSchedulerType = SfcProviderScheduleTypeAPI.readServiceFunctionScheduleTypeExecutor(RoundRobin.class);
+        ServiceFunctionSchedulerType serviceFunctionSchedulerType = SfcProviderScheduleTypeAPI.readServiceFunctionScheduleType(RoundRobin.class);
         assertNotNull("Must not be null", serviceFunctionSchedulerType);
         assertEquals("Must be equal", serviceFunctionSchedulerType.getName(), "SFST");
         assertEquals("Must be equal", serviceFunctionSchedulerType.getType(), RoundRobin.class);
         assertTrue("Must be equal", serviceFunctionSchedulerType.isEnabled());
 
         //remove service function scheduler type
-        transactionSuccessful = SfcProviderScheduleTypeAPI.deleteServiceFunctionScheduleTypeExecutor(RoundRobin.class);
+        transactionSuccessful = SfcProviderScheduleTypeAPI.deleteServiceFunctionScheduleType(RoundRobin.class);
         assertTrue("Must be true", transactionSuccessful);
     }
 }
index a52120a69ab20218a34557281900dc729621f29f..eb6b59aaac13199b510c21a46c21f70241998e2b 100755 (executable)
@@ -8,6 +8,14 @@
 
 package org.opendaylight.sfc.provider.api;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -31,12 +39,6 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev1407
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfc.rev140701.service.function.chains.state.service.function.chain.state.SfcServicePathKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-import static org.junit.Assert.*;
-
 
 public class SfcProviderServiceChainAPITest extends AbstractDataStoreManager {
     public static final String[] LOCATOR_IP_ADDRESS =
@@ -56,7 +58,7 @@ public class SfcProviderServiceChainAPITest extends AbstractDataStoreManager {
     }
 
     @Test
-    public void testCreateReadServiceFunctionChain() throws ExecutionException, InterruptedException {
+    public void testCreateReadServiceFunctionChain() {
 
         String name = "unittest-chain-1";
         ServiceFunctionChainKey key = new ServiceFunctionChainKey(name);
@@ -78,24 +80,15 @@ public class SfcProviderServiceChainAPITest extends AbstractDataStoreManager {
                 .setSfcServiceFunction(sfcServiceFunctionList)
                 .setSymmetric(false);
 
-        Object[] parameters = {sfcBuilder.build()};
-        Class[] parameterTypes = {ServiceFunctionChain.class};
-
-        executor.submit(SfcProviderServiceChainAPI
-                .getPut(parameters, parameterTypes)).get();
-
-        Object[] parameters2 = {name};
-        Class[] parameterTypes2 = {String.class};
-        Object result = executor.submit(SfcProviderServiceChainAPI
-                .getRead(parameters2, parameterTypes2)).get();
-        ServiceFunctionChain sfc2 = (ServiceFunctionChain) result;
+        SfcProviderServiceChainAPI.putServiceFunctionChain(sfcBuilder.build());
+        ServiceFunctionChain sfc2 = SfcProviderServiceChainAPI.readServiceFunctionChain(name);
 
         assertNotNull("Must be not null", sfc2);
         assertEquals("Must be equal", sfc2.getSfcServiceFunction(), sfcServiceFunctionList);
     }
 
     @Test
-    public void testDeleteServiceFunctionChain() throws ExecutionException, InterruptedException {
+    public void testDeleteServiceFunctionChain() {
 
         String name = "unittest-chain-2";
         ServiceFunctionChainKey key = new ServiceFunctionChainKey(name);
@@ -117,31 +110,17 @@ public class SfcProviderServiceChainAPITest extends AbstractDataStoreManager {
                 .setSfcServiceFunction(sfcServiceFunctionList)
                 .setSymmetric(false);
 
-        Object[] parameters = {sfcBuilder.build()};
-        Class[] parameterTypes = {ServiceFunctionChain.class};
-
-        executor.submit(SfcProviderServiceChainAPI
-                .getPut(parameters, parameterTypes)).get();
-
-        Object[] parameters2 = {name};
-        Class[] parameterTypes2 = {String.class};
-        Object result = executor.submit(SfcProviderServiceChainAPI
-                .getRead(parameters2, parameterTypes2)).get();
-
+        SfcProviderServiceChainAPI.putServiceFunctionChain(sfcBuilder.build());
+        ServiceFunctionChain result = SfcProviderServiceChainAPI.readServiceFunctionChain(name);
         assertNotNull("Must be not null", result);
-        assertTrue("Must be ServiceFunctionChain", result instanceof ServiceFunctionChain);
-
-        executor.submit(SfcProviderServiceChainAPI
-                .getDelete(parameters2, parameterTypes2)).get();
-
-        result = executor.submit(SfcProviderServiceChainAPI
-                .getRead(parameters2, parameterTypes2)).get();
 
+        SfcProviderServiceChainAPI.deleteServiceFunctionChain(name);
+        result = SfcProviderServiceChainAPI.readServiceFunctionChain(name);
         assertNull("Must be null", result);
     }
 
     @Test
-    public void testCreateReadServiceFunctionChains() throws ExecutionException, InterruptedException {
+    public void testCreateReadServiceFunctionChains() {
 
         List<SfcServiceFunction> sfcAllServiceFunctionList = new ArrayList<>();
 
@@ -185,17 +164,10 @@ public class SfcProviderServiceChainAPITest extends AbstractDataStoreManager {
 
         ServiceFunctionChainsBuilder sfcsBuilder = new ServiceFunctionChainsBuilder();
         sfcsBuilder.setServiceFunctionChain(sfcList);
-
-        executor.submit(SfcProviderServiceChainAPI
-                .getPutAll(
-                        new Object[]{sfcsBuilder.build()}, new Class[]{ServiceFunctionChains.class})).get();
+        SfcProviderServiceChainAPI.putAllServiceFunctionChains(sfcsBuilder.build());
 
         final int INDEX_TO_READ = 1;
-        Object[] parameters2 = {sfcName.get(INDEX_TO_READ)};
-        Class[] parameterTypes2 = {String.class};
-        Object result = executor.submit(SfcProviderServiceChainAPI
-                .getRead(parameters2, parameterTypes2)).get();
-        ServiceFunctionChain sfc2 = (ServiceFunctionChain) result;
+        ServiceFunctionChain sfc2 = SfcProviderServiceChainAPI.readServiceFunctionChain(sfcName.get(INDEX_TO_READ));
 
         assertNotNull("Must be not null", sfc2);
         assertEquals("Must be equal", sfc2, sfcArray[INDEX_TO_READ]);
@@ -203,9 +175,6 @@ public class SfcProviderServiceChainAPITest extends AbstractDataStoreManager {
 
     @Test
     public void testReadAllServiceFunctionChains() {
-        Object[] params = {"hello"};
-        SfcProviderServiceChainAPILocal sfcProviderServiceChainAPILocal = new SfcProviderServiceChainAPILocal(params);
-
         ServiceFunctionChainBuilder serviceFunctionChainBuilder = new ServiceFunctionChainBuilder();
         ServiceFunctionChain serviceFunctionChain = serviceFunctionChainBuilder.setName("SFC1").setKey(new ServiceFunctionChainKey("SFC1")).build();
 
@@ -220,7 +189,7 @@ public class SfcProviderServiceChainAPITest extends AbstractDataStoreManager {
 
         SfcDataStoreAPI.writePutTransactionAPI(sfcsIID, serviceFunctionChains, LogicalDatastoreType.CONFIGURATION);
 
-        ServiceFunctionChains returnedSfc = sfcProviderServiceChainAPILocal.readAllServiceFunctionChains();
+        ServiceFunctionChains returnedSfc = SfcProviderServiceChainAPI.readAllServiceFunctionChains();
         assertNotNull("Returned variable is missing.", returnedSfc);
     }
 
@@ -282,7 +251,7 @@ public class SfcProviderServiceChainAPITest extends AbstractDataStoreManager {
         assertTrue("Must be true", transactionSuccessful);
 
         //get service function chains
-        ServiceFunctionChains serviceFunctionChains = SfcProviderServiceChainAPI.getServiceFunctionChainsRefExecutor();
+        ServiceFunctionChains serviceFunctionChains = SfcProviderServiceChainAPI.getServiceFunctionChainsRef();
         assertNotNull("Must not be null", serviceFunctionChains);
         assertEquals("Must be equal", serviceFunctionChains.getServiceFunctionChain().get(0).getName(), "SFC1");
         assertEquals("Must be equal", serviceFunctionChains.getServiceFunctionChain().get(0).getSfcServiceFunction().get(0).getName(), "SFF1");
@@ -328,7 +297,7 @@ public class SfcProviderServiceChainAPITest extends AbstractDataStoreManager {
         assertTrue("Must be true", transactionSuccessful);
 
         //get data
-        ServiceFunctionChainsState serviceFunctionChainsState = SfcProviderServiceChainAPI.getServiceFunctionChainsStateRefExecutor();
+        ServiceFunctionChainsState serviceFunctionChainsState = SfcProviderServiceChainAPI.getServiceFunctionChainsStateRef();
         assertNotNull("Must not be null", serviceFunctionChainsState);
         assertEquals("Must be equal", serviceFunctionChainsState.getServiceFunctionChainState().get(0).getName(), "SFC1");
         assertEquals("Must be equal", serviceFunctionChainsState.getServiceFunctionChainState().get(0).getSfcServicePath().get(0).getName(), "SP1");
@@ -338,10 +307,4 @@ public class SfcProviderServiceChainAPITest extends AbstractDataStoreManager {
         assertTrue("Must be true", transactionSuccessful);
     }
 
-    private class SfcProviderServiceChainAPILocal extends SfcProviderServiceChainAPI {
-
-        SfcProviderServiceChainAPILocal(Object[] params) {
-            super(params, "m");
-        }
-    }
 }
index dbb11f6ec972382256976013d9dc105b8f82e796..31c1997569c0985a0f75b18a80ae325eeba5d67f 100644 (file)
@@ -9,11 +9,9 @@
 package org.opendaylight.sfc.provider.api;
 
 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.assertArrayEquals;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -86,11 +84,11 @@ public class SfcProviderServiceClassifierAPITest extends AbstractDataStoreManage
 
         assertClsfStateDoesNotExist(clsfName);
         assertTrue("Failed to update clsf state.",
-                SfcProviderServiceClassifierAPI.addRenderedPathToServiceClassifierStateExecutor(clsfName, rspName1));
+                SfcProviderServiceClassifierAPI.addRenderedPathToServiceClassifierState(clsfName, rspName1));
         readAndAssertClsfState(clsfName, rspName1);
         // update classifier state with another rendered service path
         assertTrue("Failed to update clsf state.",
-                SfcProviderServiceClassifierAPI.addRenderedPathToServiceClassifierStateExecutor(clsfName, rspName2));
+                SfcProviderServiceClassifierAPI.addRenderedPathToServiceClassifierState(clsfName, rspName2));
         readAndAssertClsfState(clsfName, rspName2);
     }
 
@@ -132,12 +130,12 @@ public class SfcProviderServiceClassifierAPITest extends AbstractDataStoreManage
     }
 
     private static void assertClassifierDoesNotExists(String clsfName) {
-        ServiceFunctionClassifier clsf = SfcProviderServiceClassifierAPI.readServiceClassifierExecutor(clsfName);
+        ServiceFunctionClassifier clsf = SfcProviderServiceClassifierAPI.readServiceClassifier(clsfName);
         assertNull("Unexpected classifier found.", clsf);
     }
 
     private static void readAndAssertClassifier(ServiceFunctionClassifier expectedClsf) {
-        ServiceFunctionClassifier clsf = SfcProviderServiceClassifierAPI.readServiceClassifierExecutor(expectedClsf.getName());
+        ServiceFunctionClassifier clsf = SfcProviderServiceClassifierAPI.readServiceClassifier(expectedClsf.getName());
         assertNotNull("Classifier not found.", clsf);
         assertEquals(expectedClsf.getName(), clsf.getName());
         assertEquals(expectedClsf.getKey().getName(), clsf.getKey().getName());
@@ -145,29 +143,4 @@ public class SfcProviderServiceClassifierAPITest extends AbstractDataStoreManage
         assertEquals(expectedClsf.getSclServiceFunctionForwarder(), clsf.getSclServiceFunctionForwarder());
     }
 
-    @SuppressWarnings("rawtypes")
-    @Test
-    public void getReadTest() throws Exception {
-        Object[] params = {"funcParam0", "funcParam1"};
-        Class[] paramTypes = {String.class, String.class};
-        SfcProviderServiceClassifierAPI api = SfcProviderServiceClassifierAPI.getRead(params, paramTypes);
-        assertApiInitialization(api, params, paramTypes);
-    }
-
-    @SuppressWarnings("rawtypes")
-    @Test
-    public void getAddRenderedPathToServiceClassifierStateExecutorTest() throws Exception {
-        Object[] params = {"funcParam0", "funcParam1"};
-        Class[] paramTypes = {String.class, String.class};
-        SfcProviderServiceClassifierAPI api = SfcProviderServiceClassifierAPI.getAddRenderedPathToServiceClassifierStateExecutor(params, paramTypes);
-        assertApiInitialization(api, params, paramTypes);
-    }
-
-    @SuppressWarnings("rawtypes")
-    private void assertApiInitialization(SfcProviderServiceClassifierAPI api,
-                                         Object[] expectedParams, Class[] expectedParamTypes) {
-        assertArrayEquals(expectedParams, api.getParameters());
-        assertArrayEquals(expectedParamTypes, api.getParameterTypes());
-        assertFalse(api.getMethodName().isEmpty());
-    }
 }
\ No newline at end of file
index 89e2d669e81b8bcf91497321d20527ac14e91f31..c30e95a29d55bc508564aa3f6e4fe328ffc04cb1 100755 (executable)
@@ -8,6 +8,14 @@
 
 package org.opendaylight.sfc.provider.api;
 
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+
+import java.util.ArrayList;
+import java.util.List;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.sfc.provider.AbstractDataStoreManager;
@@ -17,7 +25,12 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev1407
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderKey;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.*;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionary;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryKey;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocator;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocatorBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocatorKey;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocator;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocatorBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.sff.data.plane.locator.DataPlaneLocatorBuilder;
@@ -29,13 +42,6 @@ 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.rev100924.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-import static org.hamcrest.CoreMatchers.hasItem;
-import static org.junit.Assert.*;
-
 /**
  * Tests for dictionary operations on SFFs
  */
@@ -60,7 +66,7 @@ public class SfcProviderServiceForwarderAPIDictionaryTest extends AbstractDataSt
     }
 
     @Test
-    public void testUpdateDictionary() throws ExecutionException, InterruptedException {
+    public void testUpdateDictionary() {
 
         String name = sffName[0];
 
@@ -108,18 +114,8 @@ public class SfcProviderServiceForwarderAPIDictionaryTest extends AbstractDataSt
                         .setServiceNode(null) // for consistency only; we are going to get rid of ServiceNodes in the future
                         .build();
 
-        Object[] parameters = {sff};
-        Class[] parameterTypes = {ServiceFunctionForwarder.class};
-
-        executor.submit(SfcProviderServiceForwarderAPI
-                .getPut(parameters, parameterTypes)).get();
-
-        Object[] parameters2 = {name};
-        Class[] parameterTypes2 = {String.class};
-        Object result = executor.submit(SfcProviderServiceForwarderAPI
-                .getRead(parameters2, parameterTypes2)).get();
-        ServiceFunctionForwarder sff2 = (ServiceFunctionForwarder) result;
-
+        SfcProviderServiceForwarderAPI.putServiceFunctionForwarder(sff);
+        ServiceFunctionForwarder sff2 = SfcProviderServiceForwarderAPI.readServiceFunctionForwarder(name);
         assertNotNull("Must be not null", sff2);
         assertEquals("Must be equal", sff2.getSffDataPlaneLocator(), locatorList);
         assertThat("Must contain first dictionary entry", sff2.getServiceFunctionDictionary(), hasItem(firstDictEntry));
@@ -141,18 +137,8 @@ public class SfcProviderServiceForwarderAPIDictionaryTest extends AbstractDataSt
         sff2.getServiceFunctionDictionary().add(newDictEntry);
         dictionary.add(newDictEntry);
 
-        Object[] parameters3 = {sff};
-        Class[] parameterTypes3 = {ServiceFunctionForwarder.class};
-
-        executor.submit(SfcProviderServiceForwarderAPI
-                .getPut(parameters3, parameterTypes3)).get();
-
-        Object[] parameters4 = {name};
-        Class[] parameterTypes4 = {String.class};
-        Object result4 = executor.submit(SfcProviderServiceForwarderAPI
-                .getRead(parameters4, parameterTypes4)).get();
-        ServiceFunctionForwarder sff4 = (ServiceFunctionForwarder) result4;
-
+        SfcProviderServiceForwarderAPI.putServiceFunctionForwarder(sff);
+        ServiceFunctionForwarder sff4 = SfcProviderServiceForwarderAPI.readServiceFunctionForwarder(name);
         assertNotNull("Must be not null", sff4);
         assertThat("Must contain first dictionary entry", sff4.getServiceFunctionDictionary(), hasItem(firstDictEntry));
         assertThat("Must contain new dictionary entry", sff4.getServiceFunctionDictionary(), hasItem(newDictEntry));
index c1a3054a08b59d204fb46fd826c6d906cd2a72ef..305499c1d9bac145aeaaa93680049c2c5aaadf63 100644 (file)
@@ -8,10 +8,16 @@
 
 package org.opendaylight.sfc.provider.api;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.sfc.provider.AbstractDataStoreManager;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctions;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.entry.SfDataPlaneLocator;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.entry.SfDataPlaneLocatorBuilder;
@@ -28,13 +34,24 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev1407
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderKey;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.*;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ConnectedSffDictionary;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ConnectedSffDictionaryBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionary;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryKey;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocator;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocatorBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocatorKey;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocator;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocatorBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.sff.data.plane.locator.DataPlaneLocatorBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev140701.service.function.paths.ServiceFunctionPath;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev140701.service.function.paths.ServiceFunctionPathBuilder;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.*;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Dpi;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Firewall;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.HttpHeaderEnrichment;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Napt44;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Qos;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.VxlanGpe;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.data.plane.locator.locator.type.IpBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
@@ -44,12 +61,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-import static org.junit.Assert.*;
-
 /**
  * Tests for simple data store operations on SFFs (i.e. Service Functions are created first)
  */
@@ -67,7 +78,6 @@ public class SfcProviderServiceForwarderAPISimpleIPv6GTest extends AbstractDataS
     private static final String[] SF_ABSTRACT_NAMES = {"firewall", "dpi", "napt", "http-header-enrichment", "qos"};
     private static final String SFC_NAME = "unittest-chain-1";
     private static final String SFP_NAME = "unittest-sfp-1";
-    private static final String RSP_NAME = "unittest-rsp-1";
     private static final Logger LOG = LoggerFactory.getLogger(SfcProviderServiceChainAPITest.class);
     private static final String[] sfNames = {"unittest-fw-1", "unittest-dpi-1", "unittest-napt-1", "unittest-http-header-enrichment-1", "unittest-qos-1"};
     private final String[] SFF_NAMES = {"SFF1", "SFF2", "SFF3", "SFF4", "SFF5"};
@@ -79,7 +89,7 @@ public class SfcProviderServiceForwarderAPISimpleIPv6GTest extends AbstractDataS
     private List<ServiceFunction> sfList = new ArrayList<>();
 
     @Before
-    public void before() throws ExecutionException, InterruptedException {
+    public void before() {
         setOdlSfc();
 
         // Create Service Functions
@@ -112,12 +122,11 @@ public class SfcProviderServiceForwarderAPISimpleIPv6GTest extends AbstractDataS
         ServiceFunctionsBuilder sfsBuilder = new ServiceFunctionsBuilder();
         sfsBuilder.setServiceFunction(sfList);
 
-        executor.submit(SfcProviderServiceFunctionAPI.getPutAll(new Object[]{sfsBuilder.build()}, new Class[]{ServiceFunctions.class})).get();
-        Thread.sleep(1000); // Wait they are really created
+        SfcProviderServiceFunctionAPI.putAllServiceFunctions(sfsBuilder.build());
 
         // Create ServiceFunctionTypeEntry for all ServiceFunctions
         for (ServiceFunction serviceFunction : sfList) {
-            boolean ret = SfcProviderServiceTypeAPI.createServiceFunctionTypeEntryExecutor(serviceFunction);
+            boolean ret = SfcProviderServiceTypeAPI.createServiceFunctionTypeEntry(serviceFunction);
             LOG.debug("call createServiceFunctionTypeEntryExecutor for {}", serviceFunction.getName());
             assertTrue("Must be true", ret);
         }
@@ -166,7 +175,7 @@ public class SfcProviderServiceForwarderAPISimpleIPv6GTest extends AbstractDataS
                     .setConnectedSffDictionary(sffDictionaryList)
                     .setServiceNode(null);
             ServiceFunctionForwarder sff = sffBuilder.build();
-            executor.submit(SfcProviderServiceForwarderAPI.getPut(new Object[]{sff}, new Class[]{ServiceFunctionForwarder.class})).get();
+            SfcProviderServiceForwarderAPI.putServiceFunctionForwarder(sff);
         }
 
         //Create Service Function Chain
@@ -187,19 +196,10 @@ public class SfcProviderServiceForwarderAPISimpleIPv6GTest extends AbstractDataS
                 .setSfcServiceFunction(sfcServiceFunctionList)
                 .setSymmetric(true);
 
-        Object[] parameters = {sfcBuilder.build()};
-        Class[] parameterTypes = {ServiceFunctionChain.class};
-
-        executor.submit(SfcProviderServiceChainAPI
-                .getPut(parameters, parameterTypes)).get();
-        Thread.sleep(1000); // Wait SFC is really crated
+        SfcProviderServiceChainAPI.putServiceFunctionChain(sfcBuilder.build());
 
         //Check if Service Function Chain was created
-        Object[] parameters2 = {SFC_NAME};
-        Class[] parameterTypes2 = {String.class};
-        Object result = executor.submit(SfcProviderServiceChainAPI
-                .getRead(parameters2, parameterTypes2)).get();
-        ServiceFunctionChain sfc2 = (ServiceFunctionChain) result;
+        ServiceFunctionChain sfc2 = SfcProviderServiceChainAPI.readServiceFunctionChain(SFC_NAME);
 
         assertNotNull("Must be not null", sfc2);
         assertEquals("Must be equal", sfc2.getSfcServiceFunction(), sfcServiceFunctionList);
@@ -211,14 +211,13 @@ public class SfcProviderServiceForwarderAPISimpleIPv6GTest extends AbstractDataS
                 .setSymmetric(true);
         ServiceFunctionPath serviceFunctionPath = pathBuilder.build();
         assertNotNull("Must be not null", serviceFunctionPath);
-        boolean ret = SfcProviderServicePathAPI.putServiceFunctionPathExecutor(serviceFunctionPath);
+        boolean ret = SfcProviderServicePathAPI.putServiceFunctionPath(serviceFunctionPath);
         assertTrue("Must be true", ret);
 
-        Thread.sleep(1000); // Wait they are really created
     }
 
     @Test
-    public void testCreateReadUpdateServiceFunctionForwarder() throws ExecutionException, InterruptedException {
+    public void testCreateReadUpdateServiceFunctionForwarder() {
 
         String name = sffName[0];
 
@@ -266,17 +265,8 @@ public class SfcProviderServiceForwarderAPISimpleIPv6GTest extends AbstractDataS
                         .setServiceNode(null) // for consistency only; we are going to get rid of ServiceNodes in the future
                         .build();
 
-        Object[] parameters = {sff};
-        Class[] parameterTypes = {ServiceFunctionForwarder.class};
-
-        executor.submit(SfcProviderServiceForwarderAPI
-                .getPut(parameters, parameterTypes)).get();
-
-        Object[] parameters2 = {name};
-        Class[] parameterTypes2 = {String.class};
-        Object result = executor.submit(SfcProviderServiceForwarderAPI
-                .getRead(parameters2, parameterTypes2)).get();
-        ServiceFunctionForwarder sff2 = (ServiceFunctionForwarder) result;
+        SfcProviderServiceForwarderAPI.putServiceFunctionForwarder(sff);
+        ServiceFunctionForwarder sff2 = SfcProviderServiceForwarderAPI.readServiceFunctionForwarder(name);
 
         assertNotNull("Must be not null", sff2);
         assertEquals("Must be equal", sff2.getSffDataPlaneLocator(), locatorList);
index 2905c6741e20d8fa1dd8023d60af919ad624b526..a6c2c5645d2b417df190a8405d7eef084cbc2cb1 100644 (file)
@@ -8,10 +8,16 @@
 
 package org.opendaylight.sfc.provider.api;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.sfc.provider.AbstractDataStoreManager;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctions;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.entry.SfDataPlaneLocator;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.entry.SfDataPlaneLocatorBuilder;
@@ -28,13 +34,24 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev1407
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderKey;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.*;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ConnectedSffDictionary;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ConnectedSffDictionaryBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionary;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryKey;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocator;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocatorBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocatorKey;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocator;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocatorBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.sff.data.plane.locator.DataPlaneLocatorBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev140701.service.function.paths.ServiceFunctionPath;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev140701.service.function.paths.ServiceFunctionPathBuilder;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.*;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Dpi;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Firewall;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.HttpHeaderEnrichment;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Napt44;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sft.rev140701.Qos;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.VxlanGpe;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.data.plane.locator.locator.type.IpBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
@@ -44,12 +61,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-import static org.junit.Assert.*;
-
 /**
  * Tests for simple datastore operations on SFFs (i.e. Service Functions are created first)
  */
@@ -67,7 +78,6 @@ public class SfcProviderServiceForwarderAPISimpleIPv6Test extends AbstractDataSt
     private static final String[] SF_ABSTRACT_NAMES = {"firewall", "dpi", "napt", "http-header-enrichment", "qos"};
     private static final String SFC_NAME = "unittest-chain-1";
     private static final String SFP_NAME = "unittest-sfp-1";
-    private static final String RSP_NAME = "unittest-rsp-1";
     private static final Logger LOG = LoggerFactory.getLogger(SfcProviderServiceChainAPITest.class);
     private static final String[] sfNames = {"unittest-fw-1", "unittest-dpi-1", "unittest-napt-1", "unittest-http-header-enrichment-1", "unittest-qos-1"};
     private final String[] SFF_NAMES = {"SFF1", "SFF2", "SFF3", "SFF4", "SFF5"};
@@ -79,7 +89,7 @@ public class SfcProviderServiceForwarderAPISimpleIPv6Test extends AbstractDataSt
     private List<ServiceFunction> sfList = new ArrayList<>();
 
     @Before
-    public void before() throws ExecutionException, InterruptedException {
+    public void before() {
         setOdlSfc();
 
         // Create Service Functions
@@ -112,12 +122,11 @@ public class SfcProviderServiceForwarderAPISimpleIPv6Test extends AbstractDataSt
         ServiceFunctionsBuilder sfsBuilder = new ServiceFunctionsBuilder();
         sfsBuilder.setServiceFunction(sfList);
 
-        executor.submit(SfcProviderServiceFunctionAPI.getPutAll(new Object[]{sfsBuilder.build()}, new Class[]{ServiceFunctions.class})).get();
-        Thread.sleep(1000); // Wait they are really created
+        SfcProviderServiceFunctionAPI.putAllServiceFunctions(sfsBuilder.build());
 
         // Create ServiceFunctionTypeEntry for all ServiceFunctions
         for (ServiceFunction serviceFunction : sfList) {
-            boolean ret = SfcProviderServiceTypeAPI.createServiceFunctionTypeEntryExecutor(serviceFunction);
+            boolean ret = SfcProviderServiceTypeAPI.createServiceFunctionTypeEntry(serviceFunction);
             LOG.debug("call createServiceFunctionTypeEntryExecutor for {}", serviceFunction.getName());
             assertTrue("Must be true", ret);
         }
@@ -166,7 +175,7 @@ public class SfcProviderServiceForwarderAPISimpleIPv6Test extends AbstractDataSt
                     .setConnectedSffDictionary(sffDictionaryList)
                     .setServiceNode(null);
             ServiceFunctionForwarder sff = sffBuilder.build();
-            executor.submit(SfcProviderServiceForwarderAPI.getPut(new Object[]{sff}, new Class[]{ServiceFunctionForwarder.class})).get();
+            SfcProviderServiceForwarderAPI.putServiceFunctionForwarder(sff);
         }
 
         //Create Service Function Chain
@@ -187,19 +196,10 @@ public class SfcProviderServiceForwarderAPISimpleIPv6Test extends AbstractDataSt
                 .setSfcServiceFunction(sfcServiceFunctionList)
                 .setSymmetric(true);
 
-        Object[] parameters = {sfcBuilder.build()};
-        Class[] parameterTypes = {ServiceFunctionChain.class};
-
-        executor.submit(SfcProviderServiceChainAPI
-                .getPut(parameters, parameterTypes)).get();
-        Thread.sleep(1000); // Wait SFC is really crated
+        SfcProviderServiceChainAPI.putServiceFunctionChain(sfcBuilder.build());
 
         //Check if Service Function Chain was created
-        Object[] parameters2 = {SFC_NAME};
-        Class[] parameterTypes2 = {String.class};
-        Object result = executor.submit(SfcProviderServiceChainAPI
-                .getRead(parameters2, parameterTypes2)).get();
-        ServiceFunctionChain sfc2 = (ServiceFunctionChain) result;
+        ServiceFunctionChain sfc2 = SfcProviderServiceChainAPI.readServiceFunctionChain(SFC_NAME);
 
         assertNotNull("Must be not null", sfc2);
         assertEquals("Must be equal", sfc2.getSfcServiceFunction(), sfcServiceFunctionList);
@@ -211,14 +211,12 @@ public class SfcProviderServiceForwarderAPISimpleIPv6Test extends AbstractDataSt
                 .setSymmetric(true);
         ServiceFunctionPath serviceFunctionPath = pathBuilder.build();
         assertNotNull("Must be not null", serviceFunctionPath);
-        boolean ret = SfcProviderServicePathAPI.putServiceFunctionPathExecutor(serviceFunctionPath);
+        boolean ret = SfcProviderServicePathAPI.putServiceFunctionPath(serviceFunctionPath);
         assertTrue("Must be true", ret);
-
-        Thread.sleep(1000); // Wait they are really created
     }
 
     @Test
-    public void testCreateReadUpdateServiceFunctionForwarder() throws ExecutionException, InterruptedException {
+    public void testCreateReadUpdateServiceFunctionForwarder() {
 
         String name = sffName[0];
 
@@ -266,18 +264,8 @@ public class SfcProviderServiceForwarderAPISimpleIPv6Test extends AbstractDataSt
                         .setServiceNode(null) // for consistency only; we are going to get rid of ServiceNodes in the future
                         .build();
 
-        Object[] parameters = {sff};
-        Class[] parameterTypes = {ServiceFunctionForwarder.class};
-
-        executor.submit(SfcProviderServiceForwarderAPI
-                .getPut(parameters, parameterTypes)).get();
-
-        Object[] parameters2 = {name};
-        Class[] parameterTypes2 = {String.class};
-        Object result = executor.submit(SfcProviderServiceForwarderAPI
-                .getRead(parameters2, parameterTypes2)).get();
-        ServiceFunctionForwarder sff2 = (ServiceFunctionForwarder) result;
-
+        SfcProviderServiceForwarderAPI.putServiceFunctionForwarder(sff);
+        ServiceFunctionForwarder sff2 = SfcProviderServiceForwarderAPI.readServiceFunctionForwarder(name);
         assertNotNull("Must be not null", sff2);
         assertEquals("Must be equal", sff2.getSffDataPlaneLocator(), locatorList);
         assertEquals("Must be equal", sff2.getServiceFunctionDictionary(), dictionary);
index fb21474623b01833f86c249f5a38cedc8a940531..f264e14c6e55a306a0a134b8eb9e819e825bd3e6 100755 (executable)
@@ -8,6 +8,15 @@
 
 package org.opendaylight.sfc.provider.api;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -31,7 +40,12 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev1407
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderKey;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.*;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionary;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryKey;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocator;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocatorBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocatorKey;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocator;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocatorBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.sff.data.plane.locator.DataPlaneLocatorBuilder;
@@ -45,24 +59,16 @@ 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.rev100924.PortNumber;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-import static org.junit.Assert.*;
-
 /**
  * Tests for simple datastore operations on SFFs (i.e. Service Functions are created first)
  */
 public class SfcProviderServiceForwarderAPISimpleTest extends AbstractDataStoreManager {
-    private final Object[] params = {"hello"};
     private final ServiceFunctionForwarderBuilder sffBuilder = new ServiceFunctionForwarderBuilder();
     private final RenderedServicePathHopBuilder renderedServicePathHopBuilder = new RenderedServicePathHopBuilder();
     private final RenderedServicePathHop renderedServicePathHop = renderedServicePathHopBuilder.setKey(new RenderedServicePathHopKey((short) 3))
             .setServiceFunctionForwarder("SFF1").build();
-    SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = new SfcProviderServiceForwarderAPILocal(params);
+    SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = new SfcProviderServiceForwarderAPI();
     ServiceFunctionForwarder sff;
-    private ServiceFunctionPathBuilder pathBuilder = new ServiceFunctionPathBuilder();
 
     @Before
     public void before() {
@@ -103,7 +109,7 @@ public class SfcProviderServiceForwarderAPISimpleTest extends AbstractDataStoreM
     }
 
     @Test
-    public void testCreateReadUpdateServiceFunctionForwarder() throws ExecutionException, InterruptedException {
+    public void testCreateReadUpdateServiceFunctionForwarder() {
         String name = "SFF1";
         String[] sfNames = {"unittest-fw-1", "unittest-dpi-1", "unittest-napt-1", "unittest-http-header-enrichment-1", "unittest-qos-1"};
         IpAddress[] ipMgmtAddress = new IpAddress[sfNames.length];
@@ -166,17 +172,9 @@ public class SfcProviderServiceForwarderAPISimpleTest extends AbstractDataStoreM
                         .setServiceNode(null) // for consistency only; we are going to get rid of ServiceNodes in the future
                         .build();
 
-        Object[] parameters = {sff};
-        Class[] parameterTypes = {ServiceFunctionForwarder.class};
-
-        executor.submit(SfcProviderServiceForwarderAPI
-                .getPut(parameters, parameterTypes)).get();
+        SfcProviderServiceForwarderAPI.putServiceFunctionForwarder(sff);
 
-        Object[] parameters2 = {name};
-        Class[] parameterTypes2 = {String.class};
-        Object result = executor.submit(SfcProviderServiceForwarderAPI
-                .getRead(parameters2, parameterTypes2)).get();
-        ServiceFunctionForwarder sff2 = (ServiceFunctionForwarder) result;
+        ServiceFunctionForwarder sff2 = SfcProviderServiceForwarderAPI.readServiceFunctionForwarder(name);
 
         assertNotNull("Must be not null", sff2);
         assertEquals("Must be equal", sff2.getSffDataPlaneLocator(), locatorList);
@@ -200,7 +198,7 @@ public class SfcProviderServiceForwarderAPISimpleTest extends AbstractDataStoreM
         serviceFunctionForwarderBuilder.setName(sff)
                 .setKey(new ServiceFunctionForwarderKey(sff));
 
-        boolean transactionSuccessful = SfcProviderServiceForwarderAPI.putServiceFunctionForwarderExecutor(serviceFunctionForwarderBuilder.build());
+        boolean transactionSuccessful = SfcProviderServiceForwarderAPI.putServiceFunctionForwarder(serviceFunctionForwarderBuilder.build());
         assertTrue("Must be true", transactionSuccessful);
 
         //create list of path for testing purposes
@@ -211,45 +209,45 @@ public class SfcProviderServiceForwarderAPISimpleTest extends AbstractDataStoreM
         sffServicePathTestList.add(createRenderedServicePath(rsp + 4, sff, (short) 4));
 
         //add two paths to service function forwarder state via rsp objects
-        transactionSuccessful = SfcProviderServiceForwarderAPI.addPathToServiceForwarderStateExecutor(sffServicePathTestList.get(0));
+        transactionSuccessful = SfcProviderServiceForwarderAPI.addPathToServiceForwarderState(sffServicePathTestList.get(0));
         assertTrue("Must be true", transactionSuccessful);
-        transactionSuccessful = SfcProviderServiceForwarderAPI.addPathToServiceForwarderStateExecutor(sffServicePathTestList.get(1));
+        transactionSuccessful = SfcProviderServiceForwarderAPI.addPathToServiceForwarderState(sffServicePathTestList.get(1));
         assertTrue("Must be true", transactionSuccessful);
 
         //add another two paths to service function forwarder state via rsp name
-        transactionSuccessful = SfcProviderServiceForwarderAPI.addPathToServiceForwarderStateExecutor(sffServicePathTestList.get(2).getName());
+        transactionSuccessful = SfcProviderServiceForwarderAPI.addPathToServiceForwarderState(sffServicePathTestList.get(2).getName());
         assertTrue("Must be true", transactionSuccessful);
-        transactionSuccessful = SfcProviderServiceForwarderAPI.addPathToServiceForwarderStateExecutor(sffServicePathTestList.get(3).getName());
+        transactionSuccessful = SfcProviderServiceForwarderAPI.addPathToServiceForwarderState(sffServicePathTestList.get(3).getName());
         assertTrue("Must be true", transactionSuccessful);
 
         //read service function forwarder state from data store, it should return list of all four paths
-        List<SffServicePath> sffServicePaths = SfcProviderServiceForwarderAPI.readSffStateExecutor(sff);
+        List<SffServicePath> sffServicePaths = SfcProviderServiceForwarderAPI.readSffState(sff);
         assertNotNull("Must be not null", sffServicePaths);
         assertEquals("Must be equal", sffServicePaths.size(), 4);
 
         //remove path 1 via service path object
         ServiceFunctionPathBuilder serviceFunctionPathBuilder = new ServiceFunctionPathBuilder();
         serviceFunctionPathBuilder.setName("rsp1");
-        transactionSuccessful = SfcProviderServiceForwarderAPI.deletePathFromServiceForwarderStateExecutor(serviceFunctionPathBuilder.build());
+        transactionSuccessful = SfcProviderServiceForwarderAPI.deletePathFromServiceForwarderState(serviceFunctionPathBuilder.build());
         assertTrue("Must be true", transactionSuccessful);
 
         //remove path 2 via rendered service path name
-        transactionSuccessful = SfcProviderServiceForwarderAPI.deletePathFromServiceForwarderStateExecutor("rsp2");
+        transactionSuccessful = SfcProviderServiceForwarderAPI.deletePathFromServiceForwarderState("rsp2");
         assertTrue("Must be true", transactionSuccessful);
 
         //remove paths 3 & 4 via list of rendered service path names
         List<String> rspNames = new ArrayList<>();
         rspNames.add("rsp3");
         rspNames.add("rsp4");
-        transactionSuccessful = SfcProviderServiceForwarderAPI.deletePathFromServiceForwarderStateExecutor(rspNames);
+        transactionSuccessful = SfcProviderServiceForwarderAPI.deletePathFromServiceForwarderState(rspNames);
         assertTrue("Must be true", transactionSuccessful);
 
         //read service function forwarder state from data store, paths are removed, should return null
-        sffServicePaths = SfcProviderServiceForwarderAPI.readSffStateExecutor(sff);
+        sffServicePaths = SfcProviderServiceForwarderAPI.readSffState(sff);
         assertNull("Must be null", sffServicePaths);
 
         //remove written forwarder
-        transactionSuccessful = SfcProviderServiceForwarderAPI.deleteServiceFunctionForwarderExecutor(sff);
+        transactionSuccessful = SfcProviderServiceForwarderAPI.deleteServiceFunctionForwarder(sff);
         assertTrue("Must be true", transactionSuccessful);
     }
 
@@ -260,7 +258,7 @@ public class SfcProviderServiceForwarderAPISimpleTest extends AbstractDataStoreM
         sffBuilder.setName("SFF1")
                 .setKey(new ServiceFunctionForwarderKey("SFF1"));
         ServiceFunctionForwarder sff = sffBuilder.build();
-        assertTrue(SfcProviderServiceForwarderAPI.updateServiceFunctionForwarderExecutor(sff));
+        assertTrue(SfcProviderServiceForwarderAPI.updateServiceFunctionForwarder(sff));
     }
 
     /*
@@ -278,11 +276,11 @@ public class SfcProviderServiceForwarderAPISimpleTest extends AbstractDataStoreM
                 .setKey(new ServiceFunctionForwarderKey(sffName));
         ServiceFunctionForwarder serviceFunctionForwarder = serviceFunctionForwarderBuilder.build();
 
-        boolean transactionSuccessful = SfcProviderServiceForwarderAPI.putServiceFunctionForwarderExecutor(serviceFunctionForwarder);
+        boolean transactionSuccessful = SfcProviderServiceForwarderAPI.putServiceFunctionForwarder(serviceFunctionForwarder);
         assertTrue("Must be true", transactionSuccessful);
 
         //create rendered service path and add it to service function forwarder state
-        transactionSuccessful = SfcProviderServiceForwarderAPI.addPathToServiceForwarderStateExecutor(createRenderedServicePath(sffPath, sffName, (short) 1));
+        transactionSuccessful = SfcProviderServiceForwarderAPI.addPathToServiceForwarderState(createRenderedServicePath(sffPath, sffName, (short) 1));
         assertTrue("Must be true", transactionSuccessful);
 
         //check if rendered service path exists
@@ -304,7 +302,7 @@ public class SfcProviderServiceForwarderAPISimpleTest extends AbstractDataStoreM
         sffBuilder.setName("SFF1")
                 .setKey(new ServiceFunctionForwarderKey("SFF1"));
         ServiceFunctionForwarder sff = sffBuilder.build();
-        assertTrue(SfcProviderServiceForwarderAPI.putServiceFunctionForwarderExecutor(sff));
+        assertTrue(SfcProviderServiceForwarderAPI.putServiceFunctionForwarder(sff));
     }
 
     @Test
@@ -323,9 +321,7 @@ public class SfcProviderServiceForwarderAPISimpleTest extends AbstractDataStoreM
 
         SfcDataStoreAPI.writePutTransactionAPI(sffDataPlaneLocatorIID, sffDataPlaneLocator, LogicalDatastoreType.CONFIGURATION);
 
-        Object[] params = {"hello"};
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = new SfcProviderServiceForwarderAPILocal(params);
-
+        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = new SfcProviderServiceForwarderAPI();
         assertTrue(sfcProviderServiceForwarderAPI.deleteSffDataPlaneLocator("SFF1", "SFFLoc1"));
     }
 
@@ -345,20 +341,18 @@ public class SfcProviderServiceForwarderAPISimpleTest extends AbstractDataStoreM
 
         SfcDataStoreAPI.writePutTransactionAPI(sffDataPlaneLocatorIID, sffDataPlaneLocator, LogicalDatastoreType.CONFIGURATION);
 
-        assertTrue(SfcProviderServiceForwarderAPI.deleteSffDataPlaneLocatorExecutor("SFF1", "SFFLoc1"));
+        assertTrue(SfcProviderServiceForwarderAPI.deleteSffDataPlaneLocator("SFF1", "SFFLoc1"));
     }
 
     @Test
     public void testDeleteServiceFunctionForwarder() {
-        Object[] params = {"hello"};
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = new SfcProviderServiceForwarderAPILocal(params);
-
+        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = new SfcProviderServiceForwarderAPI();
         assertTrue(sfcProviderServiceForwarderAPI.deleteServiceFunctionForwarder("SFF1"));
     }
 
     @Test
     public void testDeleteServiceFunctionForwarderExecutor() {
-        assertTrue(SfcProviderServiceForwarderAPI.deleteServiceFunctionForwarderExecutor("SFF1"));
+        assertTrue(SfcProviderServiceForwarderAPI.deleteServiceFunctionForwarder("SFF1"));
     }
 
     @Test
@@ -375,9 +369,7 @@ public class SfcProviderServiceForwarderAPISimpleTest extends AbstractDataStoreM
         serviceFunctionForwardersBuilder.setServiceFunctionForwarder(serviceFunctionForwarderList);
         ServiceFunctionForwarders sffs = serviceFunctionForwardersBuilder.build();
 
-        Object[] params = {"hello"};
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = new SfcProviderServiceForwarderAPILocal(params);
-
+        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = new SfcProviderServiceForwarderAPI();
         assertTrue(sfcProviderServiceForwarderAPI.putAllServiceFunctionForwarders(sffs));
     }
 
@@ -413,8 +405,7 @@ public class SfcProviderServiceForwarderAPISimpleTest extends AbstractDataStoreM
 
         SfcDataStoreAPI.writePutTransactionAPI(sffIID, serviceFunctionDictionary, LogicalDatastoreType.CONFIGURATION);
 
-        Object[] params = {"hello"};
-        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = new SfcProviderServiceForwarderAPILocal(params);
+        SfcProviderServiceForwarderAPI sfcProviderServiceForwarderAPI = new SfcProviderServiceForwarderAPI();
         assertTrue(sfcProviderServiceForwarderAPI.deleteServiceFunctionFromForwarder(serviceFunction));
     }
 
@@ -450,10 +441,4 @@ public class SfcProviderServiceForwarderAPISimpleTest extends AbstractDataStoreM
         return renderedServicePathBuilder.build();
     }
 
-    private class SfcProviderServiceForwarderAPILocal extends SfcProviderServiceForwarderAPI {
-
-        SfcProviderServiceForwarderAPILocal(Object[] params) {
-            super(params, "m");
-        }
-    }
 }
index 7d09778f651bc076d83eb38371a179111a788e7a..f8650b4f91f9828c75f5a19cb788846198fbe3fa 100755 (executable)
@@ -70,7 +70,7 @@ public class SfcProviderServiceFunctionAPITest extends AbstractDataStoreManager
     }
 
     @Test
-    public void testCreateReadServiceFunction() throws ExecutionException, InterruptedException {
+    public void testCreateReadServiceFunction() {
 
         String name = "unittest-fw-1";
         Class<? extends ServiceFunctionTypeIdentity> type = Firewall.class;
@@ -94,17 +94,8 @@ public class SfcProviderServiceFunctionAPITest extends AbstractDataStoreManager
                 .setIpMgmtAddress(ipMgmtAddress)
                 .setSfDataPlaneLocator(dataPlaneLocatorList);
 
-        Object[] parameters = {sfBuilder.build()};
-        Class[] parameterTypes = {ServiceFunction.class};
-
-        executor.submit(SfcProviderServiceFunctionAPI
-                .getPut(parameters, parameterTypes)).get();
-
-        Object[] parameters2 = {name};
-        Class[] parameterTypes2 = {String.class};
-        Object result = executor.submit(SfcProviderServiceFunctionAPI
-                .getRead(parameters2, parameterTypes2)).get();
-        ServiceFunction sf2 = (ServiceFunction) result;
+        SfcProviderServiceFunctionAPI.putServiceFunction(sfBuilder.build());
+        ServiceFunction sf2 = SfcProviderServiceFunctionAPI.readServiceFunction(name);
 
         assertNotNull("Must be not null", sf2);
         assertEquals("Must be equal", sf2.getIpMgmtAddress(), ipMgmtAddress);
@@ -113,7 +104,7 @@ public class SfcProviderServiceFunctionAPITest extends AbstractDataStoreManager
     }
 
     @Test
-    public void testDeleteServiceFunction() throws ExecutionException, InterruptedException {
+    public void testDeleteServiceFunction() {
 
         String name = "unittest-fw-1";
         Class<? extends ServiceFunctionTypeIdentity> type = Firewall.class;
@@ -137,26 +128,11 @@ public class SfcProviderServiceFunctionAPITest extends AbstractDataStoreManager
                 .setIpMgmtAddress(ipMgmtAddress)
                 .setSfDataPlaneLocator(dataPlaneLocatorList);
 
-        Object[] parameters = {sfBuilder.build()};
-        Class[] parameterTypes = {ServiceFunction.class};
-
-        executor.submit(SfcProviderServiceFunctionAPI
-                .getPut(parameters, parameterTypes)).get();
-
-        Object[] parameters2 = {name};
-        Class[] parameterTypes2 = {String.class};
-        Object result = executor.submit(SfcProviderServiceFunctionAPI
-                .getRead(parameters2, parameterTypes2)).get();
+        SfcProviderServiceFunctionAPI.putServiceFunction(sfBuilder.build());
+        assertNotNull("Must be not null", SfcProviderServiceFunctionAPI.readServiceFunction(name));
 
-        assertNotNull("Must be not null", result);
-        assertTrue("Must be ServiceFunction", result instanceof ServiceFunction);
-
-        executor.submit(SfcProviderServiceFunctionAPI
-                .getDelete(parameters2, parameterTypes2)).get();
-        result = executor.submit(SfcProviderServiceFunctionAPI
-                .getRead(parameters2, parameterTypes2)).get();
-
-        assertNull("Must be null", result);
+        SfcProviderServiceFunctionAPI.deleteServiceFunction(name);
+        assertNull("Must be null", SfcProviderServiceFunctionAPI.readServiceFunction(name));
     }
 
     @Test
@@ -201,15 +177,8 @@ public class SfcProviderServiceFunctionAPITest extends AbstractDataStoreManager
         ServiceFunctionsBuilder sfsBuilder = new ServiceFunctionsBuilder();
         sfsBuilder.setServiceFunction(list);
 
-        executor.submit(SfcProviderServiceFunctionAPI.getPutAll
-                (new Object[]{sfsBuilder.build()}, new Class[]{ServiceFunctions.class})).get();
-
-
-        Object[] parameters2 = {sfName[1]};
-        Class[] parameterTypes2 = {String.class};
-        Object result = executor.submit(SfcProviderServiceFunctionAPI
-                .getRead(parameters2, parameterTypes2)).get();
-        ServiceFunction sf2 = (ServiceFunction) result;
+        SfcProviderServiceFunctionAPI.putAllServiceFunctions(sfsBuilder.build());
+        ServiceFunction sf2 = SfcProviderServiceFunctionAPI.readServiceFunction(sfName[1]);
 
         assertNotNull("Must be not null", sf2);
         assertEquals("Must be equal", sf2.getIpMgmtAddress(), ipMgmtAddress[1]);
@@ -232,7 +201,7 @@ public class SfcProviderServiceFunctionAPITest extends AbstractDataStoreManager
         assertTrue("Must be true", transactionSuccessful);
 
         //read service function with its name and return it
-        ServiceFunction serviceFunction = SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(SF_NAME);
+        ServiceFunction serviceFunction = SfcProviderServiceFunctionAPI.readServiceFunction(SF_NAME);
 
         assertNotNull("Must be not null", serviceFunction);
         assertEquals("Must be equal", serviceFunction.getIpMgmtAddress().getIpv4Address().getValue(), IP_MGMT_ADDRESS[1]);
@@ -257,14 +226,14 @@ public class SfcProviderServiceFunctionAPITest extends AbstractDataStoreManager
 
         //read service function state with its name
         //list of SfServicePath will be returned
-        List<SfServicePath> sfServicePathList = SfcProviderServiceFunctionAPI.readServiceFunctionStateExecutor(SF_STATE_NAME);
+        List<SfServicePath> sfServicePathList = SfcProviderServiceFunctionAPI.readServiceFunctionState(SF_STATE_NAME);
 
         assertNotNull("Must not be null", sfServicePathList);
         assertEquals("Must be equal", sfServicePathList.get(0).getName(), SF_SERVICE_PATH);
 
         //read service function state with its name
         //list of Strings representing paths will be returned
-        List<String> rspList = SfcProviderServiceFunctionAPI.readServiceFunctionStateAsStringListExecutor(SF_STATE_NAME);
+        List<String> rspList = SfcProviderServiceFunctionAPI.readServiceFunctionStateAsStringList(SF_STATE_NAME);
 
         assertNotNull("Must not be null", rspList);
         assertEquals("Must be equal", rspList.get(0), SF_SERVICE_PATH);
@@ -288,7 +257,7 @@ public class SfcProviderServiceFunctionAPITest extends AbstractDataStoreManager
         assertTrue("Must be true", transactionSuccessful);
 
         //read all service functions from data store
-        ServiceFunctions serviceFunctionsResult = SfcProviderServiceFunctionAPI.readAllServiceFunctionsExecutor();
+        ServiceFunctions serviceFunctionsResult = SfcProviderServiceFunctionAPI.readAllServiceFunctions();
 
         assertNotNull("Must not be null", serviceFunctionsResult);
         assertEquals("Must be equal", serviceFunctionsResult.getServiceFunction().get(0).getName(), SF_NAME);
@@ -319,7 +288,7 @@ public class SfcProviderServiceFunctionAPITest extends AbstractDataStoreManager
         assertTrue("Must be true", transactionSuccessful);
 
         //add this path to service function, a name of service path is used
-        boolean result = SfcProviderServiceFunctionAPI.addPathToServiceFunctionStateExecutor(RSP_NAME + 1);
+        boolean result = SfcProviderServiceFunctionAPI.addPathToServiceFunctionState(RSP_NAME + 1);
 
         assertTrue("Must be true", result);
 
@@ -327,7 +296,7 @@ public class SfcProviderServiceFunctionAPITest extends AbstractDataStoreManager
         RenderedServicePath renderedServicePath = (RenderedServicePath) writeReturnPath(RSP_NAME + 2, SF_NAME + 2, false);
 
         //add this path to service function, an object of service path is used
-        result = SfcProviderServiceFunctionAPI.addPathToServiceFunctionStateExecutor(renderedServicePath);
+        result = SfcProviderServiceFunctionAPI.addPathToServiceFunctionState(renderedServicePath);
 
         assertTrue("Must be true", result);
 
@@ -336,11 +305,11 @@ public class SfcProviderServiceFunctionAPITest extends AbstractDataStoreManager
         serviceFunctionPathBuilder.setName(RSP_NAME + 1);
 
         //delete both paths; first through created path object, second through path name
-        result = SfcProviderServiceFunctionAPI.deleteServicePathFromServiceFunctionStateExecutor(serviceFunctionPathBuilder.build());
+        result = SfcProviderServiceFunctionAPI.deleteServicePathFromServiceFunctionState(serviceFunctionPathBuilder.build());
 
         assertTrue("Must be true", result);
 
-        result = SfcProviderServiceFunctionAPI.deleteServicePathFromServiceFunctionStateExecutor(RSP_NAME + 2);
+        result = SfcProviderServiceFunctionAPI.deleteServicePathFromServiceFunctionState(RSP_NAME + 2);
 
         assertTrue("Must be true", result);
     }
index 0bd3e14958cd9051066ee0cf071e8f51b3b00891..749104fd96a070518c31bd35012a080881c2aa53 100644 (file)
@@ -8,6 +8,14 @@
 
 package org.opendaylight.sfc.provider.api;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -34,12 +42,6 @@ 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.rev100924.Ipv6Address;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-import static org.junit.Assert.*;
-
 public class SfcProviderServiceFunctionGroupAPITest extends AbstractDataStoreManager {
 
     private static final String ALGORITHM = "algorithm";
@@ -61,37 +63,29 @@ public class SfcProviderServiceFunctionGroupAPITest extends AbstractDataStoreMan
     }
 
     @Test
-    public void testPutReadDeleteServiceFunctionGroupAlgorithm() throws ExecutionException, InterruptedException {
+    public void testPutReadDeleteServiceFunctionGroupAlgorithm() {
 
         // Create:
         String sfgAlgName = "testServiceFunctionGroupAlgorithm";
         ServiceFunctionGroupAlgorithm sfgAlg = SimpleTestEntityBuilder.buildServiceFunctionGroupAlgorithm(sfgAlgName);
 
         // Put:
-        Object[] params = {sfgAlg};
-        Class[] paramsTypes = {ServiceFunctionGroupAlgorithm.class};
-        executor.submit(SfcProviderServiceFunctionGroupAlgAPI.getPut(params, paramsTypes)).get();
+        SfcProviderServiceFunctionGroupAlgAPI.putServiceFunctionGroupAlgorithm(sfgAlg);
 
         // Read:
-        Object[] params2 = {sfgAlgName};
-        Class[] paramsTypes2 = {String.class};
-        Object result = executor.submit(SfcProviderServiceFunctionGroupAlgAPI.getRead(params2, paramsTypes2)).get();
-        ServiceFunctionGroupAlgorithm sfgAlg2 = (ServiceFunctionGroupAlgorithm) result;
+        ServiceFunctionGroupAlgorithm sfgAlg2 = SfcProviderServiceFunctionGroupAlgAPI.readServiceFunctionGroupAlg(sfgAlgName);
 
         assertNotNull("Must be not null", sfgAlg2);
         assertEquals("Must be equal", sfgAlg2.getName(), sfgAlgName);
 
         // Delete:
-        executor.submit(SfcProviderServiceFunctionGroupAlgAPI.getDelete(params2, paramsTypes2));
-        Thread.sleep(1000);
-        result = executor.submit(SfcProviderServiceFunctionGroupAlgAPI.getRead(params2, paramsTypes2)).get();
-        sfgAlg2 = (ServiceFunctionGroupAlgorithm) result;
-
+        SfcProviderServiceFunctionGroupAlgAPI.deleteServiceFunctionGroupAlgorithm(sfgAlgName);
+        sfgAlg2 = SfcProviderServiceFunctionGroupAlgAPI.readServiceFunctionGroupAlgorithm(sfgAlgName);
         assertNull("Must be null", sfgAlg2); // TODO: test passes locally but fails on Jenkins
     }
 
     @Test
-    public void testPutReadDeleteServiceFunctionGroup() throws ExecutionException, InterruptedException {
+    public void testPutReadDeleteServiceFunctionGroup() {
 
         // Create:
         String sfgName = "testServiceFunctionGroup";
@@ -99,32 +93,25 @@ public class SfcProviderServiceFunctionGroupAPITest extends AbstractDataStoreMan
         ServiceFunctionGroup sfg = SimpleTestEntityBuilder.buildServiceFunctionGroup(sfgName, sfgAlgName);
 
         // Put:
-        Object[] params = {sfg};
-        Class[] paramsTypes = {ServiceFunctionGroup.class};
-        executor.submit(SfcProviderServiceFunctionGroupAPI.getPut(params, paramsTypes)).get();
+        SfcProviderServiceFunctionGroupAPI.putServiceFunctionGroup(sfg);
 
         // Read:
-        Object[] params2 = {sfgName};
-        Class[] paramsTypes2 = {String.class};
-        Object result = executor.submit(SfcProviderServiceFunctionGroupAPI.getRead(params2, paramsTypes2)).get();
-        ServiceFunctionGroup sfg2 = (ServiceFunctionGroup) result;
+        ServiceFunctionGroup sfg2 = SfcProviderServiceFunctionGroupAPI.readServiceFunctionGroup(sfgName);
 
         assertNotNull("Must be not null", sfg2);
         assertEquals("Must be equal", sfg2.getName(), sfgName);
         assertEquals("Must be equal", sfg2.getAlgorithm(), sfgAlgName);
 
         // Delete:
-        executor.submit(SfcProviderServiceFunctionGroupAPI.getDelete(params2, paramsTypes2));
-        Thread.sleep(1000);
-        result = executor.submit(SfcProviderServiceFunctionGroupAPI.getRead(params2, paramsTypes2)).get();
-        sfg2 = (ServiceFunctionGroup) result;
+        SfcProviderServiceFunctionGroupAPI.deleteServiceFunctionGroup(sfgName);
+        sfg2 = SfcProviderServiceFunctionGroupAPI.readServiceFunctionGroup(sfgName);
 
-        assertNull("Must be null", sfg2); // TODO: test passes locally but fails on Jenkins
+        assertNull("Must be null", sfg2);
     }
 
     @Test
     @Ignore
-    public void testAddRemoveFunctionFromServiceFunctionGroup() throws ExecutionException, InterruptedException {
+    public void testAddRemoveFunctionFromServiceFunctionGroup() {
 
         // Create:
         String sfgName = "testServiceFunctionGroup";
@@ -133,14 +120,11 @@ public class SfcProviderServiceFunctionGroupAPITest extends AbstractDataStoreMan
 
         // Add Service Function:
         ServiceFunction sf = sfList.get(0);
-        Object[] params = {sfg.getName(), sf.getName()};
-        Class[] paramsTypes = {String.class, String.class};
-        executor.submit(SfcProviderServiceFunctionGroupAPI.getAddSF(params, paramsTypes)).get();
-
+        SfcProviderServiceFunctionGroupAPI.addServiceFunctionToGroup(sfg.getName(), sf.getName());
         assertNotNull("Must be not null", sfg.getSfcServiceFunction().get(0));
 
         // Delete Service Function:
-        executor.submit(SfcProviderServiceFunctionGroupAPI.getDelete(params, paramsTypes));
+        SfcProviderServiceFunctionGroupAPI.removeServiceFunctionFromGroup(sfg.getName(), sf.getName());
         assertNull("Must be null", sfg.getSfcServiceFunction().get(0));
     }
 
@@ -161,27 +145,27 @@ public class SfcProviderServiceFunctionGroupAPITest extends AbstractDataStoreMan
         assertTrue("Must be true", transactionSuccessful);
 
         //get service function by type
-        ServiceFunctionGroup serviceFunctionGroup = SfcProviderServiceFunctionGroupAPI.getServiceFunctionGroupbyTypeExecutor(Firewall.class);
+        ServiceFunctionGroup serviceFunctionGroup = SfcProviderServiceFunctionGroupAPI.getServiceFunctionGroupByType(Firewall.class);
 
         assertNotNull("Must be not null", serviceFunctionGroup);
         assertEquals("Must be equal", serviceFunctionGroup.getIpMgmtAddress().getIpv4Address().getValue(), IP_V4_ADDRESS);
         assertEquals("Must be equal", serviceFunctionGroup.getType(), Firewall.class);
 
-        serviceFunctionGroup = SfcProviderServiceFunctionGroupAPI.getServiceFunctionGroupbyTypeExecutor(Dpi.class);
+        serviceFunctionGroup = SfcProviderServiceFunctionGroupAPI.getServiceFunctionGroupByType(Dpi.class);
 
         assertNotNull("Must be not null", serviceFunctionGroup);
         assertEquals("Must be equal", serviceFunctionGroup.getIpMgmtAddress().getIpv6Address().getValue(), IP_V6_ADDRESS);
         assertEquals("Must be equal", serviceFunctionGroup.getType(), Dpi.class);
 
         //get service function group by name
-        serviceFunctionGroup = SfcProviderServiceFunctionGroupAPI.readServiceFunctionGroupExecutor(SFG_NAME + 1);
+        serviceFunctionGroup = SfcProviderServiceFunctionGroupAPI.readServiceFunctionGroup(SFG_NAME + 1);
 
         assertNotNull("Must be not null", serviceFunctionGroup);
         assertEquals("Must be equal", serviceFunctionGroup.getName(), SFG_NAME + 1);
         assertEquals("Must be equal", serviceFunctionGroup.getIpMgmtAddress().getIpv4Address().getValue(), IP_V4_ADDRESS);
         assertEquals("Must be equal", serviceFunctionGroup.getType(), Firewall.class);
 
-        serviceFunctionGroup = SfcProviderServiceFunctionGroupAPI.readServiceFunctionGroupExecutor(SFG_NAME + 2);
+        serviceFunctionGroup = SfcProviderServiceFunctionGroupAPI.readServiceFunctionGroup(SFG_NAME + 2);
 
         assertNotNull("Must be not null", serviceFunctionGroup);
         assertEquals("Must be equal", serviceFunctionGroup.getName(), SFG_NAME + 2);
index 7b8e6343545b22ff962aa5612f44dec26f38ae27..d9c6f6e94721d44d3473463e863e83c42b9da90f 100755 (executable)
@@ -53,11 +53,11 @@ public class SfcProviderServiceFunctionMetadataAPITest extends AbstractDataStore
                 .setContextHeader4(4L);
 
         //write service function metadata
-        boolean transactionSuccessful = SfcProviderServiceFunctionMetadataAPI.putContextMetadataExecutor(contextMetadataBuilder.build());
+        boolean transactionSuccessful = SfcProviderServiceFunctionMetadataAPI.putContextMetadata(contextMetadataBuilder.build());
         assertTrue("Must be true", transactionSuccessful);
 
         //read service function metadata
-        ContextMetadata contextMetadata =  SfcProviderServiceFunctionMetadataAPI.readContextMetadataExecutor("CMD");
+        ContextMetadata contextMetadata =  SfcProviderServiceFunctionMetadataAPI.readContextMetadata("CMD");
         assertNotNull("Must not be null", contextMetadata);
         assertEquals("Must be equal", contextMetadata.getName(), "CMD");
         assertEquals("Must be equal", contextMetadata.getContextHeader1(), (Object)1L);
@@ -66,7 +66,7 @@ public class SfcProviderServiceFunctionMetadataAPITest extends AbstractDataStore
         assertEquals("Must be equal", contextMetadata.getContextHeader4(), (Object)4L);
 
         //remove service function metadata
-        transactionSuccessful = SfcProviderServiceFunctionMetadataAPI.deleteContextMetadataExecutor("CMD");
+        transactionSuccessful = SfcProviderServiceFunctionMetadataAPI.deleteContextMetadata("CMD");
         assertTrue("Must be true", transactionSuccessful);
     }
 
@@ -89,11 +89,11 @@ public class SfcProviderServiceFunctionMetadataAPITest extends AbstractDataStore
                 .setTlvMetadata(tlvList);
 
         //write service function metadata
-        boolean transactionSuccessful = SfcProviderServiceFunctionMetadataAPI.putVariableMetadataExecutor(variableMetadataBuilder.build());
+        boolean transactionSuccessful = SfcProviderServiceFunctionMetadataAPI.putVariableMetadata(variableMetadataBuilder.build());
         assertTrue("Must be true", transactionSuccessful);
 
         //read service function metadata
-        VariableMetadata variableMetadata =  SfcProviderServiceFunctionMetadataAPI.readVariableMetadataExecutor("VMD");
+        VariableMetadata variableMetadata =  SfcProviderServiceFunctionMetadataAPI.readVariableMetadata("VMD");
         assertNotNull("Must not be null", variableMetadata);
         assertNotNull("Must not be null", variableMetadata.getTlvMetadata());
         assertEquals("Must be equal", variableMetadata.getTlvMetadata().size(), 1);
@@ -104,7 +104,7 @@ public class SfcProviderServiceFunctionMetadataAPITest extends AbstractDataStore
         assertEquals("Must be equal", variableMetadata.getTlvMetadata().get(0).getTlvData(), "123456");
 
         //remove service function metadata
-        transactionSuccessful = SfcProviderServiceFunctionMetadataAPI.deleteVariableMetadataExecutor("VMD");
+        transactionSuccessful = SfcProviderServiceFunctionMetadataAPI.deleteVariableMetadata("VMD");
         assertTrue("Must be true", transactionSuccessful);
     }
 }
index 9c4f2a4cedb8cbb91b19d8065742d65d5e21e07f..86fbdb7b00589c9d81a5382ac572d4ef905fbaf6 100755 (executable)
@@ -59,8 +59,6 @@ import static org.junit.Assert.*;
 
 public class SfcProviderServicePathAPITest extends AbstractDataStoreManager {
 
-    private List<ServiceFunction> sfList = new ArrayList<>();
-
     @Before
     public void before() {
         setOdlSfc();
@@ -125,17 +123,17 @@ public class SfcProviderServicePathAPITest extends AbstractDataStoreManager {
         assertTrue("Must be true", transactionSuccessful);
 
         //read service path state
-        List<SfpRenderedServicePath> sfpList = SfcProviderServicePathAPI.readServicePathStateExecutor(sfpKey);
+        List<SfpRenderedServicePath> sfpList = SfcProviderServicePathAPI.readServicePathState(sfpKey);
 
         assertNotNull("Must not be null", sfpList);
         assertEquals("Must be equal", sfpList.get(0).getName(), rspKey);
 
         //delete service path state
-        transactionSuccessful = SfcProviderServicePathAPI.deleteServicePathStateExecutor(sfpKey);
+        transactionSuccessful = SfcProviderServicePathAPI.deleteServicePathState(sfpKey);
         assertTrue("Must be true", transactionSuccessful);
 
         //try to read again, must be null
-        sfpList = SfcProviderServicePathAPI.readServicePathStateExecutor(sfpKey);
+        sfpList = SfcProviderServicePathAPI.readServicePathState(sfpKey);
 
         assertNull("Must be null", sfpList);
     }
@@ -151,7 +149,7 @@ public class SfcProviderServicePathAPITest extends AbstractDataStoreManager {
         serviceFunctionPathStateBuilder.setName(sfpKey)
                 .setKey(new ServiceFunctionPathStateKey(sfpKey));
 
-        boolean transactionSuccessful = SfcProviderServicePathAPI.addRenderedPathToServicePathStateExecutor(serviceFunctionPathStateBuilder.build().getName(), rspKey);
+        boolean transactionSuccessful = SfcProviderServicePathAPI.addRenderedPathToServicePathState(serviceFunctionPathStateBuilder.build().getName(), rspKey);
         assertTrue("Must be true", transactionSuccessful);
 
         //check if path is already added
@@ -172,16 +170,16 @@ public class SfcProviderServicePathAPITest extends AbstractDataStoreManager {
                 .setKey(new ServiceFunctionPathKey(sfpName))
                 .setClassifier(testClassifier);
 
-        boolean transactionSuccessful = SfcProviderServicePathAPI.putServiceFunctionPathExecutor(serviceFunctionPathBuilder.build());
+        boolean transactionSuccessful = SfcProviderServicePathAPI.putServiceFunctionPath(serviceFunctionPathBuilder.build());
         assertTrue("Must be true", transactionSuccessful);
 
         //read service function path
-        ServiceFunctionPath serviceFunctionPath = SfcProviderServicePathAPI.readServiceFunctionPathExecutor(sfpName);
+        ServiceFunctionPath serviceFunctionPath = SfcProviderServicePathAPI.readServiceFunctionPath(sfpName);
         assertNotNull("Must not be null", serviceFunctionPath);
         assertEquals("Must be equal", serviceFunctionPath.getClassifier(), testClassifier);
 
         //delete service function path
-        transactionSuccessful = SfcProviderServicePathAPI.deleteServiceFunctionPathExecutor(sfpName);
+        transactionSuccessful = SfcProviderServicePathAPI.deleteServiceFunctionPath(sfpName);
         assertTrue("Must be true", transactionSuccessful);
     }
 
@@ -209,15 +207,15 @@ public class SfcProviderServicePathAPITest extends AbstractDataStoreManager {
         ServiceFunctionPaths writtenPaths = serviceFunctionPathsBuilder.build();
 
         //put all paths
-        boolean transactionSuccessful = SfcProviderServicePathAPI.putServiceFunctionPathsExecutor(writtenPaths);
+        boolean transactionSuccessful = SfcProviderServicePathAPI.putAllServiceFunctionPaths(writtenPaths);
         assertTrue("Must be true", transactionSuccessful);
 
         //read all paths
-        ServiceFunctionPaths getPaths = SfcProviderServicePathAPI.readAllServiceFunctionPathsExecutor();
+        ServiceFunctionPaths getPaths = SfcProviderServicePathAPI.readAllServiceFunctionPaths();
         assertNotNull("Must not be null", getPaths);
         assertTrue("Must be true", getPaths.equals(writtenPaths));
 
-        transactionSuccessful = SfcProviderServicePathAPI.deleteAllServiceFunctionPathsExecutor();
+        transactionSuccessful = SfcProviderServicePathAPI.deleteAllServiceFunctionPaths();
         assertTrue("Must be true", transactionSuccessful);
     }
 
@@ -275,7 +273,7 @@ public class SfcProviderServicePathAPITest extends AbstractDataStoreManager {
         assertTrue("Must be true", transactionSuccessful);
 
         //delete path
-        transactionSuccessful = SfcProviderServicePathAPI.deleteServicePathContainingFunctionExecutor(serviceFunction);
+        transactionSuccessful = SfcProviderServicePathAPI.deleteServicePathContainingFunction(serviceFunction);
         assertTrue("Must be true", transactionSuccessful);
     }
 }
index f449bda13fabd8745aca8ef717a0cde1d32cdfd7..2a85818799b857007b7a4ef4478aa47309cf6082 100644 (file)
@@ -33,33 +33,18 @@ import static org.junit.Assert.*;
 
 public class SfcProviderServiceTypeAPITest extends AbstractDataStoreManager{
 
-    SfcProviderServiceTypeAPILocal sfcProviderServiceTypeAPILocal;
+    SfcProviderServiceTypeAPI sfcProviderServiceTypeAPILocal;
 
     @Before
     public void before() {
         setOdlSfc();
-        Object[] params = {"hello"};
-        sfcProviderServiceTypeAPILocal = new SfcProviderServiceTypeAPILocal(params);
-    }
-
-    @Test
-    public void testGetPut(){
-        ServiceFunctionTypeBuilder serviceFunctionTypeBuilder = new ServiceFunctionTypeBuilder();
-
-        Class serviceFunctionTypeIdentity = Firewall.class;
-        serviceFunctionTypeBuilder.setKey(new ServiceFunctionTypeKey(serviceFunctionTypeIdentity)).setType(serviceFunctionTypeIdentity);
-        ServiceFunctionType serviceFunctionType = serviceFunctionTypeBuilder.build();
-        Object[] serviceTypeObj = {serviceFunctionType};
-        Class[] serviceTypeClass = {Firewall.class};
-        SfcProviderServiceTypeAPI sfcProviderServiceTypeAPI = SfcProviderServiceTypeAPI.getPut(serviceTypeObj, serviceTypeClass);
-        assertNotNull(sfcProviderServiceTypeAPI);
-        assertEquals("Incorrectly returned value of SfcProviderServiceTypeAPI.", "putServiceFunctionType", sfcProviderServiceTypeAPI.getMethodName());
+        sfcProviderServiceTypeAPILocal = new SfcProviderServiceTypeAPI();
     }
 
     @Test
     public void testPutServiceFunctionType() throws Exception{
         ServiceFunctionTypeBuilder serviceFunctionTypeBuilder = new ServiceFunctionTypeBuilder();
-        Class serviceFunctionTypeIdentity = Firewall.class;
+        Class<Firewall> serviceFunctionTypeIdentity = Firewall.class;
         serviceFunctionTypeBuilder.setKey(new ServiceFunctionTypeKey(serviceFunctionTypeIdentity)).setType(serviceFunctionTypeIdentity);
         ServiceFunctionType serviceFunctionType = serviceFunctionTypeBuilder.build();
 
@@ -92,7 +77,7 @@ public class SfcProviderServiceTypeAPITest extends AbstractDataStoreManager{
 
         SfcDataStoreAPI.writePutTransactionAPI(sftentryIID, sftServiceFunctionName, LogicalDatastoreType.CONFIGURATION);
 
-        assertTrue(SfcProviderServiceTypeAPI.deleteServiceFunctionTypeEntryExecutor(serviceFunction));
+        assertTrue(SfcProviderServiceTypeAPI.deleteServiceFunctionTypeEntry(serviceFunction));
         assertNull(SfcDataStoreAPI.readTransactionAPI(sftentryIID, LogicalDatastoreType.CONFIGURATION));
     }
 
@@ -101,7 +86,7 @@ public class SfcProviderServiceTypeAPITest extends AbstractDataStoreManager{
         ServiceFunctionTypesBuilder serviceFunctionTypesBuilder = new ServiceFunctionTypesBuilder();
         List<ServiceFunctionType> serviceFunctionTypeList = new ArrayList<>();
         ServiceFunctionTypeBuilder serviceFunctionTypeBuilder = new ServiceFunctionTypeBuilder();
-        Class serviceFunctionTypeIdentity = Firewall.class;
+        Class<Firewall> serviceFunctionTypeIdentity = Firewall.class;
         serviceFunctionTypeBuilder.setKey(new ServiceFunctionTypeKey(serviceFunctionTypeIdentity)).setType(serviceFunctionTypeIdentity);
         ServiceFunctionType serviceFunctionType = serviceFunctionTypeBuilder.build();
         serviceFunctionTypeList.add(serviceFunctionType);
@@ -120,7 +105,7 @@ public class SfcProviderServiceTypeAPITest extends AbstractDataStoreManager{
         ServiceFunctionTypesBuilder serviceFunctionTypesBuilder = new ServiceFunctionTypesBuilder();
         List<ServiceFunctionType> serviceFunctionTypeList = new ArrayList<>();
         ServiceFunctionTypeBuilder serviceFunctionTypeBuilder = new ServiceFunctionTypeBuilder();
-        Class serviceFunctionTypeIdentity = Firewall.class;
+        Class<Firewall> serviceFunctionTypeIdentity = Firewall.class;
         serviceFunctionTypeBuilder.setKey(new ServiceFunctionTypeKey(serviceFunctionTypeIdentity)).setType(serviceFunctionTypeIdentity);
         ServiceFunctionType serviceFunctionType = serviceFunctionTypeBuilder.build();
         serviceFunctionTypeList.add(serviceFunctionType);
@@ -138,7 +123,7 @@ public class SfcProviderServiceTypeAPITest extends AbstractDataStoreManager{
         ServiceFunctionTypesBuilder serviceFunctionTypesBuilder = new ServiceFunctionTypesBuilder();
         List<ServiceFunctionType> serviceFunctionTypeList = new ArrayList<>();
         ServiceFunctionTypeBuilder serviceFunctionTypeBuilder = new ServiceFunctionTypeBuilder();
-        Class serviceFunctionTypeIdentity = Firewall.class;
+        Class<Firewall> serviceFunctionTypeIdentity = Firewall.class;
         serviceFunctionTypeBuilder.setKey(new ServiceFunctionTypeKey(serviceFunctionTypeIdentity)).setType(serviceFunctionTypeIdentity);
         ServiceFunctionType serviceFunctionType = serviceFunctionTypeBuilder.build();
         serviceFunctionTypeList.add(serviceFunctionType);
@@ -152,10 +137,4 @@ public class SfcProviderServiceTypeAPITest extends AbstractDataStoreManager{
         assertNull("Variable has not been set correctly.", outputSFTypes);
     }
 
-    private class SfcProviderServiceTypeAPILocal extends SfcProviderServiceTypeAPI{
-
-        SfcProviderServiceTypeAPILocal(Object[] params) {
-            super(params, "m");
-        }
-    }
 }
\ No newline at end of file
index 7116dacc52d310d542916fe635541228ece1b944..4332d0996807456a004aa84a36fdcf90ea56a86b 100644 (file)
@@ -9,10 +9,15 @@
 package org.opendaylight.sfc.provider.api;
 
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.ArrayList;
+import java.util.List;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.sfc.provider.AbstractDataStoreManager;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctions;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.entry.SfDataPlaneLocator;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.functions.ServiceFunction;
@@ -49,13 +54,6 @@ import org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.sf.desc.mon.rpt.rev1
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
 public class SfcServiceFunctionLoadBalanceSchedulerAPITest extends AbstractDataStoreManager {
 
     private static final Logger LOG = LoggerFactory.getLogger(SfcProviderServiceChainAPITest.class);
@@ -67,7 +65,7 @@ public class SfcServiceFunctionLoadBalanceSchedulerAPITest extends AbstractDataS
     private SfcServiceFunctionSchedulerAPI scheduler;
 
     @Before
-    public void before() throws ExecutionException, InterruptedException {
+    public void before() {
         setOdlSfc();
 
         scheduler = new SfcServiceFunctionLoadBalanceSchedulerAPI();
@@ -138,13 +136,11 @@ public class SfcServiceFunctionLoadBalanceSchedulerAPITest extends AbstractDataS
 
         ServiceFunctionsBuilder sfsBuilder = new ServiceFunctionsBuilder();
         sfsBuilder.setServiceFunction(sfList);
-        executor.submit(SfcProviderServiceFunctionAPI.getPutAll
-                (new Object[]{sfsBuilder.build()}, new Class[]{ServiceFunctions.class})).get();
+        SfcProviderServiceFunctionAPI.putAllServiceFunctions(sfsBuilder.build());
         //Wait a while in order to ensure they are really created
-        Thread.sleep(1000);
 
         for (ServiceFunction serviceFunction : sfList) {
-            SfcProviderServiceTypeAPI.createServiceFunctionTypeEntryExecutor(serviceFunction);
+            SfcProviderServiceTypeAPI.createServiceFunctionTypeEntry(serviceFunction);
         }
 
         /* Ensure all the ServiceFunctions in sfList are indeed created */
@@ -152,16 +148,11 @@ public class SfcServiceFunctionLoadBalanceSchedulerAPITest extends AbstractDataS
             maxTries = 10;
             ServiceFunction sf2 = null;
             while (maxTries > 0) {
-                Object[] parameters2 = {serviceFunction.getName()};
-                Class[] parameterTypes2 = {String.class};
-                Object result = executor.submit(SfcProviderServiceFunctionAPI
-                        .getRead(parameters2, parameterTypes2)).get();
-                sf2 = (ServiceFunction) result;
+                sf2 = SfcProviderServiceFunctionAPI.readServiceFunction(serviceFunction.getName());
                 maxTries--;
                 if (sf2 != null) {
                     break;
                 }
-                Thread.sleep(1000);
             }
             LOG.debug("SfcServiceFunctionLoadBalanceSchedulerAPITest: getRead ServiceFunction {} {} times: {}", serviceFunction.getName(), 10 - maxTries, (sf2 == null) ? "Failed" : "Successful");
         }
@@ -230,17 +221,9 @@ public class SfcServiceFunctionLoadBalanceSchedulerAPITest extends AbstractDataS
     }
 
     @Test
-    public void testServiceFunctionLoadBalanceScheduler() throws ExecutionException, InterruptedException {
-        Object[] sfcParameters = {sfChain};
-        Class[] sfcParameterTypes = {ServiceFunctionChain.class};
-        executor.submit(SfcProviderServiceChainAPI
-                .getPut(sfcParameters, sfcParameterTypes)).get();
-
-        Object[] parameters2 = {sfChain.getName()};
-        Class[] parameterTypes2 = {String.class};
-        Object result = executor.submit(SfcProviderServiceChainAPI
-                .getRead(parameters2, parameterTypes2)).get();
-        ServiceFunctionChain sfc2 = (ServiceFunctionChain) result;
+    public void testServiceFunctionLoadBalanceScheduler() {
+        SfcProviderServiceChainAPI.putServiceFunctionChain(sfChain);
+        ServiceFunctionChain sfc2 = SfcProviderServiceChainAPI.readServiceFunctionChain(sfChain.getName());
 
         assertNotNull("Must be not null", sfc2);
         assertEquals("Must be equal", sfc2.getSfcServiceFunction(), sfChain.getSfcServiceFunction());
@@ -248,27 +231,27 @@ public class SfcServiceFunctionLoadBalanceSchedulerAPITest extends AbstractDataS
         ServiceFunctionType serviceFunctionType;
         List<SftServiceFunctionName> sftServiceFunctionNameList;
 
-        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionTypeExecutor(Firewall.class);
+        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionType(Firewall.class);
         sftServiceFunctionNameList = serviceFunctionType.getSftServiceFunctionName();
         assertNotNull("Must be not null", sftServiceFunctionNameList);
         assertEquals("Must be equal", sftServiceFunctionNameList.size(), 3);
 
-        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionTypeExecutor(Dpi.class);
+        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionType(Dpi.class);
         sftServiceFunctionNameList = serviceFunctionType.getSftServiceFunctionName();
         assertNotNull("Must be not null", sftServiceFunctionNameList);
         assertEquals("Must be equal", sftServiceFunctionNameList.size(), 3);
 
-        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionTypeExecutor(Napt44.class);
+        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionType(Napt44.class);
         sftServiceFunctionNameList = serviceFunctionType.getSftServiceFunctionName();
         assertNotNull("Must be not null", sftServiceFunctionNameList);
         assertEquals("Must be equal", sftServiceFunctionNameList.size(), 3);
 
         int serviceIndex = 255;
-        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionTypeExecutor(Firewall.class);
+        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionType(Firewall.class);
         List<SftServiceFunctionName> sftFirewallList = serviceFunctionType.getSftServiceFunctionName();
-        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionTypeExecutor(Dpi.class);
+        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionType(Dpi.class);
         List<SftServiceFunctionName> sftDpiList = serviceFunctionType.getSftServiceFunctionName();
-        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionTypeExecutor(Napt44.class);
+        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionType(Napt44.class);
         List<SftServiceFunctionName> sftNapt44List = serviceFunctionType.getSftServiceFunctionName();
 
         List<String> serviceFunctionNameArrayList = scheduler.scheduleServiceFunctions(sfChain, serviceIndex, sfPath);
@@ -276,7 +259,7 @@ public class SfcServiceFunctionLoadBalanceSchedulerAPITest extends AbstractDataS
 
         for (int i = 0; i < 3; i++) {
             String sfFWName = sftFirewallList.get(i).getName();
-            java.lang.Long cPUUtilization = SfcProviderServiceFunctionAPI.readServiceFunctionDescriptionMonitorExecutor(sfFWName)
+            java.lang.Long cPUUtilization = SfcProviderServiceFunctionAPI.readServiceFunctionDescriptionMonitor(sfFWName)
                     .getMonitoringInfo()
                     .getResourceUtilization()
                     .getCPUUtilization();
@@ -285,7 +268,7 @@ public class SfcServiceFunctionLoadBalanceSchedulerAPITest extends AbstractDataS
 
         for (int i = 0; i < 3; i++) {
             String sfDPIName = sftDpiList.get(i).getName();
-            java.lang.Long cPUUtilization = SfcProviderServiceFunctionAPI.readServiceFunctionDescriptionMonitorExecutor(sfDPIName)
+            java.lang.Long cPUUtilization = SfcProviderServiceFunctionAPI.readServiceFunctionDescriptionMonitor(sfDPIName)
                     .getMonitoringInfo()
                     .getResourceUtilization()
                     .getCPUUtilization();
@@ -294,7 +277,7 @@ public class SfcServiceFunctionLoadBalanceSchedulerAPITest extends AbstractDataS
 
         for (int i = 0; i < 3; i++) {
             String sfNATName = sftNapt44List.get(i).getName();
-            java.lang.Long cPUUtilization = SfcProviderServiceFunctionAPI.readServiceFunctionDescriptionMonitorExecutor(sfNATName)
+            java.lang.Long cPUUtilization = SfcProviderServiceFunctionAPI.readServiceFunctionDescriptionMonitor(sfNATName)
                     .getMonitoringInfo()
                     .getResourceUtilization()
                     .getCPUUtilization();
index 4088275bb95573bcd210580a78e0c8a794ad2275..b6813ca0443c46730ae299a6abd4539377d3d737 100644 (file)
@@ -8,10 +8,17 @@
 
 package org.opendaylight.sfc.provider.api;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.sfc.provider.AbstractDataStoreManager;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctions;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.entry.SfDataPlaneLocator;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.functions.ServiceFunction;
@@ -38,13 +45,6 @@ import org.powermock.reflect.Whitebox;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-import static org.junit.Assert.*;
-
 public class SfcServiceFunctionSchedulerAPITest extends AbstractDataStoreManager {
 
     private static final Logger LOG = LoggerFactory.getLogger(SfcServiceFunctionSchedulerAPITest.class);
@@ -54,7 +54,7 @@ public class SfcServiceFunctionSchedulerAPITest extends AbstractDataStoreManager
     private ServiceFunctionPath sfPath;
 
     @Before
-    public void before() throws ExecutionException, InterruptedException, IllegalAccessException {
+    public void before() throws Exception {
         setOdlSfc();
 
         int maxTries = 10;
@@ -129,38 +129,27 @@ public class SfcServiceFunctionSchedulerAPITest extends AbstractDataStoreManager
 
         ServiceFunctionsBuilder sfsBuilder = new ServiceFunctionsBuilder();
         sfsBuilder.setServiceFunction(sfList);
-        executor.submit(SfcProviderServiceFunctionAPI.getPutAll
-                (new Object[]{sfsBuilder.build()}, new Class[]{ServiceFunctions.class})).get();
-        Thread.sleep(1000); //Wait they are really created
+        SfcProviderServiceFunctionAPI.putAllServiceFunctions(sfsBuilder.build());
 
         for (ServiceFunction serviceFunction : sfList) {
-            SfcProviderServiceTypeAPI.createServiceFunctionTypeEntryExecutor(serviceFunction);
+            SfcProviderServiceTypeAPI.createServiceFunctionTypeEntry(serviceFunction);
         }
 
-        Object[] sfcParameters = {sfChain};
-        Class[] sfcParameterTypes = {ServiceFunctionChain.class};
-        executor.submit(SfcProviderServiceChainAPI
-                .getPut(sfcParameters, sfcParameterTypes)).get();
-        Thread.sleep(1000); //Wait it is really created
+        SfcProviderServiceChainAPI.putServiceFunctionChain(sfChain);
     }
 
     @Test
-    public void testBasicEnvSetup() throws ExecutionException, InterruptedException {
+    public void testBasicEnvSetup() {
         int maxTries;
         for (ServiceFunction serviceFunction : sfList) {
             maxTries = 10;
             ServiceFunction sf2 = null;
             while (maxTries > 0) {
-                Object[] parameters2 = {serviceFunction.getName()};
-                Class[] parameterTypes2 = {String.class};
-                Object result = executor.submit(SfcProviderServiceFunctionAPI
-                        .getRead(parameters2, parameterTypes2)).get();
-                sf2 = (ServiceFunction) result;
+                sf2 = SfcProviderServiceFunctionAPI.readServiceFunction(serviceFunction.getName());
                 maxTries--;
                 if (sf2 != null) {
                     break;
                 }
-                Thread.sleep(1000);
             }
             LOG.debug("SfcServiceFunctionSchedulerAPITest: getRead ServiceFunction {} {} times: {}", serviceFunction.getName(), 10 - maxTries, (sf2 != null) ? "Successful" : "Failed");
             assertNotNull("Must be not null", sf2);
@@ -168,11 +157,8 @@ public class SfcServiceFunctionSchedulerAPITest extends AbstractDataStoreManager
             assertEquals("Must be equal", sf2.getType(), serviceFunction.getType());
         }
 
-        Object[] parameters2 = {sfChain.getName()};
-        Class[] parameterTypes2 = {String.class};
-        Object result = executor.submit(SfcProviderServiceChainAPI
-                .getRead(parameters2, parameterTypes2)).get();
-        ServiceFunctionChain sfc2 = (ServiceFunctionChain) result;
+        SfcProviderServiceFunctionAPI.readServiceFunction(sfChain.getName());
+        ServiceFunctionChain sfc2 = SfcProviderServiceChainAPI.readServiceFunctionChain(sfChain.getName());
 
         assertNotNull("Must be not null", sfc2);
         assertEquals("Must be equal", sfc2.getSfcServiceFunction(), sfChain.getSfcServiceFunction());
@@ -180,7 +166,7 @@ public class SfcServiceFunctionSchedulerAPITest extends AbstractDataStoreManager
         ServiceFunctionType serviceFunctionType;
         List<SftServiceFunctionName> sftServiceFunctionNameList;
 
-        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionTypeExecutor(Firewall.class);
+        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionType(Firewall.class);
         sftServiceFunctionNameList = serviceFunctionType.getSftServiceFunctionName();
         assertNotNull("Must be not null", sftServiceFunctionNameList);
         for (SftServiceFunctionName sftServiceFunctionName : sftServiceFunctionNameList) {
@@ -188,19 +174,19 @@ public class SfcServiceFunctionSchedulerAPITest extends AbstractDataStoreManager
         }
         assertEquals("Must be equal", sftServiceFunctionNameList.size(), 3);
 
-        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionTypeExecutor(Dpi.class);
+        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionType(Dpi.class);
         sftServiceFunctionNameList = serviceFunctionType.getSftServiceFunctionName();
         assertNotNull("Must be not null", sftServiceFunctionNameList);
         assertEquals("Must be equal", sftServiceFunctionNameList.size(), 3);
 
-        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionTypeExecutor(Napt44.class);
+        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionType(Napt44.class);
         sftServiceFunctionNameList = serviceFunctionType.getSftServiceFunctionName();
         assertNotNull("Must be not null", sftServiceFunctionNameList);
         assertEquals("Must be equal", sftServiceFunctionNameList.size(), 3);
     }
 
     @Test
-    public void testServiceFunctionRandomScheduler() throws ExecutionException, InterruptedException {
+    public void testServiceFunctionRandomScheduler() {
         int serviceIndex = 255;
         SfcServiceFunctionSchedulerAPI scheduler = new SfcServiceFunctionRandomSchedulerAPI();
         List<String> serviceFunctionNameArrayList =
@@ -208,34 +194,34 @@ public class SfcServiceFunctionSchedulerAPITest extends AbstractDataStoreManager
 
         assertNotNull("Must be not null", serviceFunctionNameArrayList);
 
-        ServiceFunction serviceFunction = SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(serviceFunctionNameArrayList.get(0));
+        ServiceFunction serviceFunction = SfcProviderServiceFunctionAPI.readServiceFunction(serviceFunctionNameArrayList.get(0));
         assertNotNull("Must be not null", serviceFunction);
         assertEquals("Must be equal", serviceFunction.getType(), Firewall.class);
         assertNotEquals("Must be not equal", serviceFunction.getType(), Dpi.class);
 
         serviceFunction = SfcProviderServiceFunctionAPI
-                .readServiceFunctionExecutor(serviceFunctionNameArrayList.get(1));
+                .readServiceFunction(serviceFunctionNameArrayList.get(1));
         assertEquals("Must be equal", serviceFunction.getType(), Dpi.class);
         assertNotEquals("Must be not equal", serviceFunction.getType(), Napt44.class);
 
         serviceFunction = SfcProviderServiceFunctionAPI
-                .readServiceFunctionExecutor(serviceFunctionNameArrayList.get(2));
+                .readServiceFunction(serviceFunctionNameArrayList.get(2));
         assertEquals("Must be equal", serviceFunction.getType(), Napt44.class);
         assertNotEquals("Must be not equal", serviceFunction.getType(), Firewall.class);
     }
 
     @Test
-    public void testServiceFunctionRoundRobinScheduler() throws ExecutionException, InterruptedException {
+    public void testServiceFunctionRoundRobinScheduler() {
         int serviceIndex = 255;
         SfcServiceFunctionSchedulerAPI scheduler = new SfcServiceFunctionRoundRobinSchedulerAPI();
         List<String> serviceFunctionNameArrayList;
 
         ServiceFunctionType serviceFunctionType;
-        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionTypeExecutor(Firewall.class);
+        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionType(Firewall.class);
         List<SftServiceFunctionName> sftFirewallList = serviceFunctionType.getSftServiceFunctionName();
-        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionTypeExecutor(Dpi.class);
+        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionType(Dpi.class);
         List<SftServiceFunctionName> sftDpiList = serviceFunctionType.getSftServiceFunctionName();
-        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionTypeExecutor(Napt44.class);
+        serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionType(Napt44.class);
         List<SftServiceFunctionName> sftNapt44List = serviceFunctionType.getSftServiceFunctionName();
 
         /* First round */
@@ -264,7 +250,7 @@ public class SfcServiceFunctionSchedulerAPITest extends AbstractDataStoreManager
         assertEquals("Must be equal", serviceFunctionNameArrayList.get(1), sftDpiList.get(0).getName());
         assertEquals("Must be equal", serviceFunctionNameArrayList.get(2), sftNapt44List.get(0).getName());
 
-        Class scheduleType = scheduler.getSfcServiceFunctionSchedulerType();
+        Class<?> scheduleType = scheduler.getSfcServiceFunctionSchedulerType();
 
         assertNotNull("Must be not null", scheduleType);
         assertEquals("Must be equal", scheduleType.getSimpleName(), RoundRobin.class.getSimpleName());
index c4545363ee19aff79db200f9e0a754be84e117f8..0bb58c8abe4aa377dabd519bd50c5fc81d537926 100644 (file)
@@ -8,10 +8,16 @@
 
 package org.opendaylight.sfc.provider.api;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.sfc.provider.AbstractDataStoreManager;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctions;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.entry.SfDataPlaneLocator;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.entry.SfDataPlaneLocatorBuilder;
@@ -28,7 +34,14 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev1407
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarderKey;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.*;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ConnectedSffDictionary;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ConnectedSffDictionaryBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionary;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.ServiceFunctionDictionaryKey;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocator;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocatorBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.SffDataPlaneLocatorKey;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocator;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.service.function.dictionary.SffSfDataPlaneLocatorBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.service.function.forwarder.sff.data.plane.locator.DataPlaneLocatorBuilder;
@@ -49,12 +62,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-import static org.junit.Assert.*;
-
 public class SfcServiceFunctionShortestPathSchedulerAPITest extends AbstractDataStoreManager {
 
     private static final Logger LOG = LoggerFactory.getLogger(SfcServiceFunctionShortestPathSchedulerAPITest.class);
@@ -64,7 +71,7 @@ public class SfcServiceFunctionShortestPathSchedulerAPITest extends AbstractData
     private SfcServiceFunctionShortestPathSchedulerAPI scheduler;
 
     @Before
-    public void before() throws ExecutionException, InterruptedException {
+    public void before() {
         setOdlSfc();
 
         scheduler = new SfcServiceFunctionShortestPathSchedulerAPI();
@@ -115,16 +122,14 @@ public class SfcServiceFunctionShortestPathSchedulerAPITest extends AbstractData
 
         /* Must create ServiceFunctionType first */
         for (ServiceFunction serviceFunction : sfList) {
-            boolean ret = SfcProviderServiceTypeAPI.createServiceFunctionTypeEntryExecutor(serviceFunction);
+            boolean ret = SfcProviderServiceTypeAPI.createServiceFunctionTypeEntry(serviceFunction);
             LOG.debug("call createServiceFunctionTypeEntryExecutor for {}", serviceFunction.getName());
             assertTrue("Must be true", ret);
         }
 
         ServiceFunctionsBuilder sfsBuilder = new ServiceFunctionsBuilder();
         sfsBuilder.setServiceFunction(sfList);
-        executor.submit(SfcProviderServiceFunctionAPI.getPutAll
-                (new Object[]{sfsBuilder.build()}, new Class[]{ServiceFunctions.class})).get();
-        Thread.sleep(1000); // Wait they are really created
+        SfcProviderServiceFunctionAPI.putAllServiceFunctions(sfsBuilder.build());
 
         String sfcName = "ShortestPath-unittest-chain-1";
         List<SfcServiceFunction> sfcServiceFunctionList = new ArrayList<>();
@@ -207,29 +212,23 @@ public class SfcServiceFunctionShortestPathSchedulerAPITest extends AbstractData
                     .setConnectedSffDictionary(sffDictionaryList)
                     .setServiceNode(null);
             ServiceFunctionForwarder sff = sffBuilder.build();
-            executor.submit(SfcProviderServiceForwarderAPI.getPut(new Object[]{sff}, new Class[]{ServiceFunctionForwarder.class})).get();
+            SfcProviderServiceForwarderAPI.putServiceFunctionForwarder(sff);
         }
-        Thread.sleep(1000); // Wait they are really created
     }
 
     @Test
-    public void testSfcServiceFunctionShortestPathScheduler() throws ExecutionException, InterruptedException {
+    public void testSfcServiceFunctionShortestPathScheduler() {
         int maxTries;
 
         for (ServiceFunction serviceFunction : sfList) {
             maxTries = 10;
             ServiceFunction sf2 = null;
             while (maxTries > 0) {
-                Object[] parameters2 = {serviceFunction.getName()};
-                Class[] parameterTypes2 = {String.class};
-                Object result = executor.submit(SfcProviderServiceFunctionAPI
-                        .getRead(parameters2, parameterTypes2)).get();
-                sf2 = (ServiceFunction) result;
+                sf2 = SfcProviderServiceFunctionAPI.readServiceFunction(serviceFunction.getName());
                 maxTries--;
                 if (sf2 != null) {
                     break;
                 }
-                Thread.sleep(1000);
             }
             LOG.debug("SfcServiceFunctionShortestPathSchedulerAPITest: getRead ServiceFunction {} {} times: {}", serviceFunction.getName(), 10 - maxTries, (sf2 != null) ? "Successful" : "Failed");
             assertNotNull("Must be not null", sf2);
@@ -237,24 +236,15 @@ public class SfcServiceFunctionShortestPathSchedulerAPITest extends AbstractData
             assertEquals("Must be equal", sf2.getType(), serviceFunction.getType());
         }
 
-        Object[] parameters = {sfChain};
-        Class[] parameterTypes = {ServiceFunctionChain.class};
-
-        executor.submit(SfcProviderServiceChainAPI
-                .getPut(parameters, parameterTypes)).get();
-
-        Object[] parameters2 = {sfChain.getName()};
-        Class[] parameterTypes2 = {String.class};
-        Object result = executor.submit(SfcProviderServiceChainAPI
-                .getRead(parameters2, parameterTypes2)).get();
-        ServiceFunctionChain sfc2 = (ServiceFunctionChain) result;
+        SfcProviderServiceChainAPI.putServiceFunctionChain(sfChain);
+        ServiceFunctionChain sfc2 = SfcProviderServiceChainAPI.readServiceFunctionChain(sfChain.getName());
 
         assertNotNull("Must be not null", sfc2);
         assertNotNull("Must be not null", sfChain.getSfcServiceFunction());
         assertEquals("Must be equal", sfc2.getSfcServiceFunction(), sfChain.getSfcServiceFunction());
         for (SfcServiceFunction sfcServiceFunction : sfChain.getSfcServiceFunction()) {
             LOG.debug("sfcServiceFunction.name = {}", sfcServiceFunction.getName());
-            ServiceFunctionType serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionTypeExecutor(sfcServiceFunction.getType());
+            ServiceFunctionType serviceFunctionType = SfcProviderServiceTypeAPI.readServiceFunctionType(sfcServiceFunction.getType());
             assertNotNull("Must be not null", serviceFunctionType);
         }
 
@@ -263,23 +253,9 @@ public class SfcServiceFunctionShortestPathSchedulerAPITest extends AbstractData
         List<String> serviceFunctionNameArrayList = scheduler.scheduleServiceFunctions(sfChain, serviceIndex, sfPath);
         assertNotNull("Must be not null", serviceFunctionNameArrayList);
 
-        Object[] parametersHop = {serviceFunctionNameArrayList.get(0)};
-        Class[] parameterTypesHop = {String.class};
-        Object resultHop = executor.submit(SfcProviderServiceFunctionAPI
-                .getRead(parametersHop, parameterTypesHop)).get();
-        ServiceFunction sfHop0 = (ServiceFunction) resultHop;
-
-        Object[] parametersHop1 = {serviceFunctionNameArrayList.get(1)};
-        Class[] parameterTypesHop1 = {String.class};
-        Object resultHop1 = executor.submit(SfcProviderServiceFunctionAPI
-                .getRead(parametersHop1, parameterTypesHop1)).get();
-        ServiceFunction sfHop1 = (ServiceFunction) resultHop1;
-
-        Object[] parametersHop2 = {serviceFunctionNameArrayList.get(2)};
-        Class[] parameterTypesHop2 = {String.class};
-        Object resultHop2 = executor.submit(SfcProviderServiceFunctionAPI
-                .getRead(parametersHop2, parameterTypesHop2)).get();
-        ServiceFunction sfHop2 = (ServiceFunction) resultHop2;
+        ServiceFunction sfHop0 = SfcProviderServiceFunctionAPI.readServiceFunction(serviceFunctionNameArrayList.get(0));
+        ServiceFunction sfHop1 = SfcProviderServiceFunctionAPI.readServiceFunction(serviceFunctionNameArrayList.get(1));
+        ServiceFunction sfHop2 = SfcProviderServiceFunctionAPI.readServiceFunction(serviceFunctionNameArrayList.get(2));
 
         assertNotNull("Must be not null", sfHop0);
         assertNotNull("Must be not null", sfHop1);
index adec379a6bd00460f7a40bc0727c3a52dde2aae5..87c59197351faba6634cec3391e7d029ab2f7633 100644 (file)
@@ -60,7 +60,7 @@ public class SbRestScfEntryDataListener extends SbRestAbstractDataListener {
                 LOG.debug("\nCreated Service Classifier Name: {}", createdServiceClassifier.getName());
 
                 if (createdServiceClassifier.getAccessList() != null && !createdServiceClassifier.getAccessList().isEmpty()) {
-                    Acl accessList = SfcProviderAclAPI.readAccessListExecutor(createdServiceClassifier.getAccessList());
+                    Acl accessList = SfcProviderAclAPI.readAccessList(createdServiceClassifier.getAccessList());
 
                     Runnable task = new SbRestAclTask(RestOperation.POST, accessList,
                             createdServiceClassifier.getSclServiceFunctionForwarder(), opendaylightSfc.getExecutor());
@@ -78,7 +78,7 @@ public class SbRestScfEntryDataListener extends SbRestAbstractDataListener {
                 LOG.debug("\nModified Service Classifier Name: {}", updatedServiceClassifier.getName());
 
                 if (updatedServiceClassifier.getAccessList() != null && !updatedServiceClassifier.getAccessList().isEmpty()) {
-                    Acl accessList = SfcProviderAclAPI.readAccessListExecutor(updatedServiceClassifier.getAccessList());
+                    Acl accessList = SfcProviderAclAPI.readAccessList(updatedServiceClassifier.getAccessList());
 
                     Runnable task = new SbRestAclTask(RestOperation.PUT, accessList,
                             updatedServiceClassifier.getSclServiceFunctionForwarder(), opendaylightSfc.getExecutor());
index 49243b236803ffe702e491593a70cb0c0ee86c16..a007801203e4d563f9ac2f727d304838d44a442f 100644 (file)
@@ -70,7 +70,7 @@ public class SbRestAclTask extends SbRestAbstractTask {
 
         //rest uri list should be created from Classifier SFFs. Classifier will be taken from ACL operational data store <ACL, Classifier>
         //this prevents from looping through all classifiers and looking from ACL.
-        AccessListState accessListState = SfcProviderAclAPI.readAccessListStateExecutor(accessListName);
+        AccessListState accessListState = SfcProviderAclAPI.readAccessListState(accessListName);
         if (accessListState != null) {
             List<AclServiceFunctionClassifier> serviceClassifierList = accessListState.getAclServiceFunctionClassifier();
 
@@ -78,7 +78,7 @@ public class SbRestAclTask extends SbRestAbstractTask {
             if (serviceClassifierList != null) {
                 for (AclServiceFunctionClassifier aclServiceClassifier : serviceClassifierList) {
                     ServiceFunctionClassifier serviceClassifier =
-                            SfcProviderServiceClassifierAPI.readServiceClassifierExecutor(aclServiceClassifier.getName());
+                            SfcProviderServiceClassifierAPI.readServiceClassifier(aclServiceClassifier.getName());
 
                     if (serviceClassifier != null) {
                         List<SclServiceFunctionForwarder> sclServiceForwarderList = serviceClassifier.getSclServiceFunctionForwarder();
@@ -108,7 +108,7 @@ public class SbRestAclTask extends SbRestAbstractTask {
         if (sclServiceForwarderList != null && accessListName != null && !accessListName.isEmpty()) {
             for (SclServiceFunctionForwarder sclServiceForwarder : sclServiceForwarderList) {
                 ServiceFunctionForwarder serviceForwarder =
-                        SfcProviderServiceForwarderAPI.readServiceFunctionForwarderExecutor(sclServiceForwarder.getName());
+                        SfcProviderServiceForwarderAPI.readServiceFunctionForwarder(sclServiceForwarder.getName());
 
                 if (serviceForwarder != null && serviceForwarder.getRestUri() != null &&
                         !serviceForwarder.getRestUri().getValue().isEmpty()) {
index 417a44300e84e95447db1ebab1b73e2847758b88..b401d0568a3973ff4f431a8001cb1e023aee885e 100755 (executable)
@@ -48,7 +48,7 @@ public class SbRestRspTask extends SbRestAbstractTask {
             for (RenderedServicePathHop hop : hopList) {
                 ServiceFunctionForwarder sff =
                         SfcProviderServiceForwarderAPI
-                                .readServiceFunctionForwarderExecutor(hop.getServiceFunctionForwarder());
+                                .readServiceFunctionForwarder(hop.getServiceFunctionForwarder());
                 if (sff != null && sff.getRestUri() != null) {
                     String restUri = sff.getRestUri().getValue() + RSP_REST_URI + obj.getName();
                     this.restUriList.add(restUri);
index cbe90bcd4ff5b223eebde5981b0e774080380d61..081d812e3085862f7be2eb080889ed01b0e02059 100644 (file)
@@ -39,8 +39,8 @@ public class SbRestSfstateTask extends SbRestAbstractTask {
 
         this.restUriList = new ArrayList<>();
 
-        if(SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(obj.getName())!=null) {
-            ServiceFunction serviceFunction = SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(obj.getName());
+        if(SfcProviderServiceFunctionAPI.readServiceFunction(obj.getName())!=null) {
+            ServiceFunction serviceFunction = SfcProviderServiceFunctionAPI.readServiceFunction(obj.getName());
             if (serviceFunction.getRestUri() != null) {
                 String restUri = serviceFunction.getRestUri().getValue() + SFSTATE_REST_URI + obj.getName();
                 this.restUriList.add(restUri);
index 83a077211bf161686dac1f424a0393572187bb59..fb51d242a86742939fe3b68a0986ded0d3a6a4f5 100644 (file)
@@ -72,15 +72,15 @@ public class SbRestAclTaskTest {
     public void init() {
         executorService = Executors.newFixedThreadPool(10);
 
-        PowerMockito.stub(PowerMockito.method(SfcProviderAclAPI.class, "readAccessListStateExecutor", String.class))
+        PowerMockito.stub(PowerMockito.method(SfcProviderAclAPI.class, "readAccessListState", String.class))
             .toReturn(this.buildAccessListState());
 
-        PowerMockito.stub(PowerMockito.method(SfcProviderServiceClassifierAPI.class, "readServiceClassifierExecutor",
+        PowerMockito.stub(PowerMockito.method(SfcProviderServiceClassifierAPI.class, "readServiceClassifier",
                 String.class))
             .toReturn(this.buildServiceFunctionClassifier());
 
         PowerMockito.stub(PowerMockito.method(SfcProviderServiceForwarderAPI.class,
-                "readServiceFunctionForwarderExecutor", String.class))
+                "readServiceFunctionForwarder", String.class))
             .toReturn(this.buildServiceFunctionForwarder());
     }
 
@@ -105,7 +105,7 @@ public class SbRestAclTaskTest {
     @Test
     public void testSbRestAclTaskEmpty() throws IOException {
         PowerMockito.mockStatic(SfcProviderServiceForwarderAPI.class);
-        Mockito.when(SfcProviderServiceForwarderAPI.readServiceFunctionForwarderExecutor(SFF_NAME))
+        Mockito.when(SfcProviderServiceForwarderAPI.readServiceFunctionForwarder(SFF_NAME))
             .thenReturn(new ServiceFunctionForwarderBuilder().build());
 
         SbRestAclTask sbRestAclTask = new SbRestAclTask(RestOperation.PUT, this.buildAccessList(), executorService);
index 4ac4e2f11907c54a2c023d82e0ea149ce453203b..8b1f9f9d3427c63639f6490e92462882bdb66e98 100644 (file)
@@ -62,7 +62,7 @@ public class SbRestRspTaskTest {
         executorService = Executors.newFixedThreadPool(10);
 
         PowerMockito.mockStatic(SfcProviderServiceForwarderAPI.class);
-        Mockito.when(SfcProviderServiceForwarderAPI.readServiceFunctionForwarderExecutor(SFF_NAME))
+        Mockito.when(SfcProviderServiceForwarderAPI.readServiceFunctionForwarder(SFF_NAME))
             .thenReturn(this.buildServiceFunctionForwarder());
     }
 
@@ -89,7 +89,7 @@ public class SbRestRspTaskTest {
     @Test
     public void testSbRestRspTaskEmpty() throws IOException {
         PowerMockito.mockStatic(SfcProviderServiceForwarderAPI.class);
-        Mockito.when(SfcProviderServiceForwarderAPI.readServiceFunctionForwarderExecutor(SFF_NAME))
+        Mockito.when(SfcProviderServiceForwarderAPI.readServiceFunctionForwarder(SFF_NAME))
             .thenReturn(new ServiceFunctionForwarderBuilder().build());
 
         SbRestRspTask sbRestRspTask =
index 3e904a76571170bc25a0987c8a572bae4f6bf9e1..d9a76dcce227ed89d1ff6cfc20c1ca26fbf30ba7 100644 (file)
@@ -58,7 +58,7 @@ public class SbRestSfstateTaskTest {
     public void init() {
         executorService = Executors.newFixedThreadPool(10);
         PowerMockito.mockStatic(SfcProviderServiceFunctionAPI.class);
-        Mockito.when(SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(SFSTATE_NAME))
+        Mockito.when(SfcProviderServiceFunctionAPI.readServiceFunction(SFSTATE_NAME))
             .thenReturn(this.buildServiceFunction());
     }
 
@@ -87,7 +87,7 @@ public class SbRestSfstateTaskTest {
         SbRestSfstateTask sbRestSfstateTask =
                 new SbRestSfstateTask(RestOperation.PUT, new ServiceFunctionStateBuilder().build(), executorService);
         PowerMockito.mockStatic(SfcProviderServiceFunctionAPI.class);
-        Mockito.when(SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(SFSTATE_NAME))
+        Mockito.when(SfcProviderServiceFunctionAPI.readServiceFunction(SFSTATE_NAME))
             .thenReturn(new ServiceFunctionBuilder().build());
 
         JsonNode jsonObject = mapper.readTree(sbRestSfstateTask.jsonObject);
index 3898dadf1cb897b7232d8078959d338b527fbb82..05ab40db53ef9737d1593c863436974620ba4718 100644 (file)
@@ -63,9 +63,9 @@ public class SfcLispUtil {
         String classifierName = serviceFunctionPath.getClassifier();
         Acl acl = null;
         if(classifierName != null) {
-            ServiceFunctionClassifier classifier = SfcProviderServiceClassifierAPI.readServiceClassifierExecutor(classifierName);
+            ServiceFunctionClassifier classifier = SfcProviderServiceClassifierAPI.readServiceClassifier(classifierName);
             String aclName = classifier.getAccessList();
-            acl = SfcProviderAclAPI.readAccessListExecutor(aclName);
+            acl = SfcProviderAclAPI.readAccessList(aclName);
         }
         return acl;
     }
index dd343c02c445b4e3a56bca63c09b12653de001c5..c9e344b4983d339feb5590faa763ec14e48a935e 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.sfc.sfc_lisp.provider.api;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.sfc.provider.OpendaylightSfc;
-import org.opendaylight.sfc.provider.api.SfcProviderAbstractAPI;
 import org.opendaylight.sfc.sfc_lisp.provider.LispUpdater;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctions;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.functions.ServiceFunction;
@@ -20,22 +19,10 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class SfcProviderServiceLispAPI extends SfcProviderAbstractAPI {
+public class SfcProviderServiceLispAPI {
 
     private static final Logger LOG = LoggerFactory.getLogger(SfcProviderServiceLispAPI.class);
 
-    public SfcProviderServiceLispAPI(Object[] params, Class[] paramsTypes, String m) {
-        super(params, paramsTypes, m);
-    }
-
-    public static SfcProviderServiceLispAPI getUpdateServiceFunction(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceLispAPI(params, paramsTypes, "updateServiceFunction");
-    }
-
-    public static SfcProviderServiceLispAPI getUpdateServiceFunctionForwarder(Object[] params, Class[] paramsTypes) {
-        return new SfcProviderServiceLispAPI(params, paramsTypes, "updateServiceFunctionForwarder");
-    }
-
     public static void lispUpdateServiceFunction(ServiceFunction sf) {
         LOG.debug("\n####### Start: {}", Thread.currentThread().getStackTrace()[1]);
         if (OpendaylightSfc.getOpendaylightSfcObj().getDataProvider() != null) {
@@ -44,7 +31,7 @@ public class SfcProviderServiceLispAPI extends SfcProviderAbstractAPI {
             InstanceIdentifier<ServiceFunction> sfEntryIID = InstanceIdentifier.builder(ServiceFunctions.class)
                     .child(ServiceFunction.class, sf.getKey()).toInstance();
 
-            WriteTransaction writeTx = ODL_SFC.getDataProvider().newWriteOnlyTransaction();
+            WriteTransaction writeTx = OpendaylightSfc.getOpendaylightSfcObj().getDataProvider().newWriteOnlyTransaction();
             writeTx.put(LogicalDatastoreType.CONFIGURATION, sfEntryIID, sf, true);
             writeTx.commit();
 
@@ -61,7 +48,7 @@ public class SfcProviderServiceLispAPI extends SfcProviderAbstractAPI {
             InstanceIdentifier<ServiceFunctionForwarder> sffEntryIID = InstanceIdentifier.builder(ServiceFunctionForwarders.class)
                     .child(ServiceFunctionForwarder.class, sff.getKey()).toInstance();
 
-            WriteTransaction writeTx = ODL_SFC.getDataProvider().newWriteOnlyTransaction();
+            WriteTransaction writeTx = OpendaylightSfc.getOpendaylightSfcObj().getDataProvider().newWriteOnlyTransaction();
             writeTx.merge(LogicalDatastoreType.CONFIGURATION, sffEntryIID, sff, true);
             writeTx.commit();
 
index 2128ae72fb1117c9c4e35500c662878f7490bb7e..4feddfd0b16946636920ad82d3140e096070292c 100644 (file)
@@ -58,11 +58,8 @@ public class SfcLispSfEntryDataListener extends SfcLispAbstractDataListener  {
             if( entry.getValue() instanceof  ServiceFunction) {
                 ServiceFunction createdServiceFunction = (ServiceFunction) entry.getValue();
 
-                Object[] serviceTypeObj = { createdServiceFunction };
-                Class[] serviceTypeClass = { ServiceFunction.class };
-
                 if (lispUpdater.containsLispAddress(createdServiceFunction)) {
-                    OpendaylightSfc.getOpendaylightSfcObj().getExecutor().submit(SfcProviderServiceLispAPI.getUpdateServiceFunction(serviceTypeObj, serviceTypeClass));
+                    SfcProviderServiceLispAPI.lispUpdateServiceFunction(createdServiceFunction);
                 }
 
             }
index 061010ee4ca950396ff55bcfbda579357263e982..a0f71f6c300f6e2bd789dd330047b944b1edb469 100644 (file)
@@ -62,12 +62,8 @@ public class SfcLispSffDataListener extends SfcLispAbstractDataListener  {
                 List<ServiceFunctionForwarder> serviceFunctionForwarderList = updatedServiceFunctionForwarders.getServiceFunctionForwarder();
                 for (ServiceFunctionForwarder serviceFunctionForwarder : serviceFunctionForwarderList) {
                     if (lispUpdater.containsLispAddress(serviceFunctionForwarder)) {
-                        Object[] serviceFunctionForwarderObj = { serviceFunctionForwarder };
-                        Class[] serviceFunctionForwarderClass = { ServiceFunctionForwarder.class };
-                        OpendaylightSfc.getOpendaylightSfcObj().getExecutor().submit(SfcProviderServiceLispAPI.getUpdateServiceFunction(serviceFunctionForwarderObj,
-                                serviceFunctionForwarderClass));
+                        SfcProviderServiceLispAPI.lispUpdateServiceFunctionForwarder(serviceFunctionForwarder);
                     }
-
                 }
             }
         }
index c797989bb8ef41f98c4dbfa2deb94dc63eaf5a64..2f52d84bb69317c421542bd3e45b9211f6379c90 100644 (file)
@@ -65,7 +65,7 @@ public class SfcL2ProviderUtils extends SfcL2BaseProviderUtils {
 
         ServiceFunction sf = rspContext.serviceFunctions.get(sfName);
         if(sf == null) {
-            sf = SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(sfName);
+            sf = SfcProviderServiceFunctionAPI.readServiceFunction(sfName);
             if(sf != null) {
                 rspContext.serviceFunctions.put(sfName, sf);
             }
@@ -88,7 +88,7 @@ public class SfcL2ProviderUtils extends SfcL2BaseProviderUtils {
 
         ServiceFunctionForwarder sff = rspContext.serviceFunctionFowarders.get(sffName);
         if(sff == null) {
-            sff = SfcProviderServiceForwarderAPI.readServiceFunctionForwarderExecutor(sffName);
+            sff = SfcProviderServiceForwarderAPI.readServiceFunctionForwarder(sffName);
             if(sff != null) {
                 sff = SfcOvsUtil.augmentSffWithOpenFlowNodeId(sff);
                 rspContext.serviceFunctionFowarders.put(sffName, sff);
@@ -103,7 +103,7 @@ public class SfcL2ProviderUtils extends SfcL2BaseProviderUtils {
 
         ServiceFunctionGroup sfg = rspContext.serviceFunctionGroups.get(sfgName);
         if (sfg == null) {
-            sfg = SfcProviderServiceFunctionGroupAPI.readServiceFunctionGroupExecutor(sfgName);
+            sfg = SfcProviderServiceFunctionGroupAPI.readServiceFunctionGroup(sfgName);
             if (sfg != null) {
                 rspContext.serviceFunctionGroups.put(sfgName, sfg);
             }
index a805523e9ce317f82d53bc4254d74667b058aa66..b54972842bf840f972d188b21824ed59ce92372a 100644 (file)
@@ -107,7 +107,7 @@ public class SfcL2SfgDataListener extends SfcL2AbstractDataListener {
     private void buildGroup(ServiceFunctionGroup sfg, boolean isAdd) {
         try {
             List<SfcServiceFunction> sfs = sfg.getSfcServiceFunction();
-            ServiceFunction sf = SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(sfs.get(0).getName());
+            ServiceFunction sf = SfcProviderServiceFunctionAPI.readServiceFunction(sfs.get(0).getName());
             // assuming all SF's have the same SFF
             // should use the ovs id
             String sffName = sf.getSfDataPlaneLocator().get(0).getServiceFunctionForwarder();
@@ -124,11 +124,11 @@ public class SfcL2SfgDataListener extends SfcL2AbstractDataListener {
 
             List<GroupBucketInfo> bucketsInfo = new ArrayList<GroupBucketInfo>();
 
-            ServiceFunctionForwarder sff = SfcProviderServiceForwarderAPI.readServiceFunctionForwarderExecutor(sffName);
+            ServiceFunctionForwarder sff = SfcProviderServiceForwarderAPI.readServiceFunctionForwarder(sffName);
 
             int index = 0;
             for (SfcServiceFunction sfcServiceFunction : sfg.getSfcServiceFunction()) {
-                sf = SfcProviderServiceFunctionAPI.readServiceFunctionExecutor(sfcServiceFunction.getName());
+                sf = SfcProviderServiceFunctionAPI.readServiceFunction(sfcServiceFunction.getName());
                 ServiceFunctionDictionary sffSfDict =
                         sfcL2ProviderUtils.getSffSfDictionary(sff, sfcServiceFunction.getName());
                 String outPort = sfcL2ProviderUtils.getDictPortInfoPort(sffSfDict);
@@ -187,7 +187,7 @@ public class SfcL2SfgDataListener extends SfcL2AbstractDataListener {
     }
 
     private String getSffOpenFlowNodeName(final String sffName) {
-        ServiceFunctionForwarder sff = SfcProviderServiceForwarderAPI.readServiceFunctionForwarderExecutor(sffName);
+        ServiceFunctionForwarder sff = SfcProviderServiceForwarderAPI.readServiceFunctionForwarder(sffName);
         return sfcL2ProviderUtils.getSffOpenFlowNodeName(sff);
     }
 }