aboutsummaryrefslogtreecommitdiffstats
path: root/generic-resource-api/provider/src
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2017-09-05 20:33:51 -0400
committerDan Timoney <dtimoney@att.com>2017-09-05 20:48:29 -0400
commitc3342a09a1bec20195a9617ad5b31f5bd9ac7e00 (patch)
tree875d8294438f4887ef3e45f992eefc93976d6c14 /generic-resource-api/provider/src
parenteb2d40205c8fa043166027a10d9cdb10415e6cbf (diff)
Seed code submit of generic-resource-api
Final seed code submit of generic-resource-api. This version is ready to submit if it verifies clean. Change-Id: Id5d5cec97a5deccfbda478c0dd7e1967900d76a1 Issue-ID: SDNC-45 Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'generic-resource-api/provider/src')
-rw-r--r--generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java2067
-rw-r--r--generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClient.java144
-rw-r--r--generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java280
-rw-r--r--generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev140523/GENERICRESOURCEAPIProviderModule.java35
-rw-r--r--generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev140523/GENERICRESOURCEAPIProviderModuleFactory.java13
-rw-r--r--generic-resource-api/provider/src/main/resources/initial/generic-resource-api-provider.xml51
-rw-r--r--generic-resource-api/provider/src/main/yang/GENERIC-RESOURCE-API-provider-impl.yang61
7 files changed, 2651 insertions, 0 deletions
diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java
new file mode 100644
index 00000000..702e4b87
--- /dev/null
+++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java
@@ -0,0 +1,2067 @@
+package org.onap.sdnc.northbound;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Properties;
+import java.util.TimeZone;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.OptimisticLockFailedException;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ContrailRouteTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ContrailRouteTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ContrailRouteTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ContrailRouteTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GENERICRESOURCEAPIService;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfs;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfsBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.SecurityZoneTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.SecurityZoneTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.SecurityZoneTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.SecurityZoneTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.Services;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServicesBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.contrail.route.response.information.ContrailRouteResponseInformationBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.response.information.NetworkResponseInformationBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.data.PreloadData;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.data.PreloadDataBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.model.information.VnfPreloadList;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.model.information.VnfPreloadListBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.model.information.VnfPreloadListKey;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader.SvcAction;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.security.zone.response.information.SecurityZoneResponseInformationBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.ServiceData;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.ServiceDataBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.model.infrastructure.Service;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.model.infrastructure.ServiceBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.model.infrastructure.ServiceKey;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.response.information.ServiceResponseInformationBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.status.ServiceStatus.RequestStatus;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.status.ServiceStatus.RpcAction;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.status.ServiceStatusBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.SettableFuture;
+
+
+/**
+ * Defines a base implementation for your provider. This class extends from a helper class
+ * which provides storage for the most commonly used components of the MD-SAL. Additionally the
+ * base class provides some basic logging and initialization / clean up methods.
+ *
+ * To use this, copy and paste (overwrite) the following method into the TestApplicationProviderModule
+ * class which is auto generated under src/main/java in this project
+ * (created only once during first compilation):
+ *
+ * <pre>
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+
+ //final GENERIC-RESOURCE-APIProvider provider = new GENERIC-RESOURCE-APIProvider();
+ final GenericResourceApiProvider provider = new GenericResourceApiProvider();
+ provider.setDataBroker( getDataBrokerDependency() );
+ provider.setNotificationService( getNotificationServiceDependency() );
+ provider.setRpcRegistry( getRpcRegistryDependency() );
+ provider.initialize();
+ return new AutoCloseable() {
+
+ @Override
+ public void close() throws Exception {
+ //TODO: CLOSE ANY REGISTRATION OBJECTS CREATED USING ABOVE BROKER/NOTIFICATION
+ //SERVIE/RPC REGISTRY
+ provider.close();
+ }
+ };
+ }
+
+
+ </pre>
+ */
+
+public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURCEAPIService{
+
+ private final Logger log = LoggerFactory.getLogger( GenericResourceApiProvider.class );
+ private final String appName = "generic-resource-api";
+
+ private final ExecutorService executor;
+
+ protected DataBroker dataBroker;
+ protected NotificationProviderService notificationService;
+ protected RpcProviderRegistry rpcRegistry;
+ protected BindingAwareBroker.RpcRegistration<GENERICRESOURCEAPIService> rpcRegistration;
+
+ public GenericResourceApiProvider(DataBroker dataBroker2,
+ NotificationProviderService notificationProviderService,
+ RpcProviderRegistry rpcProviderRegistry) {
+ this.log.info( "Creating provider for " + appName );
+ executor = Executors.newFixedThreadPool(1);
+ dataBroker = dataBroker2;
+ notificationService = notificationProviderService;
+ rpcRegistry = rpcProviderRegistry;
+ initialize();
+
+ }
+
+ public void initialize(){
+ log.info( "Initializing provider for " + appName );
+ // Create the top level containers
+ createContainers();
+ try {
+ GenericResourceApiUtil.loadProperties();
+ } catch (Exception e) {
+ log.error("Caught Exception while trying to load properties file");
+ }
+ rpcRegistration = rpcRegistry.addRpcImplementation(GENERICRESOURCEAPIService.class, this);
+
+ log.info( "Initialization complete for " + appName );
+ }
+
+
+ protected void initializeChild() {
+ //Override if you have custom initialization intelligence
+ }
+
+
+ @Override
+ public void close() throws Exception {
+ log.info( "Closing provider for " + appName );
+ executor.shutdown();
+ rpcRegistration.close();
+ log.info( "Successfully closed provider for " + appName );
+ }
+
+ private static class Iso8601Util
+ {
+ private static TimeZone tz = TimeZone.getTimeZone("UTC");
+ private static DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+
+ static { df.setTimeZone(tz); }
+
+ private static String now() {
+ return df.format(new Date());
+ }
+ }
+
+
+ public void setDataBroker(DataBroker dataBroker) {
+ this.dataBroker = dataBroker;
+ if( log.isDebugEnabled() ){
+ log.debug( "DataBroker set to " + (dataBroker==null?"null":"non-null") + "." );
+ }
+ }
+
+ public void setNotificationService(
+ NotificationProviderService notificationService) {
+ this.notificationService = notificationService;
+ if( log.isDebugEnabled() ){
+ log.debug( "Notification Service set to " + (notificationService==null?"null":"non-null") + "." );
+ }
+ }
+
+ public void setRpcRegistry(RpcProviderRegistry rpcRegistry) {
+ this.rpcRegistry = rpcRegistry;
+ if( log.isDebugEnabled() ){
+ log.debug( "RpcRegistry set to " + (rpcRegistry==null?"null":"non-null") + "." );
+ }
+ }
+
+ private void createContainers() {
+
+ final WriteTransaction t = dataBroker.newReadWriteTransaction();
+
+ // Create the service-instance container
+ t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Services.class),
+ new ServicesBuilder().build());
+ t.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Services.class),
+ new ServicesBuilder().build());
+
+ // Create the PreloadVnfs container
+ t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(PreloadVnfs.class),
+ new PreloadVnfsBuilder().build());
+ t.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(PreloadVnfs.class),
+ new PreloadVnfsBuilder().build());
+
+ try {
+ CheckedFuture<Void, TransactionCommitFailedException> checkedFuture = t.submit();
+ checkedFuture.get();
+ log.info("Create Containers succeeded!: ");
+
+ } catch (InterruptedException | ExecutionException e) {
+ log.error("Create Containers Failed: " + e);
+ e.printStackTrace();
+ }
+ }
+
+ private void setServiceStatus(ServiceStatusBuilder serviceStatusBuilder, String errorCode, String errorMessage, String ackFinal)
+ {
+ serviceStatusBuilder.setResponseCode(errorCode);
+ serviceStatusBuilder.setResponseMessage(errorMessage);
+ serviceStatusBuilder.setFinalIndicator(ackFinal);
+ serviceStatusBuilder.setResponseTimestamp(Iso8601Util.now());
+ }
+
+ private void setServiceStatus(ServiceStatusBuilder serviceStatusBuilder, RequestInformation requestInformation)
+ {
+ if (requestInformation != null && requestInformation.getRequestAction() != null) {
+ serviceStatusBuilder.setAction(requestInformation.getRequestAction().toString());
+ }
+
+ /*
+ if (requestInformation != null && requestInformation.getRequestSubAction() != null) {
+ switch (requestInformation.getRequestSubAction())
+ {
+ case SUPP:
+ serviceStatusBuilder.setVnfsdnSubaction(VnfsdnSubaction.SUPP);
+ break;
+ case CANCEL:
+ serviceStatusBuilder.setVnfsdnSubaction(VnfsdnSubaction.CANCEL);
+ break;
+ default:
+ log.error("Unknown RequestSubAction: " + requestInformation.getRequestSubAction() );
+ break;
+ };
+ }
+ */
+ }
+
+ private void setServiceStatus(ServiceStatusBuilder serviceStatusBuilder, SdncRequestHeader requestHeader)
+ {
+ if (requestHeader != null && requestHeader.getSvcAction() != null) {
+ switch (requestHeader.getSvcAction())
+ {
+ case Assign:
+ serviceStatusBuilder.setRpcAction(RpcAction.Assign);
+ break;
+ case Unassign:
+ serviceStatusBuilder.setRpcAction(RpcAction.Unassign);
+ break;
+ case Activate:
+ serviceStatusBuilder.setRpcAction(RpcAction.Activate);
+ break;
+ case Deactivate:
+ serviceStatusBuilder.setRpcAction(RpcAction.Deactivate);
+ break;
+ case Delete:
+ serviceStatusBuilder.setRpcAction(RpcAction.Delete);
+ break;
+ default:
+ log.error("Unknown SvcAction: " + requestHeader.getSvcAction() );
+ break;
+ };
+ }
+ }
+
+ private void getServiceData(String siid, ServiceDataBuilder serviceDataBuilder)
+ {
+ // default to config
+ getServiceData(siid,serviceDataBuilder,LogicalDatastoreType.CONFIGURATION);
+ }
+
+
+ private void getServiceData(String siid, ServiceDataBuilder serviceDataBuilder, LogicalDatastoreType type)
+ {
+ // See if any data exists yet for this siid, if so grab it.
+ InstanceIdentifier serviceInstanceIdentifier =
+ InstanceIdentifier.<Services>builder(Services.class)
+ .child(Service.class, new ServiceKey(siid)).toInstance();
+ ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction();
+ Optional<Service> data = null;
+ try {
+ data = (Optional<Service>) readTx.read(type, serviceInstanceIdentifier).get();
+ } catch (InterruptedException | ExecutionException e) {
+ log.error("Caught Exception reading MD-SAL ("+type+") for ["+siid+"] " ,e);
+ }
+
+ if (data.isPresent()) {
+ ServiceData serviceData = (ServiceData) data.get().getServiceData();
+ if (serviceData != null) {
+ log.info("Read MD-SAL ("+type+") data for ["+siid+"] ServiceData: " + serviceData);
+ serviceDataBuilder.setSdncRequestHeader(serviceData.getSdncRequestHeader());
+ serviceDataBuilder.setRequestInformation(serviceData.getRequestInformation());
+ serviceDataBuilder.setServiceInformation(serviceData.getServiceInformation());
+ serviceDataBuilder.setServiceRequestInput(serviceData.getServiceRequestInput());
+ serviceDataBuilder.setServiceTopology(serviceData.getServiceTopology());
+ serviceDataBuilder.setServiceLevelOperStatus(serviceData.getServiceLevelOperStatus());
+ serviceDataBuilder.setNetworks(serviceData.getNetworks());
+ serviceDataBuilder.setVnfs(serviceData.getVnfs());
+ serviceDataBuilder.setProvidedAllottedResources(serviceData.getProvidedAllottedResources());
+ serviceDataBuilder.setConsumedAllottedResources(serviceData.getConsumedAllottedResources());
+ // service-instance-id needs to be set
+ } else {
+ log.info("No service-data found in MD-SAL ("+type+") for ["+siid+"] ");
+ }
+ } else {
+ log.info("No data found in MD-SAL ("+type+") for ["+siid+"] ");
+ }
+ }
+
+ private void getPreloadData(String vnf_name, String vnf_type, PreloadDataBuilder preloadDataBuilder)
+ {
+ // default to config
+ getPreloadData(vnf_name, vnf_type ,preloadDataBuilder,LogicalDatastoreType.CONFIGURATION);
+ }
+
+ private void getPreloadData(String preload_name, String preload_type, PreloadDataBuilder preloadDataBuilder, LogicalDatastoreType type)
+ {
+ // See if any data exists yet for this name/type, if so grab it.
+ InstanceIdentifier preloadInstanceIdentifier =
+ InstanceIdentifier.<PreloadVnfs>builder(PreloadVnfs.class)
+ .child(VnfPreloadList.class, new VnfPreloadListKey(preload_name, preload_type)).toInstance();
+ ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction();
+ Optional<VnfPreloadList> data = null;
+ try {
+ data = (Optional<VnfPreloadList>) readTx.read(type, preloadInstanceIdentifier).get();
+ } catch (InterruptedException | ExecutionException e) {
+ log.error("Caught Exception reading MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] " ,e);
+ }
+
+ if ( data.isPresent()) {
+ PreloadData preloadData = (PreloadData) data.get().getPreloadData();
+ if (preloadData != null) {
+ log.info("Read MD-SAL ("+type+") data for ["+preload_name+","+preload_type+"] PreloadData: " + preloadData);
+ preloadDataBuilder.setVnfTopologyInformation(preloadData.getVnfTopologyInformation());
+ preloadDataBuilder.setNetworkTopologyInformation(preloadData.getNetworkTopologyInformation());
+ preloadDataBuilder.setOperStatus(preloadData.getOperStatus());
+ } else {
+ log.info("No preload-data found in MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] ");
+ }
+ } else {
+ log.info("No data found in MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] ");
+ }
+ }
+
+ private void SaveService (final Service entry, boolean merge, LogicalDatastoreType storeType) throws IllegalStateException {
+ // Each entry will be identifiable by a unique key, we have to create that identifier
+ InstanceIdentifier.InstanceIdentifierBuilder<Service> serviceBuilder =
+ InstanceIdentifier.<Services>builder(Services.class)
+ .child(Service.class, entry.getKey());
+ InstanceIdentifier<Service> path = serviceBuilder.toInstance();
+
+ int tries = 2;
+ while(true) {
+ try {
+ WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
+ if (merge) {
+ tx.merge(storeType, path, entry);
+ } else {
+ tx.put(storeType, path, entry);
+ }
+ tx.submit().checkedGet();
+ log.debug("Update DataStore succeeded");
+ break;
+ } catch (final TransactionCommitFailedException e) {
+ if(e instanceof OptimisticLockFailedException) {
+ if(--tries <= 0) {
+ log.debug("Got OptimisticLockFailedException on last try - failing ");
+ throw new IllegalStateException(e);
+ }
+ log.debug("Got OptimisticLockFailedException - trying again ");
+ } else {
+ log.debug("Update DataStore failed");
+ throw new IllegalStateException(e);
+ }
+ }
+ }
+ }
+
+ private void DeleteService(final Service entry, LogicalDatastoreType storeType) throws IllegalStateException {
+ // Each entry will be identifiable by a unique key, we have to create
+ // that identifier
+ InstanceIdentifier.InstanceIdentifierBuilder<Service> serviceListIdBuilder = InstanceIdentifier.<Services> builder(Services.class).child(Service.class, entry.getKey());
+ InstanceIdentifier<Service> path = serviceListIdBuilder.toInstance();
+
+ int tries = 2;
+ while (true) {
+ try {
+ WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
+ tx.delete(storeType, path);
+ tx.submit().checkedGet();
+ log.debug("DataStore delete succeeded");
+ break;
+ } catch (final TransactionCommitFailedException e) {
+ if (e instanceof OptimisticLockFailedException) {
+ if (--tries <= 0) {
+ log.debug("Got OptimisticLockFailedException on last try - failing ");
+ throw new IllegalStateException(e);
+ }
+ log.debug("Got OptimisticLockFailedException - trying again ");
+ } else {
+ log.debug("Update DataStore failed");
+ throw new IllegalStateException(e);
+ }
+ }
+ }
+ }
+
+ private void SavePreloadList(final VnfPreloadList entry, boolean merge, LogicalDatastoreType storeType) throws IllegalStateException{
+
+ // Each entry will be identifiable by a unique key, we have to create that identifier
+ InstanceIdentifier.InstanceIdentifierBuilder<VnfPreloadList> vnfPreloadListBuilder =
+ InstanceIdentifier.<PreloadVnfs>builder(PreloadVnfs.class)
+ .child(VnfPreloadList.class, entry.getKey());
+ InstanceIdentifier<VnfPreloadList> path = vnfPreloadListBuilder.toInstance();
+ int tries = 2;
+ while(true) {
+ try {
+ WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
+ if (merge) {
+ tx.merge(storeType, path, entry);
+ } else {
+ tx.put(storeType, path, entry);
+ }
+ tx.submit().checkedGet();
+ log.debug("Update DataStore succeeded");
+ break;
+ } catch (final TransactionCommitFailedException e) {
+ if(e instanceof OptimisticLockFailedException) {
+ if(--tries <= 0) {
+ log.debug("Got OptimisticLockFailedException on last try - failing ");
+ throw new IllegalStateException(e);
+ }
+ log.debug("Got OptimisticLockFailedException - trying again ");
+ } else {
+ log.debug("Update DataStore failed");
+ throw new IllegalStateException(e);
+ }
+ }
+ }
+ }
+
+ @Override
+ public Future<RpcResult<ServiceTopologyOperationOutput>> serviceTopologyOperation(
+ ServiceTopologyOperationInput input) {
+
+ final String SVC_OPERATION = "service-topology-operation";
+ ServiceData serviceData = null;
+ ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
+ Properties parms = new Properties();
+
+ log.info( SVC_OPERATION +" called." );
+ // create a new response object
+ ServiceTopologyOperationOutputBuilder responseBuilder = new ServiceTopologyOperationOutputBuilder();
+
+ if(input == null ||
+ input.getServiceInformation() == null ||
+ input.getServiceInformation().getServiceInstanceId() == null ||
+ input.getServiceInformation().getServiceInstanceId().length() == 0)
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because of null or empty service-instance-id");
+ responseBuilder.setResponseCode("404");
+ responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<ServiceTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<ServiceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Grab the service instance ID from the input buffer
+ String siid = input.getServiceInformation().getServiceInstanceId();
+
+ if (input.getSdncRequestHeader() != null) {
+ responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ }
+
+ ServiceDataBuilder serviceDataBuilder = new ServiceDataBuilder();
+ getServiceData(siid,serviceDataBuilder);
+
+ ServiceDataBuilder operDataBuilder = new ServiceDataBuilder();
+ getServiceData(siid,operDataBuilder, LogicalDatastoreType.OPERATIONAL );
+
+ // Set the serviceStatus based on input
+ setServiceStatus(serviceStatusBuilder, input.getSdncRequestHeader());
+ setServiceStatus(serviceStatusBuilder, input.getRequestInformation());
+
+ /*
+ // setup a service-data object builder
+ // ACTION service-topology-operation
+ // INPUT:
+ // USES uses service-operation-information
+ // OUTPUT:
+ // uses topology-response-common;
+ // uses service-response-information;
+ */
+
+ log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input);
+ ServiceTopologyOperationInputBuilder inputBuilder = new ServiceTopologyOperationInputBuilder(input);
+ GenericResourceApiUtil.toProperties(parms, inputBuilder.build());
+
+ log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+siid+"] operational-data: " + operDataBuilder.build());
+ GenericResourceApiUtil.toProperties(parms, "operational-data", operDataBuilder);
+
+ // Call SLI sync method
+ // Get SvcLogicService reference
+
+ GenericResourceApiSvcLogicServiceClient svcLogicClient = new GenericResourceApiSvcLogicServiceClient();
+ Properties respProps = null;
+
+ String errorCode = "200";
+ String errorMessage = null;
+ String ackFinal = "Y";
+ String serviceObjectPath = null;
+
+ try
+ {
+ if (svcLogicClient.hasGraph(appName, SVC_OPERATION , null, "sync"))
+ {
+
+ try
+ {
+ respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception executing service logic for "+ SVC_OPERATION, e);
+ errorMessage = e.getMessage();
+ errorCode = "500";
+ }
+ } else {
+ errorMessage = "No service logic active for "+ appName +": '" + SVC_OPERATION + "'";
+ errorCode = "503";
+ }
+ }
+ catch (Exception e)
+ {
+ errorCode = "500";
+ errorMessage = e.getMessage();
+ log.error("Caught exception looking for service logic", e);
+ }
+
+
+ if (respProps != null)
+ {
+ errorCode = respProps.getProperty("error-code");
+ errorMessage = respProps.getProperty("error-message");
+ ackFinal = respProps.getProperty("ack-final", "Y");
+ serviceObjectPath = respProps.getProperty("service-object-path");
+ }
+
+ setServiceStatus(serviceStatusBuilder,errorCode, errorMessage, ackFinal);
+ serviceStatusBuilder.setRequestStatus(RequestStatus.Synccomplete);
+ //serviceStatusBuilder.setRpcName(RpcName.ServiceTopologyOperation);
+ serviceStatusBuilder.setRpcName(SVC_OPERATION);
+
+ if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) {
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setResponseMessage(errorMessage);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+
+ ServiceBuilder serviceBuilder = new ServiceBuilder();
+ serviceBuilder.setServiceInstanceId(siid);
+ serviceBuilder.setServiceStatus(serviceStatusBuilder.build());
+ try {
+ SaveService (serviceBuilder.build(), true,LogicalDatastoreType.CONFIGURATION);
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e);
+ }
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+ RpcResult<ServiceTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<ServiceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Got success from SLI
+ try {
+ serviceData = serviceDataBuilder.build();
+ log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData);
+
+ // service object
+ ServiceBuilder serviceBuilder = new ServiceBuilder();
+ serviceBuilder.setServiceData(serviceData);
+ serviceBuilder.setServiceInstanceId(siid);
+ serviceBuilder.setServiceStatus(serviceStatusBuilder.build());
+ SaveService (serviceBuilder.build(), false,LogicalDatastoreType.CONFIGURATION);
+
+ if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null)
+ {
+ // Only update operational tree on delete
+ if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Delete))
+ {
+ log.info("Delete from both CONFIGURATION and OPERATIONAL tree.");
+ DeleteService(serviceBuilder.build(), LogicalDatastoreType.OPERATIONAL);
+ DeleteService(serviceBuilder.build(), LogicalDatastoreType.CONFIGURATION);
+ }
+ }
+
+ ServiceResponseInformationBuilder serviceResponseInformationBuilder = new ServiceResponseInformationBuilder();
+ serviceResponseInformationBuilder.setInstanceId(siid);
+ serviceResponseInformationBuilder.setObjectPath(serviceObjectPath);
+ responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build());
+
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e);
+ responseBuilder.setResponseCode("500");
+ responseBuilder.setResponseMessage(e.toString());
+ responseBuilder.setAckFinalIndicator("Y");
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+ RpcResult<ServiceTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<ServiceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Update succeeded
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ if (errorMessage != null)
+ {
+ responseBuilder.setResponseMessage(errorMessage);
+ }
+ log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] ");
+ log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+
+ RpcResult<ServiceTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<ServiceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
+ public Future<RpcResult<VnfTopologyOperationOutput>> vnfTopologyOperation(
+ VnfTopologyOperationInput input) {
+
+ final String SVC_OPERATION = "vnf-topology-operation";
+ ServiceData serviceData = null;
+ ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
+ Properties parms = new Properties();
+
+ log.info( SVC_OPERATION +" called." );
+ // create a new response object
+ VnfTopologyOperationOutputBuilder responseBuilder = new VnfTopologyOperationOutputBuilder();
+
+ if(input == null ||
+ input.getServiceInformation() == null ||
+ input.getServiceInformation().getServiceInstanceId() == null ||
+ input.getServiceInformation().getServiceInstanceId().length() == 0)
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because of null or empty service-instance-id");
+ responseBuilder.setResponseCode("404");
+ responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<VnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Grab the service instance ID from the input buffer
+ String siid = input.getServiceInformation().getServiceInstanceId();
+
+ if (input.getSdncRequestHeader() != null) {
+ responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ }
+
+ if(input.getVnfInformation() == null ||
+ input.getVnfInformation().getVnfId() == null ||
+ input.getVnfInformation().getVnfId().length() == 0)
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because of null or empty vnf-id");
+ responseBuilder.setResponseCode("404");
+ responseBuilder.setResponseMessage("invalid input, null or empty vnf-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<VnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ /* Mobility wont use vipr intf in 1707
+
+ String preload_name = null;
+ String preload_type = null;
+ if (input.getVnfRequestInput() != null &&
+ input.getVnfRequestInput().getVnfName() != null && input.getVnfRequestInput().getVnfName().length() != 0) {
+ preload_name = input.getVnfRequestInput().getVnfName();
+ }
+ if (input.getVnfInformation().getVnfType() != null &&
+ input.getVnfInformation().getVnfType().length() != 0) {
+ preload_type = input.getVnfInformation().getVnfType();
+ }
+
+ PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder();
+ if (preload_name != null && preload_type != null) {
+ getPreloadData(preload_name, preload_type, preloadDataBuilder);
+ }
+ else {
+ log.info("vnf-name and vnf-type not present in the request");
+ }
+ */
+
+ ServiceDataBuilder serviceDataBuilder = new ServiceDataBuilder();
+ getServiceData(siid,serviceDataBuilder);
+
+ ServiceDataBuilder operDataBuilder = new ServiceDataBuilder();
+ getServiceData(siid,operDataBuilder, LogicalDatastoreType.OPERATIONAL );
+
+ // Set the serviceStatus based on input
+ setServiceStatus(serviceStatusBuilder, input.getSdncRequestHeader());
+ setServiceStatus(serviceStatusBuilder, input.getRequestInformation());
+
+ //
+ // setup a service-data object builder
+ // ACTION vnf-topology-operation
+ // INPUT:
+ // USES sdnc-request-header;
+ // USES request-information;
+ // USES service-information;
+ // USES vnf-request-information
+ // OUTPUT:
+ // USES vnf-topology-response-body;
+ // USES vnf-information
+ // USES service-information
+ //
+ // container service-data
+ // uses vnf-configuration-information;
+ // uses oper-status;
+
+ log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input);
+ VnfTopologyOperationInputBuilder inputBuilder = new VnfTopologyOperationInputBuilder(input);
+ GenericResourceApiUtil.toProperties(parms, inputBuilder.build());
+
+ log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+siid+"] operational-data: " + operDataBuilder.build());
+ GenericResourceApiUtil.toProperties(parms, "operational-data", operDataBuilder);
+
+ /*
+ log.info("Adding CONFIG data for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] preload-data: " + preloadDataBuilder.build());
+ GenericResourceApiUtil.toProperties(parms, "preload-data", preloadDataBuilder);
+ */
+
+ // Call SLI sync method
+ // Get SvcLogicService reference
+
+ GenericResourceApiSvcLogicServiceClient svcLogicClient = new GenericResourceApiSvcLogicServiceClient();
+ Properties respProps = null;
+
+ String errorCode = "200";
+ String errorMessage = null;
+ String ackFinal = "Y";
+ String serviceObjectPath = null;
+
+ try
+ {
+ if (svcLogicClient.hasGraph(appName, SVC_OPERATION , null, "sync"))
+ {
+
+ try
+ {
+ respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception executing service logic for "+ SVC_OPERATION, e);
+ errorMessage = e.getMessage();
+ errorCode = "500";
+ }
+ } else {
+ errorMessage = "No service logic active for "+ appName +": '" + SVC_OPERATION + "'";
+ errorCode = "503";
+ }
+ }
+ catch (Exception e)
+ {
+ errorCode = "500";
+ errorMessage = e.getMessage();
+ log.error("Caught exception looking for service logic", e);
+ }
+
+ if (respProps != null)
+ {
+ errorCode = respProps.getProperty("error-code");
+ errorMessage = respProps.getProperty("error-message");
+ ackFinal = respProps.getProperty("ack-final", "Y");
+ serviceObjectPath = respProps.getProperty("vnf-object-path");
+ }
+
+ setServiceStatus(serviceStatusBuilder,errorCode, errorMessage, ackFinal);
+ serviceStatusBuilder.setRequestStatus(RequestStatus.Synccomplete);
+ //serviceStatusBuilder.setRpcName(RpcName.VnfTopologyOperation);
+ serviceStatusBuilder.setRpcName(SVC_OPERATION);
+
+ if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) {
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setResponseMessage(errorMessage);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+
+ ServiceBuilder serviceBuilder = new ServiceBuilder();
+ serviceBuilder.setServiceInstanceId(siid);
+ serviceBuilder.setServiceStatus(serviceStatusBuilder.build());
+ try {
+ SaveService (serviceBuilder.build(), true,LogicalDatastoreType.CONFIGURATION);
+ if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null)
+ {
+ // Only update operational tree on activate or delete
+ if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Delete) ||
+ input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate))
+ {
+ log.info("Updating OPERATIONAL tree.");
+ SaveService (serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
+ }
+ }
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e);
+ }
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+ RpcResult<VnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Got success from SLI
+ try {
+ serviceData = serviceDataBuilder.build();
+ log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData);
+
+ // service object
+ ServiceBuilder serviceBuilder = new ServiceBuilder();
+ serviceBuilder.setServiceData(serviceData);
+ serviceBuilder.setServiceInstanceId(siid);
+ serviceBuilder.setServiceStatus(serviceStatusBuilder.build());
+ SaveService (serviceBuilder.build(), false,LogicalDatastoreType.CONFIGURATION);
+
+ if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null)
+ {
+ // Only update operational tree on Assign
+ if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate))
+ {
+ log.info("Updating OPERATIONAL tree.");
+ SaveService (serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
+ }
+ }
+
+ ServiceResponseInformationBuilder serviceResponseInformationBuilder = new ServiceResponseInformationBuilder();
+ serviceResponseInformationBuilder.setInstanceId(siid);
+ serviceResponseInformationBuilder.setObjectPath(serviceObjectPath);
+ responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build());
+
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e);
+ responseBuilder.setResponseCode("500");
+ responseBuilder.setResponseMessage(e.toString());
+ responseBuilder.setAckFinalIndicator("Y");
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+ RpcResult<VnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Update succeeded
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ if (errorMessage != null)
+ {
+ responseBuilder.setResponseMessage(errorMessage);
+ }
+ log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] ");
+ log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+
+ RpcResult<VnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return success
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
+ public Future<RpcResult<VfModuleTopologyOperationOutput>> vfModuleTopologyOperation(
+ VfModuleTopologyOperationInput input) {
+
+ final String SVC_OPERATION = "vf-module-topology-operation";
+ ServiceData serviceData = null;
+ ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
+ Properties parms = new Properties();
+
+ log.info( SVC_OPERATION +" called." );
+ // create a new response object
+ VfModuleTopologyOperationOutputBuilder responseBuilder = new VfModuleTopologyOperationOutputBuilder();
+
+ if(input == null ||
+ input.getServiceInformation() == null ||
+ input.getServiceInformation().getServiceInstanceId() == null ||
+ input.getServiceInformation().getServiceInstanceId().length() == 0)
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because of null or empty service-instance-id");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<VfModuleTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ if(input.getVnfInformation() == null ||
+ input.getVnfInformation().getVnfId() == null ||
+ input.getVnfInformation().getVnfId().length() == 0)
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because of null or empty vnf-id");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, null or empty vnf-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<VfModuleTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ if(input.getVfModuleInformation() == null ||
+ input.getVfModuleInformation().getVfModuleId() == null ||
+ input.getVfModuleInformation().getVfModuleId().length() == 0)
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because of null or empty vf-module-id");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, vf-module-id is null or empty");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<VfModuleTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Grab the service instance ID from the input buffer
+ String siid = input.getServiceInformation().getServiceInstanceId();
+
+ if (input.getSdncRequestHeader() != null) {
+ responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ }
+
+ /*
+ String preload_name = null;
+ String preload_type = null;
+
+ preload_name = input.getVfModuleRequestInput().getVfModuleName();
+
+ if(input.getVfModuleInformation().getVfModuleType() != null &&
+ input.getVfModuleInformation().getVfModuleType().length() != 0) {
+ preload_type = input.getVfModuleInformation().getVfModuleType();
+ }
+
+ PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder();
+ if (preload_name != null && preload_type != null) {
+ getPreloadData(preload_name, preload_type, preloadDataBuilder);
+ }
+ else {
+ log.debug("vf-module-name and vf-module-type not present in the request.");
+ }
+ */
+
+ ServiceDataBuilder serviceDataBuilder = new ServiceDataBuilder();
+ getServiceData(siid,serviceDataBuilder);
+
+ ServiceDataBuilder operDataBuilder = new ServiceDataBuilder();
+ getServiceData(siid,operDataBuilder, LogicalDatastoreType.OPERATIONAL );
+
+ // Set the serviceStatus based on input
+ setServiceStatus(serviceStatusBuilder, input.getSdncRequestHeader());
+ setServiceStatus(serviceStatusBuilder, input.getRequestInformation());
+
+ //
+ // setup a service-data object builder
+ // ACTION vnf-topology-operation
+ // INPUT:
+ // USES sdnc-request-header;
+ // USES request-information;
+ // USES service-information;
+ // USES vnf-request-information
+ // OUTPUT:
+ // USES vnf-topology-response-body;
+ // USES vnf-information
+ // USES service-information
+ //
+ // container service-data
+ // uses vnf-configuration-information;
+ // uses oper-status;
+
+ log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input);
+ VfModuleTopologyOperationInputBuilder inputBuilder = new VfModuleTopologyOperationInputBuilder(input);
+ GenericResourceApiUtil.toProperties(parms, inputBuilder.build());
+
+ log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+siid+"] operational-data: " + operDataBuilder.build());
+ GenericResourceApiUtil.toProperties(parms, "operational-data", operDataBuilder);
+
+ /*
+ log.info("Adding CONFIG data for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] preload-data: " +preloadDataBuilder.build());
+ GenericResourceApiUtil.toProperties(parms, "preload-data", preloadDataBuilder);
+ */
+
+ // Call SLI sync method
+ // Get SvcLogicService reference
+
+ GenericResourceApiSvcLogicServiceClient svcLogicClient = new GenericResourceApiSvcLogicServiceClient();
+ Properties respProps = null;
+
+ String errorCode = "200";
+ String errorMessage = null;
+ String ackFinal = "Y";
+ String serviceObjectPath = null;
+
+ try
+ {
+ if (svcLogicClient.hasGraph(appName, SVC_OPERATION , null, "sync"))
+ {
+
+ try
+ {
+ respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception executing service logic for "+ SVC_OPERATION, e);
+ errorMessage = e.getMessage();
+ errorCode = "500";
+ }
+ } else {
+ errorMessage = "No service logic active for "+ appName +": '" + SVC_OPERATION + "'";
+ errorCode = "503";
+ }
+ }
+ catch (Exception e)
+ {
+ errorCode = "500";
+ errorMessage = e.getMessage();
+ log.error("Caught exception looking for service logic", e);
+ }
+
+ if (respProps != null)
+ {
+ errorCode = respProps.getProperty("error-code");
+ errorMessage = respProps.getProperty("error-message");
+ ackFinal = respProps.getProperty("ack-final", "Y");
+ serviceObjectPath = respProps.getProperty("vf-module-object-path");
+ }
+
+ setServiceStatus(serviceStatusBuilder,errorCode, errorMessage, ackFinal);
+ serviceStatusBuilder.setRequestStatus(RequestStatus.Synccomplete);
+ serviceStatusBuilder.setRpcName(SVC_OPERATION);
+
+ if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) {
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setResponseMessage(errorMessage);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+
+ ServiceBuilder serviceBuilder = new ServiceBuilder();
+ serviceBuilder.setServiceInstanceId(siid);
+ serviceBuilder.setServiceStatus(serviceStatusBuilder.build());
+ try {
+ SaveService (serviceBuilder.build(), true,LogicalDatastoreType.CONFIGURATION);
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e);
+ }
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+ RpcResult<VfModuleTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Got success from SLI
+ try {
+ serviceData = serviceDataBuilder.build();
+ log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData);
+
+ // service object
+ ServiceBuilder serviceBuilder = new ServiceBuilder();
+ serviceBuilder.setServiceData(serviceData);
+ //serviceBuilder.setServiceInstanceId(serviceData.getServiceTopology().getServiceTopologyIdentifier().getServiceInstanceId());
+ serviceBuilder.setServiceInstanceId(siid);
+ serviceBuilder.setServiceStatus(serviceStatusBuilder.build());
+ SaveService (serviceBuilder.build(), false,LogicalDatastoreType.CONFIGURATION);
+
+ if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null)
+ {
+ // Only update operational tree on activate or delete
+ if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Unassign) ||
+ input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate))
+ {
+ log.info("Updating OPERATIONAL tree.");
+ SaveService (serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
+ }
+ }
+
+ ServiceResponseInformationBuilder serviceResponseInformationBuilder = new ServiceResponseInformationBuilder();
+ serviceResponseInformationBuilder.setInstanceId(siid);
+ serviceResponseInformationBuilder.setObjectPath(serviceObjectPath);
+ responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build());
+
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e);
+ responseBuilder.setResponseCode("500");
+ responseBuilder.setResponseMessage(e.toString());
+ responseBuilder.setAckFinalIndicator("Y");
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+ RpcResult<VfModuleTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Update succeeded
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ if (errorMessage != null)
+ {
+ responseBuilder.setResponseMessage(errorMessage);
+ }
+ log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] ");
+ log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+
+ RpcResult<VfModuleTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return success
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
+ public Future<RpcResult<NetworkTopologyOperationOutput>> networkTopologyOperation(
+ NetworkTopologyOperationInput input) {
+
+ final String SVC_OPERATION = "network-topology-operation";
+ ServiceData serviceData = null;
+ ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
+ Properties parms = new Properties();
+
+ log.info( SVC_OPERATION +" called." );
+ // create a new response object
+ NetworkTopologyOperationOutputBuilder responseBuilder = new NetworkTopologyOperationOutputBuilder();
+
+ if(input == null ||
+ input.getServiceInformation() == null ||
+ input.getServiceInformation().getServiceInstanceId() == null ||
+ input.getServiceInformation().getServiceInstanceId().length() == 0)
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because of null or empty service-instance-id");
+ responseBuilder.setResponseCode("404");
+ responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<NetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ String siid = input.getServiceInformation().getServiceInstanceId();
+
+ // Get the service-instance service data from MD-SAL
+ ServiceDataBuilder serviceDataBuilder = new ServiceDataBuilder();
+ getServiceData(siid,serviceDataBuilder);
+
+ if (input.getSdncRequestHeader() != null) {
+ responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ }
+
+ ServiceData sd = serviceDataBuilder.build();
+ if (sd == null || sd.getServiceLevelOperStatus() == null)
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because the service-instance does not have any service data in SDNC");
+ responseBuilder.setResponseCode("404");
+ responseBuilder.setResponseMessage("invalid input: the service-instance does not have any service data in SDNC");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<NetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+
+ /*
+ //String preload_name = null;
+ //String preload_type = null;
+ // If both network-name and network-type are present in request, get the preload network from MD-SAL
+ if (input.getNetworkRequestInput() != null &&
+ input.getNetworkRequestInput().getNetworkName() != null &&
+ input.getNetworkRequestInput().getNetworkName().length() != 0) {
+ preload_name = input.getNetworkRequestInput().getNetworkName();
+ }
+ if (input.getNetworkInformation() != null &&
+ input.getNetworkInformation().getNetworkType() != null &&
+ input.getNetworkInformation().getNetworkType().length() != 0) {
+ preload_type = input.getNetworkInformation().getNetworkType();
+ }
+
+ PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder();
+ if (preload_name != null && preload_type != null) {
+ getPreloadData(preload_name, preload_type, preloadDataBuilder);
+ }
+ else {
+ log.debug("network-name and network-type not present in request");
+ }
+ */
+
+ log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input);
+ NetworkTopologyOperationInputBuilder inputBuilder = new NetworkTopologyOperationInputBuilder(input);
+ GenericResourceApiUtil.toProperties(parms, inputBuilder.build());
+
+ // Call SLI sync method
+ // Get SvcLogicService reference
+
+ GenericResourceApiSvcLogicServiceClient svcLogicClient = new GenericResourceApiSvcLogicServiceClient();
+ Properties respProps = null;
+
+ String errorCode = "200";
+ String errorMessage = null;
+ String ackFinal = "Y";
+ String networkId = "error";
+ String serviceObjectPath = null;
+ String networkObjectPath = null;
+
+ try
+ {
+ if (svcLogicClient.hasGraph(appName, SVC_OPERATION , null, "sync"))
+ {
+
+ try
+ {
+ respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception executing service logic for "+ SVC_OPERATION, e);
+ errorMessage = e.getMessage();
+ errorCode = "500";
+ }
+ } else {
+ errorMessage = "No service logic active for "+ appName +": '" + SVC_OPERATION + "'";
+ errorCode = "503";
+ }
+ }
+ catch (Exception e)
+ {
+ errorCode = "500";
+ errorMessage = e.getMessage();
+ log.error("Caught exception looking for service logic", e);
+ }
+
+
+ if (respProps != null)
+ {
+ errorCode = respProps.getProperty("error-code");
+ errorMessage = respProps.getProperty("error-message");
+ ackFinal = respProps.getProperty("ack-final", "Y");
+ networkId = respProps.getProperty("networkId");
+ serviceObjectPath = respProps.getProperty("service-object-path");
+ networkObjectPath = respProps.getProperty("network-object-path");
+ }
+
+ if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) {
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setResponseMessage(errorMessage);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+
+ RpcResult<NetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Got success from SLI
+ try {
+
+ serviceData = serviceDataBuilder.build();
+ log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData);
+
+ // service object
+ ServiceBuilder serviceBuilder = new ServiceBuilder();
+ serviceBuilder.setServiceData(serviceData);
+ serviceBuilder.setServiceInstanceId(siid);
+ serviceBuilder.setServiceStatus(serviceStatusBuilder.build());
+ SaveService (serviceBuilder.build(), false,LogicalDatastoreType.CONFIGURATION);
+
+ if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null)
+ {
+ // Only update operational tree on Activate
+ if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate))
+ {
+ log.info("Updating OPERATIONAL tree.");
+ SaveService (serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
+ }
+ }
+
+ NetworkResponseInformationBuilder networkResponseInformationBuilder = new NetworkResponseInformationBuilder();
+ networkResponseInformationBuilder.setInstanceId(networkId);
+ networkResponseInformationBuilder.setObjectPath(networkObjectPath);
+ responseBuilder.setNetworkResponseInformation(networkResponseInformationBuilder.build());
+
+ ServiceResponseInformationBuilder serviceResponseInformationBuilder = new ServiceResponseInformationBuilder();
+ serviceResponseInformationBuilder.setInstanceId(siid);
+ serviceResponseInformationBuilder.setObjectPath(serviceObjectPath);
+ responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build());
+
+ } catch (IllegalStateException e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e);
+ responseBuilder.setResponseCode("500");
+ responseBuilder.setResponseMessage(e.toString());
+ responseBuilder.setAckFinalIndicator("Y");
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+ RpcResult<NetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Update succeeded
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ if (errorMessage != null)
+ {
+ responseBuilder.setResponseMessage(errorMessage);
+ }
+ log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] ");
+ log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+
+ RpcResult<NetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
+ public Future<RpcResult<ContrailRouteTopologyOperationOutput>> contrailRouteTopologyOperation(
+ ContrailRouteTopologyOperationInput input) {
+
+ final String SVC_OPERATION = "contrail-route-topology-operation";
+ ServiceData serviceData = null;
+ ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
+ Properties parms = new Properties();
+
+ log.info( SVC_OPERATION +" called." );
+ // create a new response object
+ ContrailRouteTopologyOperationOutputBuilder responseBuilder = new ContrailRouteTopologyOperationOutputBuilder();
+
+ if(input == null ||
+ input.getServiceInformation() == null ||
+ input.getServiceInformation().getServiceInstanceId() == null ||
+ input.getServiceInformation().getServiceInstanceId().length() == 0)
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because of null or empty service-instance-id");
+ responseBuilder.setResponseCode("404");
+ responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<ContrailRouteTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<ContrailRouteTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ String siid = input.getServiceInformation().getServiceInstanceId();
+
+ // Get the service-instance service data from MD-SAL
+ ServiceDataBuilder serviceDataBuilder = new ServiceDataBuilder();
+ getServiceData(siid,serviceDataBuilder);
+
+ if (input.getSdncRequestHeader() != null) {
+ responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ }
+
+ ServiceData sd = serviceDataBuilder.build();
+ if (sd == null || sd.getServiceLevelOperStatus() == null)
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because the service-instance does not have any service data in SDNC");
+ responseBuilder.setResponseCode("404");
+ responseBuilder.setResponseMessage("invalid input: the service-instance does not have any service data in SDNC");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<ContrailRouteTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<ContrailRouteTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input);
+ ContrailRouteTopologyOperationInputBuilder inputBuilder = new ContrailRouteTopologyOperationInputBuilder(input);
+ GenericResourceApiUtil.toProperties(parms, inputBuilder.build());
+
+ // Call SLI sync method
+ // Get SvcLogicService reference
+
+ GenericResourceApiSvcLogicServiceClient svcLogicClient = new GenericResourceApiSvcLogicServiceClient();
+ Properties respProps = null;
+
+ String errorCode = "200";
+ String errorMessage = null;
+ String ackFinal = "Y";
+ String allottedResourceId = "error";
+ String serviceObjectPath = null;
+ String contrailRouteObjectPath = null;
+
+ try
+ {
+ if (svcLogicClient.hasGraph(appName, SVC_OPERATION , null, "sync"))
+ {
+
+ try
+ {
+ respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception executing service logic for "+ SVC_OPERATION, e);
+ errorMessage = e.getMessage();
+ errorCode = "500";
+ }
+ } else {
+ errorMessage = "No service logic active for "+ appName +": '" + SVC_OPERATION + "'";
+ errorCode = "503";
+ }
+ }
+ catch (Exception e)
+ {
+ errorCode = "500";
+ errorMessage = e.getMessage();
+ log.error("Caught exception looking for service logic", e);
+ }
+
+
+ if (respProps != null)
+ {
+ errorCode = respProps.getProperty("error-code");
+ errorMessage = respProps.getProperty("error-message");
+ ackFinal = respProps.getProperty("ack-final", "Y");
+ allottedResourceId = respProps.getProperty("allotted-resource-id");
+ serviceObjectPath = respProps.getProperty("service-object-path");
+ contrailRouteObjectPath = respProps.getProperty("contrail-route-object-path");
+ }
+
+ if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) {
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setResponseMessage(errorMessage);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+
+ RpcResult<ContrailRouteTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<ContrailRouteTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Got success from SLI
+ try {
+
+ serviceData = serviceDataBuilder.build();
+ log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData);
+
+ // service object
+ ServiceBuilder serviceBuilder = new ServiceBuilder();
+ serviceBuilder.setServiceData(serviceData);
+ serviceBuilder.setServiceInstanceId(siid);
+ serviceBuilder.setServiceStatus(serviceStatusBuilder.build());
+ SaveService (serviceBuilder.build(), false,LogicalDatastoreType.CONFIGURATION);
+
+ if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null)
+ {
+ // Only update operational tree on activate or delete
+ if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Unassign) ||
+ input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate))
+ {
+ log.info("Updating OPERATIONAL tree.");
+ SaveService (serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
+ }
+ }
+
+ ContrailRouteResponseInformationBuilder contrailRouteResponseInformationBuilder = new ContrailRouteResponseInformationBuilder();
+ contrailRouteResponseInformationBuilder.setInstanceId(allottedResourceId);
+ contrailRouteResponseInformationBuilder.setObjectPath(contrailRouteObjectPath);
+ responseBuilder.setContrailRouteResponseInformation(contrailRouteResponseInformationBuilder.build());
+
+ ServiceResponseInformationBuilder serviceResponseInformationBuilder = new ServiceResponseInformationBuilder();
+ serviceResponseInformationBuilder.setInstanceId(siid);
+ serviceResponseInformationBuilder.setObjectPath(serviceObjectPath);
+ responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build());
+
+ } catch (IllegalStateException e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e);
+ responseBuilder.setResponseCode("500");
+ responseBuilder.setResponseMessage(e.toString());
+ responseBuilder.setAckFinalIndicator("Y");
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+ RpcResult<ContrailRouteTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<ContrailRouteTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Update succeeded
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ if (errorMessage != null)
+ {
+ responseBuilder.setResponseMessage(errorMessage);
+ }
+ log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] ");
+ log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+
+ RpcResult<ContrailRouteTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<ContrailRouteTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
+ public Future<RpcResult<SecurityZoneTopologyOperationOutput>> securityZoneTopologyOperation(
+ SecurityZoneTopologyOperationInput input) {
+
+ final String SVC_OPERATION = "security-zone-topology-operation";
+ ServiceData serviceData = null;
+ ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
+ Properties parms = new Properties();
+
+ log.info( SVC_OPERATION +" called." );
+ // create a new response object
+ SecurityZoneTopologyOperationOutputBuilder responseBuilder = new SecurityZoneTopologyOperationOutputBuilder();
+
+ if(input == null ||
+ input.getServiceInformation() == null ||
+ input.getServiceInformation().getServiceInstanceId() == null ||
+ input.getServiceInformation().getServiceInstanceId().length() == 0)
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because of null or empty service-instance-id");
+ responseBuilder.setResponseCode("404");
+ responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<SecurityZoneTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<SecurityZoneTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ String siid = input.getServiceInformation().getServiceInstanceId();
+
+ // Get the service-instance service data from MD-SAL
+ ServiceDataBuilder serviceDataBuilder = new ServiceDataBuilder();
+ getServiceData(siid,serviceDataBuilder);
+
+ if (input.getSdncRequestHeader() != null) {
+ responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ }
+
+ ServiceData sd = serviceDataBuilder.build();
+ if (sd == null || sd.getServiceLevelOperStatus() == null)
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because the service-instance does not have any service data in SDNC");
+ responseBuilder.setResponseCode("404");
+ responseBuilder.setResponseMessage("invalid input: the service-instance does not have any service data in SDNC");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<SecurityZoneTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<SecurityZoneTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input);
+ SecurityZoneTopologyOperationInputBuilder inputBuilder = new SecurityZoneTopologyOperationInputBuilder(input);
+ GenericResourceApiUtil.toProperties(parms, inputBuilder.build());
+
+ // Call SLI sync method
+ // Get SvcLogicService reference
+
+ GenericResourceApiSvcLogicServiceClient svcLogicClient = new GenericResourceApiSvcLogicServiceClient();
+ Properties respProps = null;
+
+ String errorCode = "200";
+ String errorMessage = null;
+ String ackFinal = "Y";
+ String allottedResourceId = "error";
+ String serviceObjectPath = null;
+ String securityZoneObjectPath = null;
+
+ try
+ {
+ if (svcLogicClient.hasGraph(appName, SVC_OPERATION , null, "sync"))
+ {
+
+ try
+ {
+ respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception executing service logic for "+ SVC_OPERATION, e);
+ errorMessage = e.getMessage();
+ errorCode = "500";
+ }
+ } else {
+ errorMessage = "No service logic active for "+ appName +": '" + SVC_OPERATION + "'";
+ errorCode = "503";
+ }
+ }
+ catch (Exception e)
+ {
+ errorCode = "500";
+ errorMessage = e.getMessage();
+ log.error("Caught exception looking for service logic", e);
+ }
+
+
+ if (respProps != null)
+ {
+ errorCode = respProps.getProperty("error-code");
+ errorMessage = respProps.getProperty("error-message");
+ ackFinal = respProps.getProperty("ack-final", "Y");
+ allottedResourceId = respProps.getProperty("allotted-resource-id");
+ serviceObjectPath = respProps.getProperty("service-object-path");
+ securityZoneObjectPath = respProps.getProperty("security-zone-object-path");
+ }
+
+ if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) {
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setResponseMessage(errorMessage);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+
+ RpcResult<SecurityZoneTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<SecurityZoneTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Got success from SLI
+ try {
+
+ serviceData = serviceDataBuilder.build();
+ log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData);
+
+ // service object
+ ServiceBuilder serviceBuilder = new ServiceBuilder();
+ serviceBuilder.setServiceData(serviceData);
+ serviceBuilder.setServiceInstanceId(siid);
+ serviceBuilder.setServiceStatus(serviceStatusBuilder.build());
+ SaveService (serviceBuilder.build(), false,LogicalDatastoreType.CONFIGURATION);
+
+ if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null)
+ {
+ // Only update operational tree on activate or delete
+ if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Unassign) ||
+ input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate))
+ {
+ log.info("Updating OPERATIONAL tree.");
+ SaveService (serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
+ }
+ }
+
+ SecurityZoneResponseInformationBuilder securityZoneResponseInformationBuilder = new SecurityZoneResponseInformationBuilder();
+ securityZoneResponseInformationBuilder.setInstanceId(allottedResourceId);
+ securityZoneResponseInformationBuilder.setObjectPath(securityZoneObjectPath);
+ responseBuilder.setSecurityZoneResponseInformation(securityZoneResponseInformationBuilder.build());
+
+ ServiceResponseInformationBuilder serviceResponseInformationBuilder = new ServiceResponseInformationBuilder();
+ serviceResponseInformationBuilder.setInstanceId(siid);
+ serviceResponseInformationBuilder.setObjectPath(serviceObjectPath);
+ responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build());
+
+ } catch (IllegalStateException e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e);
+ responseBuilder.setResponseCode("500");
+ responseBuilder.setResponseMessage(e.toString());
+ responseBuilder.setAckFinalIndicator("Y");
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+ RpcResult<SecurityZoneTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<SecurityZoneTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Update succeeded
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ if (errorMessage != null)
+ {
+ responseBuilder.setResponseMessage(errorMessage);
+ }
+ log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] ");
+ log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+
+ RpcResult<SecurityZoneTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<SecurityZoneTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
+ public Future<RpcResult<PreloadVnfTopologyOperationOutput>> preloadVnfTopologyOperation(
+ PreloadVnfTopologyOperationInput input) {
+
+ final String SVC_OPERATION = "preload-vnf-topology-operation";
+ PreloadData preloadData = null;
+ Properties parms = new Properties();
+
+ log.info( SVC_OPERATION +" called." );
+ // create a new response object
+ PreloadVnfTopologyOperationOutputBuilder responseBuilder = new PreloadVnfTopologyOperationOutputBuilder();
+
+ // Result from savePreloadData
+ final SettableFuture<RpcResult<Void>> futureResult = SettableFuture.create();
+
+ if(input == null || input.getVnfTopologyInformation() == null ||
+ input.getVnfTopologyInformation().getVnfTopologyIdentifier() == null) {
+ log.debug("exiting " +SVC_OPERATION+ " because of null input");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input: input is null");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Grab the name and type from the input buffer
+ String preload_name = input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfName();
+ String preload_type = input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfType();
+
+ // Make sure we have a preload_name and preload_type
+ if(preload_name == null || preload_name.length() == 0 || preload_type == null || preload_type.length() == 0 ) {
+ log.debug("exiting "+ SVC_OPERATION + " vnf-name or vnf-type is null or empty");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input: vnf-name or vnf-type is null or empty");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ if (input.getSdncRequestHeader() != null) {
+ responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ }
+
+ PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder();
+ getPreloadData(preload_name, preload_type, preloadDataBuilder);
+
+ PreloadDataBuilder operDataBuilder = new PreloadDataBuilder();
+ getPreloadData(preload_name, preload_type, operDataBuilder, LogicalDatastoreType.OPERATIONAL );
+
+ // setup a preload-data object builder
+ // ACTION preload-vnf-topology-operation
+ // INPUT:
+ // USES sdnc-request-header;
+ // USES request-information;
+ // uses vnf-topology-information;
+ // OUTPUT:
+ // USES vnf-topology-response-body;
+ //
+ // container preload-data
+ // uses vnf-topology-information;
+ // uses network-topology-information;
+ // uses oper-status;
+
+ log.info("Adding INPUT data for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] input: " + input);
+ PreloadVnfTopologyOperationInputBuilder inputBuilder = new PreloadVnfTopologyOperationInputBuilder(input);
+ GenericResourceApiUtil.toProperties(parms, inputBuilder.build());
+ log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+preload_name+","+preload_type +"] operational-data: " + operDataBuilder.build());
+ GenericResourceApiUtil.toProperties(parms, "operational-data", operDataBuilder);
+
+ // Call SLI sync method
+ // Get SvcLogicService reference
+
+ GenericResourceApiSvcLogicServiceClient svcLogicClient = new GenericResourceApiSvcLogicServiceClient();
+ Properties respProps = null;
+
+ String errorCode = "200";
+ String errorMessage = null;
+ String ackFinal = "Y";
+
+
+ try
+ {
+ if (svcLogicClient.hasGraph(appName, SVC_OPERATION , null, "sync"))
+ {
+
+ try
+ {
+ respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", preloadDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception executing service logic for "+ SVC_OPERATION, e);
+ errorMessage = e.getMessage();
+ errorCode = "500";
+ }
+ } else {
+ errorMessage = "No service logic active for "+ appName + ": '" + SVC_OPERATION + "'";
+ errorCode = "503";
+ }
+ }
+ catch (Exception e)
+ {
+ errorCode = "500";
+ errorMessage = e.getMessage();
+ log.error("Caught exception looking for service logic", e);
+ }
+
+
+ if (respProps != null)
+ {
+ errorCode = respProps.getProperty("error-code");
+ errorMessage = respProps.getProperty("error-message");
+ ackFinal = respProps.getProperty("ack-final", "Y");
+ // internalError = respProps.getProperty("internal-error", "false");
+ }
+
+ if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) {
+
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setResponseMessage(errorMessage);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+
+ VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder();
+ preloadVnfListBuilder.setVnfName(preload_name);
+ preloadVnfListBuilder.setVnfType(preload_type);
+ preloadVnfListBuilder.setPreloadData(preloadDataBuilder.build());
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] error code: '" + errorCode + "', Reason: '" + errorMessage + "'");
+ try {
+ SavePreloadList (preloadVnfListBuilder.build(), true,LogicalDatastoreType.CONFIGURATION);
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e);
+ }
+ log.debug("Sending Success rpc result due to external error");
+ RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Got success from SLI
+ try {
+ preloadData = preloadDataBuilder.build();
+ log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] preloadData: " + preloadData);
+ // svc-configuration-list
+ VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder();
+ preloadVnfListBuilder.setVnfName(preload_name);
+ preloadVnfListBuilder.setVnfType(preload_type);
+ preloadVnfListBuilder.setPreloadData(preloadData);
+
+ // merge flag sets to false to allow it to be overwritten (not appended)
+ SavePreloadList (preloadVnfListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION);
+ log.info("Updating OPERATIONAL tree.");
+ SavePreloadList (preloadVnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e);
+ responseBuilder.setResponseCode("500");
+ responseBuilder.setResponseMessage(e.toString());
+ responseBuilder.setAckFinalIndicator("Y");
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build());
+ RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVnfTopologyOperationOutput> status(false).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Update succeeded
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ if (errorMessage != null)
+ {
+ responseBuilder.setResponseMessage(errorMessage);
+ }
+ log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] ");
+ log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build());
+
+ RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+
+ @Override
+ public Future<RpcResult<PreloadNetworkTopologyOperationOutput>> preloadNetworkTopologyOperation(
+ PreloadNetworkTopologyOperationInput input) {
+
+ final String SVC_OPERATION = "preload-network-topology-operation";
+ PreloadData preloadData = null;
+ Properties parms = new Properties();
+
+ log.info( SVC_OPERATION +" called." );
+ // create a new response object
+ PreloadNetworkTopologyOperationOutputBuilder responseBuilder = new PreloadNetworkTopologyOperationOutputBuilder();
+
+ // Result from savePreloadData
+ final SettableFuture<RpcResult<Void>> futureResult = SettableFuture.create();
+
+ if(input == null || input.getNetworkTopologyInformation() == null ||
+ input.getNetworkTopologyInformation().getNetworkTopologyIdentifier() == null) {
+
+ log.debug("exiting " +SVC_OPERATION+ " because of null input");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("input is null");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Grab the name and type from the input buffer
+ String preload_name = input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkName();
+ String preload_type = input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkType();
+
+ // Make sure we have a preload_name and preload_type
+ if(preload_name == null || preload_name.length() == 0 || preload_type == null || preload_type.length() == 0 ) {
+ log.debug("exiting "+SVC_OPERATION+" because of invalid preload-name");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("input, invalid preload-name");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ if (input.getSdncRequestHeader() != null) {
+ responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ }
+
+ PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder();
+ getPreloadData(preload_name, preload_type, preloadDataBuilder);
+
+ PreloadDataBuilder operDataBuilder = new PreloadDataBuilder();
+ getPreloadData(preload_name, preload_type, operDataBuilder, LogicalDatastoreType.OPERATIONAL );
+
+ //
+ // setup a preload-data object builder
+ // ACTION preload-network-topology-operation
+ // INPUT:
+ // USES sdnc-request-header;
+ // USES request-information;
+ // uses network-topology-information;
+ // OUTPUT:
+ // USES vnf-topology-response-body;
+ //
+ // container preload-data
+ // uses vnf-topology-information;
+ // uses network-topology-information;
+ // uses oper-status;
+
+
+ log.info("Adding INPUT data for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] input: " + input);
+ PreloadNetworkTopologyOperationInputBuilder inputBuilder = new PreloadNetworkTopologyOperationInputBuilder(input);
+ GenericResourceApiUtil.toProperties(parms, inputBuilder.build());
+ log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+preload_name+","+preload_type +"] operational-data: " + operDataBuilder.build());
+ GenericResourceApiUtil.toProperties(parms, "operational-data", operDataBuilder);
+
+ // Call SLI sync method
+ // Get SvcLogicService reference
+
+ GenericResourceApiSvcLogicServiceClient svcLogicClient = new GenericResourceApiSvcLogicServiceClient();
+ Properties respProps = null;
+
+ String errorCode = "200";
+ String errorMessage = null;
+ String ackFinal = "Y";
+
+
+ try
+ {
+ if (svcLogicClient.hasGraph(appName, SVC_OPERATION , null, "sync"))
+ {
+
+ try
+ {
+ respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", preloadDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception executing service logic for "+ SVC_OPERATION, e);
+ errorMessage = e.getMessage();
+ errorCode = "500";
+ }
+ } else {
+ errorMessage = "No service logic active for "+ appName +": '" + SVC_OPERATION + "'";
+ errorCode = "503";
+ }
+ }
+ catch (Exception e)
+ {
+ errorCode = "500";
+ errorMessage = e.getMessage();
+ log.error("Caught exception looking for service logic", e);
+ }
+
+
+ if (respProps != null)
+ {
+ errorCode = respProps.getProperty("error-code");
+ errorMessage = respProps.getProperty("error-message");
+ ackFinal = respProps.getProperty("ack-final", "Y");
+ // internalError = respProps.getProperty("internal-error", "false");
+ }
+
+ if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) {
+
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setResponseMessage(errorMessage);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+
+ VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder();
+ preloadVnfListBuilder.setVnfName(preload_name);
+ preloadVnfListBuilder.setVnfType(preload_type);
+ preloadVnfListBuilder.setPreloadData(preloadDataBuilder.build());
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] error code: '" + errorCode + "', Reason: '" + errorMessage + "'");
+ try {
+ SavePreloadList (preloadVnfListBuilder.build(),true,LogicalDatastoreType.CONFIGURATION);
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e);
+
+ }
+ log.debug("Sending Success rpc result due to external error");
+ RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Got success from SLI
+ try {
+ preloadData = preloadDataBuilder.build();
+ log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] preloadData: " + preloadData);
+ // svc-configuration-list
+ VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder();
+ preloadVnfListBuilder.setVnfName(preload_name);
+ preloadVnfListBuilder.setVnfType(preload_type);
+ preloadVnfListBuilder.setPreloadData(preloadData);
+
+ // merge flag sets to false to allow it to be overwritten (not appended)
+ SavePreloadList (preloadVnfListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION);
+ log.info("Updating OPERATIONAL tree.");
+ SavePreloadList (preloadVnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e);
+ responseBuilder.setResponseCode("500");
+ responseBuilder.setResponseMessage(e.toString());
+ responseBuilder.setAckFinalIndicator("Y");
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build());
+ RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(false).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Update succeeded
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ if (errorMessage != null)
+ {
+ responseBuilder.setResponseMessage(errorMessage);
+ }
+ log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] ");
+ log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build());
+
+ RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+}
diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClient.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClient.java
new file mode 100644
index 00000000..04b71e79
--- /dev/null
+++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClient.java
@@ -0,0 +1,144 @@
+package org.onap.sdnc.northbound;
+
+import java.util.Properties;
+
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.data.PreloadDataBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.ServiceDataBuilder;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GenericResourceApiSvcLogicServiceClient {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(GenericResourceApiSvcLogicServiceClient.class);
+
+ private SvcLogicService svcLogic = null;
+
+ public GenericResourceApiSvcLogicServiceClient()
+ {
+ BundleContext bctx = FrameworkUtil.getBundle(SvcLogicService.class).getBundleContext();
+
+ // Get SvcLogicService reference
+ ServiceReference sref = bctx.getServiceReference(SvcLogicService.NAME);
+ if (sref != null)
+ {
+ svcLogic = (SvcLogicService) bctx.getService(sref);
+
+ }
+ else
+ {
+ LOG.warn("Cannot find service reference for "+SvcLogicService.NAME);
+
+ }
+ }
+
+ public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException
+ {
+ return(svcLogic.hasGraph(module, rpc, version, mode));
+ }
+
+ public Properties execute(String module, String rpc, String version, String mode, ServiceDataBuilder serviceData)
+ throws SvcLogicException {
+
+ Properties parms = new Properties();
+
+ return execute(module,rpc,version, mode,serviceData,parms);
+ }
+
+ public Properties execute(String module, String rpc, String version, String mode, PreloadDataBuilder serviceData)
+ throws SvcLogicException {
+
+ Properties parms = new Properties();
+
+ return execute(module,rpc,version, mode,serviceData,parms);
+ }
+
+
+ public Properties execute(String module, String rpc, String version, String mode, ServiceDataBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+
+ parms = GenericResourceApiUtil.toProperties(parms, serviceData);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters passed to SLI");
+
+ for (Object key : parms.keySet()) {
+ String parmName = (String) key;
+ String parmValue = parms.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+
+ Properties respProps = svcLogic.execute(module, rpc, version, mode, parms);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters returned by SLI");
+
+ for (Object key : respProps.keySet()) {
+ String parmName = (String) key;
+ String parmValue = respProps.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+ if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
+ return (respProps);
+ }
+
+ GenericResourceApiUtil.toBuilder(respProps, serviceData);
+
+ return (respProps);
+ }
+
+
+ public Properties execute(String module, String rpc, String version, String mode, PreloadDataBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+
+ parms = GenericResourceApiUtil.toProperties(parms, serviceData);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters passed to SLI");
+
+ for (Object key : parms.keySet()) {
+ String parmName = (String) key;
+ String parmValue = parms.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+
+ Properties respProps = svcLogic.execute(module, rpc, version, mode, parms);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters returned by SLI");
+
+ for (Object key : respProps.keySet()) {
+ String parmName = (String) key;
+ String parmValue = respProps.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+ if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
+ return (respProps);
+ }
+
+ GenericResourceApiUtil.toBuilder(respProps, serviceData);
+
+ return (respProps);
+ }
+}
diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java
new file mode 100644
index 00000000..56a2fae7
--- /dev/null
+++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java
@@ -0,0 +1,280 @@
+package org.onap.sdnc.northbound;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GenericResourceApiUtil extends MdsalHelper {
+
+ private static final Logger LOG = LoggerFactory.getLogger(GenericResourceApiUtil.class);
+
+ public static final String PROPERTIES_FILE="/opt/bvc/controller/configuration/generic-resource-api.properties";
+ private static Properties properties;
+
+
+ public static void loadProperties() {
+
+ File file = new File(PROPERTIES_FILE);
+ properties = new Properties();
+ InputStream input = null;
+ if (file.isFile() && file.canRead()) {
+ try {
+ input = new FileInputStream(file);
+ properties.load(input);
+ LOG.info("Loaded properties from " + PROPERTIES_FILE );
+ setProperties(properties);
+ } catch (Exception e) {
+ LOG.error("Failed to load properties " + PROPERTIES_FILE +"\n",e);
+ } finally {
+ if (input != null) {
+ try {
+ input.close();
+ } catch (IOException e) {
+ LOG.error("Failed to close properties file " + PROPERTIES_FILE +"\n",e);
+ }
+ }
+ }
+ }
+ }
+
+ static {
+
+ // Trick class loader into loading builders. Some of
+ // these will be needed later by Reflection classes, but need
+ // to explicitly "new" them here to get class loader to load them.
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ecomp.model.information.EcompModelInformationBuilder u1 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ecomp.model.information.EcompModelInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.assignments.NetworkAssignmentsBuilder u2 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.assignments.NetworkAssignmentsBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.information.NetworkInformationBuilder u3 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.information.NetworkInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.level.oper.status.NetworkLevelOperStatusBuilder u4 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.level.oper.status.NetworkLevelOperStatusBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.parameters.NetworkParametersBuilder u5 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.parameters.NetworkParametersBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.parameters.network.parameters.NetworkParameterBuilder u6 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.parameters.network.parameters.NetworkParameterBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.policy.NetworkPolicyBuilder u7 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.policy.NetworkPolicyBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.request.input.NetworkRequestInputBuilder u8 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.request.input.NetworkRequestInputBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.request.input.network.request.input.NetworkInputParametersBuilder u9 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.request.input.network.request.input.NetworkInputParametersBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.response.information.NetworkResponseInformationBuilder u10 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.response.information.NetworkResponseInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.identifier.NetworkTopologyIdentifierBuilder u11 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.identifier.NetworkTopologyIdentifierBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.identifier.structure.NetworkTopologyIdentifierStructureBuilder u12 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.identifier.structure.NetworkTopologyIdentifierStructureBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.information.NetworkTopologyInformationBuilder u13 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.information.NetworkTopologyInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.NetworkTopologyBuilder u14 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.NetworkTopologyBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationInputBuilder u15 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationInputBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationOutputBuilder u16 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationOutputBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.oper.status.OperStatusBuilder u17 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.oper.status.OperStatusBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.param.ParamBuilder u18 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.param.ParamBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.data.PreloadDataBuilder u19 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.data.PreloadDataBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.model.information.VnfPreloadListBuilder u20 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.model.information.VnfPreloadListBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationInputBuilder u21 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationInputBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationOutputBuilder u22 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationOutputBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfsBuilder u23 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfsBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationInputBuilder u24 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationInputBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationOutputBuilder u25 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationOutputBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformationBuilder u26 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.route.table.reference.RouteTableReferenceBuilder u27 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.route.table.reference.RouteTableReferenceBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeaderBuilder u28 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeaderBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.assignments.ServiceAssignmentsBuilder u29 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.assignments.ServiceAssignmentsBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.ServiceDataBuilder u30 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.ServiceDataBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.NetworksBuilder u31 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.NetworksBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.networks.NetworkBuilder u32 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.networks.NetworkBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.networks.network.NetworkDataBuilder u33 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.networks.network.NetworkDataBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.VnfsBuilder u34 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.VnfsBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.VnfBuilder u35 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.VnfBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.vnf.VnfDataBuilder u36 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.vnf.VnfDataBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.vnf.vnf.data.VfModulesBuilder u37 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.vnf.vnf.data.VfModulesBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.vnf.vnf.data.vf.modules.VfModuleBuilder u38 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.vnf.vnf.data.vf.modules.VfModuleBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.vnf.vnf.data.vf.modules.vf.module.VfModuleDataBuilder u39 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.vnf.vnf.data.vf.modules.vf.module.VfModuleDataBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.information.ServiceInformationBuilder u40 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.information.ServiceInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.level.oper.status.ServiceLevelOperStatusBuilder u41 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.level.oper.status.ServiceLevelOperStatusBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.model.infrastructure.ServiceBuilder u42 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.model.infrastructure.ServiceBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.parameters.ServiceParametersBuilder u43 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.parameters.ServiceParametersBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.parameters.service.parameters.ServiceParameterBuilder u44 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.parameters.service.parameters.ServiceParameterBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.request.input.ServiceRequestInputBuilder u45 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.request.input.ServiceRequestInputBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.request.input.service.request.input.ServiceInputParametersBuilder u46 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.request.input.service.request.input.ServiceInputParametersBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.response.information.ServiceResponseInformationBuilder u47 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.response.information.ServiceResponseInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServicesBuilder u48 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServicesBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.status.ServiceStatusBuilder u49 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.status.ServiceStatusBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.topology.identifier.ServiceTopologyIdentifierBuilder u50 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.topology.identifier.ServiceTopologyIdentifierBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationInputBuilder u51 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationInputBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationOutputBuilder u52 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationOutputBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.topology.ServiceTopologyBuilder u53 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.topology.ServiceTopologyBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sriov.vlan.filter.list.SriovVlanFilterListBuilder u54 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sriov.vlan.filter.list.SriovVlanFilterListBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.subnets.SubnetsBuilder u55 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.subnets.SubnetsBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.assignments.VfModuleAssignmentsBuilder u56 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.assignments.VfModuleAssignmentsBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.assignments.vf.module.assignments.VmsBuilder u57 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.assignments.vf.module.assignments.VmsBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.assignments.vf.module.assignments.vms.VmBuilder u58 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.assignments.vf.module.assignments.vms.VmBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.information.VfModuleInformationBuilder u59 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.information.VfModuleInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.level.oper.status.VfModuleLevelOperStatusBuilder u60 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.level.oper.status.VfModuleLevelOperStatusBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.request.input.VfModuleRequestInputBuilder u61 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.request.input.VfModuleRequestInputBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.request.input.vf.module.request.input.VfModuleInputParametersBuilder u62 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.request.input.vf.module.request.input.VfModuleInputParametersBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.response.information.VfModuleResponseInformationBuilder u63 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.response.information.VfModuleResponseInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.topology.identifier.VfModuleTopologyIdentifierBuilder u64 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.topology.identifier.VfModuleTopologyIdentifierBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationInputBuilder u65 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationInputBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationOutputBuilder u66 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationOutputBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.topology.VfModuleTopologyBuilder u67 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.topology.VfModuleTopologyBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.topology.vf.module.topology.VfModuleParametersBuilder u68 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.topology.vf.module.topology.VfModuleParametersBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.FloatingIpsBuilder u69 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.FloatingIpsBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.InterfaceRoutePrefixesBuilder u70 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.InterfaceRoutePrefixesBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.MacAddressesBuilder u71 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.MacAddressesBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.NetworkInformationItemsBuilder u72 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.NetworkInformationItemsBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.network.information.items.NetworkInformationItemBuilder u73 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.network.information.items.NetworkInformationItemBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.network.information.items.network.information.item.NetworkIpsBuilder u74 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.network.information.items.network.information.item.NetworkIpsBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.sriov.parameters.ApplicationTagsBuilder u75 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.sriov.parameters.ApplicationTagsBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.sriov.parameters.application.tags.CTagsBuilder u76 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.sriov.parameters.application.tags.CTagsBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.sriov.parameters.application.tags.STagsBuilder u77 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.sriov.parameters.application.tags.STagsBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.SriovParametersBuilder u78 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.SriovParametersBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.sriov.parameters.HeatVlanFiltersBuilder u79 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.sriov.parameters.HeatVlanFiltersBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.InterfaceRoutePrefixesBuilder u80 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.InterfaceRoutePrefixesBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.NetworkIpsBuilder u81 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.NetworkIpsBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.NetworkIpsV6Builder u82 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.NetworkIpsV6Builder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.NetworkMacsBuilder u83 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.NetworkMacsBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.data.VmNamesBuilder u84 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.data.VmNamesBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.data.VmNetworksBuilder u85 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.data.VmNetworksBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.data.vm.networks.VmNetworkBuilder u86 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.data.vm.networks.VmNetworkBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.VnfVmsBuilder u87 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.VnfVmsBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.vnf.vms.VmNamesBuilder u88 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.vnf.vms.VmNamesBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.vnf.vms.VmNetworksBuilder u89 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.vnf.vms.VmNetworksBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.assignments.vnf.assignments.AvailabilityZonesBuilder u90 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.assignments.vnf.assignments.AvailabilityZonesBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.assignments.VnfAssignmentsBuilder u91 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.assignments.VnfAssignmentsBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.assignments.vnf.assignments.VnfNetworksBuilder u92 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.assignments.vnf.assignments.VnfNetworksBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.information.VnfInformationBuilder u93 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.information.VnfInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.level.oper.status.VnfLevelOperStatusBuilder u94 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.level.oper.status.VnfLevelOperStatusBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.network.data.SubnetsDataBuilder u95 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.network.data.SubnetsDataBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.network.data.subnets.data.SubnetDataBuilder u96 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.network.data.subnets.data.SubnetDataBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.parameters.VnfParametersBuilder u97 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.parameters.VnfParametersBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.request.input.VnfRequestInputBuilder u98 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.request.input.VnfRequestInputBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.request.input.vnf.request.input.VnfInputParametersBuilder u99 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.request.input.vnf.request.input.VnfInputParametersBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.request.input.vnf.request.input.VnfNetworksBuilder u100 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.request.input.vnf.request.input.VnfNetworksBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.request.input.vnf.request.input.vnf.networks.VnfNetworkBuilder u101 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.request.input.vnf.request.input.vnf.networks.VnfNetworkBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.resource.assignments.vnf.resource.assignments.AvailabilityZonesBuilder u102 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.resource.assignments.vnf.resource.assignments.AvailabilityZonesBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.resource.assignments.VnfResourceAssignmentsBuilder u103 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.resource.assignments.VnfResourceAssignmentsBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.resource.assignments.vnf.resource.assignments.VnfNetworksBuilder u104 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.resource.assignments.vnf.resource.assignments.VnfNetworksBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.resource.assignments.vnf.resource.assignments.vnf.networks.VnfNetworkBuilder u105 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.resource.assignments.vnf.resource.assignments.vnf.networks.VnfNetworkBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.response.information.VnfResponseInformationBuilder u106 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.response.information.VnfResponseInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.identifier.structure.VnfTopologyIdentifierStructureBuilder u107 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.identifier.structure.VnfTopologyIdentifierStructureBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.identifier.VnfTopologyIdentifierBuilder u108 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.identifier.VnfTopologyIdentifierBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.information.VnfTopologyInformationBuilder u109 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.information.VnfTopologyInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationInputBuilder u110 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationInputBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationOutputBuilder u111 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationOutputBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.VnfTopologyBuilder u112 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.VnfTopologyBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.vnf.topology.VnfParametersDataBuilder u113 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.vnf.topology.VnfParametersDataBuilder();
+ org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vpn.bindings.VpnBindingsBuilder u114 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vpn.bindings.VpnBindingsBuilder();
+ }
+}
diff --git a/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev140523/GENERICRESOURCEAPIProviderModule.java b/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev140523/GENERICRESOURCEAPIProviderModule.java
new file mode 100644
index 00000000..ff2775d0
--- /dev/null
+++ b/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev140523/GENERICRESOURCEAPIProviderModule.java
@@ -0,0 +1,35 @@
+package org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.api.provider.impl.rev140523;
+
+import org.onap.sdnc.northbound.GenericResourceApiProvider;
+
+public class GENERICRESOURCEAPIProviderModule extends org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.api.provider.impl.rev140523.AbstractGENERICRESOURCEAPIProviderModule {
+ public GENERICRESOURCEAPIProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public GENERICRESOURCEAPIProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.api.provider.impl.rev140523.GENERICRESOURCEAPIProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ public void customValidation() {
+ // add custom validation form module attributes here.
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ final GenericResourceApiProvider provider = new GenericResourceApiProvider(getDataBrokerDependency()
+ , getNotificationServiceDependency()
+ , getRpcRegistryDependency());
+
+ return new AutoCloseable() {
+
+ @Override
+ public void close() throws Exception {
+ provider.close();
+ }
+ };
+ }
+
+
+}
diff --git a/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev140523/GENERICRESOURCEAPIProviderModuleFactory.java b/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev140523/GENERICRESOURCEAPIProviderModuleFactory.java
new file mode 100644
index 00000000..abad5350
--- /dev/null
+++ b/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev140523/GENERICRESOURCEAPIProviderModuleFactory.java
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: GENERIC-RESOURCE-API-provider-impl yang module local name: GENERIC-RESOURCE-API-provider-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Tue Sep 05 14:01:41 EDT 2017
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.api.provider.impl.rev140523;
+public class GENERICRESOURCEAPIProviderModuleFactory extends org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.api.provider.impl.rev140523.AbstractGENERICRESOURCEAPIProviderModuleFactory {
+
+}
diff --git a/generic-resource-api/provider/src/main/resources/initial/generic-resource-api-provider.xml b/generic-resource-api/provider/src/main/resources/initial/generic-resource-api-provider.xml
new file mode 100644
index 00000000..2ba353ca
--- /dev/null
+++ b/generic-resource-api/provider/src/main/resources/initial/generic-resource-api-provider.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<snapshot>
+ <configuration>
+ <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+ <module>
+
+ <!-- This xmlns:prefix should match the namespace in the *-provider-impl.yang file
+ The prefix: inside type should match the prefix of the yang file. -->
+ <type xmlns:prefix="org:onap:sdnc:northbound:GENERIC-RESOURCE-API:provider:impl">
+ prefix:GENERIC-RESOURCE-API-provider-impl
+ </type>
+ <name>GENERIC-RESOURCE-API-provider-impl</name>
+
+ <!-- The following sections contain bindings to services defined in the
+ *-provider-impl yang file. For example the rpc-registry is required
+ because we have a dependency (or augmentation) named "rpc-registry"
+ and which binds to the md-sa-binding-registry. If you remove those
+ dependencies from the yang file then you can remove them from here. -->
+ <rpc-registry>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
+ <name>binding-rpc-broker</name>
+ </rpc-registry>
+
+ <data-broker>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
+ <name>binding-data-broker</name>
+ </data-broker>
+
+ <notification-service>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
+ binding:binding-notification-service
+ </type>
+ <name>binding-notification-broker</name>
+ </notification-service>
+ </module>
+
+ </modules>
+ </data>
+
+ </configuration>
+
+ <!-- Required capabilities are basically a listing of all modules that need to be imported before
+ our service can be resolved. Capabilities for dependencies defined above are implied which is
+ why we do not have define a required capability for the data broker, for example. -->
+ <required-capabilities>
+ <capability>org:onap:sdnc:northbound:GENERIC-RESOURCE-API:provider:impl?module=GENERIC-RESOURCE-API-provider-impl&amp;revision=2014-05-23</capability>
+ </required-capabilities>
+
+</snapshot>
diff --git a/generic-resource-api/provider/src/main/yang/GENERIC-RESOURCE-API-provider-impl.yang b/generic-resource-api/provider/src/main/yang/GENERIC-RESOURCE-API-provider-impl.yang
new file mode 100644
index 00000000..f6f49ee1
--- /dev/null
+++ b/generic-resource-api/provider/src/main/yang/GENERIC-RESOURCE-API-provider-impl.yang
@@ -0,0 +1,61 @@
+module GENERIC-RESOURCE-API-provider-impl {
+
+ yang-version 1;
+ namespace "org:onap:sdnc:northbound:GENERIC-RESOURCE-API:provider:impl";
+ prefix "GENERIC-RESOURCE-API-provider-impl";
+
+ import config { prefix config; revision-date 2013-04-05; }
+ import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+
+ description
+ "This module contains the base YANG definitions for
+ GENERIC-RESOURCE-API-provider impl implementation.";
+
+ revision "2014-05-23" {
+ description
+ "Initial revision.";
+ }
+
+ // This is the definition of the service implementation as a module identity.
+ identity GENERIC-RESOURCE-API-provider-impl {
+ base config:module-type;
+
+ // Specifies the prefix for generated java classes.
+ config:java-name-prefix GENERIC-RESOURCE-APIProvider;
+ }
+
+ // Augments the 'configuration' choice node under modules/module.
+ // We consume the three main services, RPCs, DataStore, and Notifications
+ augment "/config:modules/config:module/config:configuration" {
+ case GENERIC-RESOURCE-API-provider-impl {
+ when "/config:modules/config:module/config:type = 'GENERIC-RESOURCE-API-provider-impl'";
+
+ container rpc-registry {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity mdsal:binding-rpc-registry;
+ }
+ }
+ }
+
+ container notification-service {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity mdsal:binding-notification-service;
+ }
+ }
+ }
+
+ container data-broker {
+ uses config:service-ref {
+ refine type {
+ mandatory false;
+ config:required-identity mdsal:binding-async-data-broker;
+ }
+ }
+ }
+ }
+ }
+}