aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic-resource-api/model/src/main/yang/GENERIC-RESOURCE-API.yang166
-rw-r--r--generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java362
-rw-r--r--generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java4
3 files changed, 517 insertions, 15 deletions
diff --git a/generic-resource-api/model/src/main/yang/GENERIC-RESOURCE-API.yang b/generic-resource-api/model/src/main/yang/GENERIC-RESOURCE-API.yang
index 233fbaf8..e840cb4d 100644
--- a/generic-resource-api/model/src/main/yang/GENERIC-RESOURCE-API.yang
+++ b/generic-resource-api/model/src/main/yang/GENERIC-RESOURCE-API.yang
@@ -160,7 +160,7 @@ module GENERIC-RESOURCE-API {
grouping service-topology {
container service-topology {
uses service-topology-identifier;
- uses ecomp-model-information;
+ uses onap-model-information;
uses service-assignments;
uses service-parameters;
}
@@ -225,7 +225,7 @@ module GENERIC-RESOURCE-API {
leaf network-type {
type string;
}
- uses ecomp-model-information;
+ uses onap-model-information;
}
}
grouping network-request-input {
@@ -243,7 +243,7 @@ module GENERIC-RESOURCE-API {
container network-topology {
uses network-topology-identifier-structure;
uses region-identifier;
- uses ecomp-model-information;
+ uses onap-model-information;
uses network-assignments;
uses network-parameters;
}
@@ -313,7 +313,7 @@ module GENERIC-RESOURCE-API {
description "vnf-model-id in Pats model?in Pats vnf submodule, contained within vnf-instance-topology-identifier grouping (along with vnf-name and vnf-instance-id)";
type string;
}
- uses ecomp-model-information;
+ uses onap-model-information;
}
}
grouping vnf-request-input {
@@ -342,7 +342,7 @@ module GENERIC-RESOURCE-API {
container vnf-topology {
uses vnf-topology-identifier-structure;
uses region-identifier;
- uses ecomp-model-information;
+ uses onap-model-information;
uses vnf-resource-assignments;
container vnf-parameters-data {
uses param;
@@ -458,7 +458,7 @@ module GENERIC-RESOURCE-API {
leaf vf-module-type {
type string;
}
- uses ecomp-model-information;
+ uses onap-model-information;
}
}
grouping vf-module-request-input {
@@ -480,7 +480,7 @@ module GENERIC-RESOURCE-API {
container vf-module-topology {
uses vf-module-topology-identifier;
uses region-identifier;
- uses ecomp-model-information;
+ uses onap-model-information;
uses vf-module-assignments;
container vf-module-parameters {
uses param;
@@ -691,7 +691,7 @@ module GENERIC-RESOURCE-API {
grouping contrail-route-topology {
container contrail-route-topology {
uses allotted-resource-identifiers;
- uses ecomp-model-information;
+ uses onap-model-information;
uses contrail-route-assignments;
container contrail-route-parameters {
uses param;
@@ -762,7 +762,7 @@ module GENERIC-RESOURCE-API {
grouping security-zone-topology {
container security-zone-topology {
uses allotted-resource-identifiers;
- uses ecomp-model-information;
+ uses onap-model-information;
uses security-zone-assignments;
container security-zone-parameters {
uses param;
@@ -798,6 +798,75 @@ module GENERIC-RESOURCE-API {
}
}
}
+ grouping tunnelxconn-operation-information {
+ uses sdnc-request-header;
+ uses request-information;
+ uses service-information;
+ uses allotted-resource-information;
+ uses tunnelxconn-request-input;
+ }
+ grouping tunnelxconn-request-input {
+ leaf brg-wan-mac-address {
+ type string;
+ }
+ }
+ grouping tunnelxconn-topology {
+ container tunnelxconn-topology {
+ uses allotted-resource-identifiers;
+ uses onap-model-information;
+ uses tunnelxconn-assignments;
+ container tunnelxconn-parameters {
+ uses param;
+ }
+ }
+ }
+ grouping tunnelxconn-assignments {
+ leaf vni {
+ description "The Network Controller will assign a VNI value from the associated vGMUX VNI pool";
+ type string;
+ }
+ leaf vgmux-bearer-ip {
+ description "The Network Controller will look up the vgmux bearer ip from the vgmux vf module";
+ type inet:ip-address;
+ }
+ leaf vgmux-lan-up {
+ description "The Network Controller will look up the vgmux lan ip from the vgmux vg module";
+ type inet:ip-address;
+ }
+ }
+ grouping brg-operation-information {
+ uses sdnc-request-header;
+ uses request-information;
+ uses service-information;
+ uses allotted-resource-information;
+ uses brg-request-input;
+ }
+ grouping brg-request-input {
+ leaf vgmux-bearer-ip {
+ type inet:ip-address;
+ }
+ leaf vni {
+ type string;
+ }
+ leaf brg-wan-ip-address {
+ type inet:ip-address;
+ }
+ }
+ grouping brg-topology {
+ container brg-topology {
+ uses allotted-resource-identifiers;
+ uses onap-model-information;
+ uses brg-assignments;
+ container brg-parameters {
+ uses param;
+ }
+ }
+ }
+ grouping brg-assignments {
+ leaf vbrg-wan-ip {
+ type inet:ip-address;
+ }
+ }
grouping allotted-resource-information {
container allotted-resource-information {
leaf allotted-resource-id {
@@ -811,7 +880,7 @@ module GENERIC-RESOURCE-API {
description "Service-instance-id of the parent service to which this allotted resource belongs.";
type string;
}
- uses ecomp-model-information;
+ uses onap-model-information;
}
}
grouping allotted-resource-identifiers {
@@ -978,7 +1047,7 @@ module GENERIC-RESOURCE-API {
description "used to reference a&ai subscription-service-type. For example, we show as vIPR-ATM in example.";
type string;
}
- uses ecomp-model-information;
+ uses onap-model-information;
leaf service-instance-id {
type string;
}
@@ -992,8 +1061,8 @@ module GENERIC-RESOURCE-API {
}
}
}
- grouping ecomp-model-information {
- container ecomp-model-information {
+ grouping onap-model-information {
+ container onap-model-information {
leaf model-invariant-uuid {
description "identifies the invariant uuid for this service or resource";
type string;
@@ -1144,6 +1213,16 @@ module GENERIC-RESOURCE-API {
uses instance-reference;
}
}
+ grouping tunnelxconn-response-information {
+ container tunnelxconn-response-information {
+ uses instance-reference;
+ }
+ }
+ grouping brg-response-information {
+ container brg-response-information {
+ uses instance-reference;
+ }
+ }
grouping preload-model-information {
list vnf-preload-list {
key "vnf-name vnf-type";
@@ -1584,6 +1663,46 @@ module GENERIC-RESOURCE-API {
uses allotted-resource-status;
}
}
+ container tunnelxconn-allotted-resources {
+ list tunnelxconn-allotted-resource {
+ key "allotted-resource-id";
+ leaf allotted-resource-id {
+ type string;
+ mandatory true;
+ }
+ container allotted-resource-data {
+ container allotted-resource-operation-information {
+ uses tunnelxconn-operation-information;
+ }
+ uses tunnelxconn-topology;
+ container tunnelxconn-parameters {
+ uses param;
+ }
+ uses allotted-resource-oper-status;
+ }
+ uses allotted-resource-status;
+ }
+ }
+ container brg-allotted-respources {
+ list brg-allotted-resource {
+ key "allotted-resource-id";
+ leaf allotted-resource-id {
+ type string;
+ mandatory true;
+ }
+ container allotted-resource-data {
+ container allotted-resource-operation-information {
+ uses brg-operation-information;
+ }
+ uses brg-topology;
+ container brg-parameters {
+ uses param;
+ }
+ uses allotted-resource-oper-status;
+ }
+ uses allotted-resource-status;
+ }
+ }
rpc service-topology-operation {
input {
uses service-operation-information;
@@ -1644,6 +1763,26 @@ module GENERIC-RESOURCE-API {
uses service-response-information;
}
}
+ rpc tunnelxconn-topology-operation {
+ input {
+ uses tunnelxconn-operation-information;
+ }
+ output {
+ uses topology-response-common;
+ uses tunnelxconn-response-information;
+ uses service-response-information;
+ }
+ }
+ rpc brg-topology-operation {
+ input {
+ uses brg-operation-information;
+ }
+ output {
+ uses topology-response-common;
+ uses brg-response-information;
+ uses service-response-information;
+ }
+ }
container preload-vnfs {
uses preload-model-information;
}
@@ -1667,4 +1806,5 @@ module GENERIC-RESOURCE-API {
uses vnf-topology-response-body;
}
}
+
} ////closes the module
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
index 0176aca4..a0b08621 100644
--- 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
@@ -19,6 +19,10 @@ import org.opendaylight.controller.md.sal.common.api.data.OptimisticLockFailedEx
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.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.BrgTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.BrgTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.BrgTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.BrgTopologyOperationOutputBuilder;
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;
@@ -48,6 +52,10 @@ import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.re
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.TunnelxconnTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.TunnelxconnTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.TunnelxconnTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.TunnelxconnTopologyOperationOutputBuilder;
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;
@@ -56,6 +64,7 @@ import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.re
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.brg.response.information.BrgResponseInformationBuilder;
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;
@@ -76,6 +85,7 @@ import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.re
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.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.tunnelxconn.response.information.TunnelxconnResponseInformationBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
@@ -1698,6 +1708,356 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
return Futures.immediateFuture(rpcResult);
}
+ @Override
+ public Future<RpcResult<TunnelxconnTopologyOperationOutput>> tunnelxconnTopologyOperation(
+ TunnelxconnTopologyOperationInput input) {
+
+ final String SVC_OPERATION = "tunnelxconn-topology-operation";
+ ServiceData serviceData;
+ ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
+ Properties parms = new Properties();
+
+ log.info("{} called.", SVC_OPERATION);
+ // create a new response object
+ TunnelxconnTopologyOperationOutputBuilder responseBuilder = new TunnelxconnTopologyOperationOutputBuilder();
+
+ if(input == null ||
+ input.getServiceInformation() == null ||
+ input.getServiceInformation().getServiceInstanceId() == null ||
+ input.getServiceInformation().getServiceInstanceId().length() == 0)
+ {
+ log.debug("exiting {} because of null or empty service-instance-id", SVC_OPERATION);
+ responseBuilder.setResponseCode("404");
+ responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<TunnelxconnTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<TunnelxconnTopologyOperationOutput> 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 {} because the service-instance does not have any service data in SDNC", SVC_OPERATION);
+ responseBuilder.setResponseCode("404");
+ responseBuilder.setResponseMessage("invalid input: the service-instance does not have any service data in SDNC");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<TunnelxconnTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<TunnelxconnTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ log.info("Adding INPUT data for {} [{}] input: {}", SVC_OPERATION, siid, input);
+ TunnelxconnTopologyOperationInputBuilder inputBuilder = new TunnelxconnTopologyOperationInputBuilder(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 tunnelxconnObjectPath = 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");
+ tunnelxconnObjectPath = respProps.getProperty("tunnelxconn-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<TunnelxconnTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<TunnelxconnTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Got success from SLI
+ try {
+
+ serviceData = serviceDataBuilder.build();
+ log.info("Updating MD-SAL for {} [{}] ServiceData: {}", SVC_OPERATION, siid, 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);
+ }
+ }
+
+ TunnelxconnResponseInformationBuilder tunnelxconnResponseInformationBuilder = new TunnelxconnResponseInformationBuilder();
+ tunnelxconnResponseInformationBuilder.setInstanceId(allottedResourceId);
+ tunnelxconnResponseInformationBuilder.setObjectPath(tunnelxconnObjectPath);
+ responseBuilder.setTunnelxconnResponseInformation(tunnelxconnResponseInformationBuilder.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 {} [{}] \n", SVC_OPERATION, siid, e);
+ responseBuilder.setResponseCode("500");
+ responseBuilder.setResponseMessage(e.toString());
+ responseBuilder.setAckFinalIndicator("Y");
+ log.error("Returned FAILED for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build());
+ RpcResult<TunnelxconnTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<TunnelxconnTopologyOperationOutput> 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<TunnelxconnTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<TunnelxconnTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
+ public Future<RpcResult<BrgTopologyOperationOutput>> brgTopologyOperation(BrgTopologyOperationInput input) {
+ final String SVC_OPERATION = "brg-topology-operation";
+ ServiceData serviceData;
+ ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
+ Properties parms = new Properties();
+
+ log.info("{} called.", SVC_OPERATION);
+ // create a new response object
+ BrgTopologyOperationOutputBuilder responseBuilder = new BrgTopologyOperationOutputBuilder();
+
+ if(input == null ||
+ input.getServiceInformation() == null ||
+ input.getServiceInformation().getServiceInstanceId() == null ||
+ input.getServiceInformation().getServiceInstanceId().length() == 0)
+ {
+ log.debug("exiting {} because of null or empty service-instance-id", SVC_OPERATION);
+ responseBuilder.setResponseCode("404");
+ responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<BrgTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<BrgTopologyOperationOutput> 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 {} because the service-instance does not have any service data in SDNC", SVC_OPERATION);
+ responseBuilder.setResponseCode("404");
+ responseBuilder.setResponseMessage("invalid input: the service-instance does not have any service data in SDNC");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<BrgTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<BrgTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ log.info("Adding INPUT data for {} [{}] input: {}", SVC_OPERATION, siid, input);
+ BrgTopologyOperationInputBuilder inputBuilder = new BrgTopologyOperationInputBuilder(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 brgObjectPath = 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");
+ brgObjectPath = respProps.getProperty("brg-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<BrgTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<BrgTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Got success from SLI
+ try {
+
+ serviceData = serviceDataBuilder.build();
+ log.info("Updating MD-SAL for {} [{}] ServiceData: {}", SVC_OPERATION, siid, 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);
+ }
+ }
+
+ BrgResponseInformationBuilder brgResponseInformationBuilder = new BrgResponseInformationBuilder();
+ brgResponseInformationBuilder.setInstanceId(allottedResourceId);
+ brgResponseInformationBuilder.setObjectPath(brgObjectPath);
+ responseBuilder.setBrgResponseInformation(brgResponseInformationBuilder.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 {} [{}] \n", SVC_OPERATION, siid, e);
+ responseBuilder.setResponseCode("500");
+ responseBuilder.setResponseMessage(e.toString());
+ responseBuilder.setAckFinalIndicator("Y");
+ log.error("Returned FAILED for {} [{}] {}", SVC_OPERATION, siid, responseBuilder.build());
+ RpcResult<BrgTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<BrgTopologyOperationOutput> 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<BrgTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<BrgTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
@Override
public Future<RpcResult<PreloadVnfTopologyOperationOutput>> preloadVnfTopologyOperation(
PreloadVnfTopologyOperationInput input) {
@@ -2074,4 +2434,6 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
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/GenericResourceApiUtil.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java
index 6e6da0e4..c03bc120 100644
--- 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
@@ -40,8 +40,8 @@ public class GenericResourceApiUtil extends MdsalHelper {
// 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.onap.model.information.OnapModelInformationBuilder u1 =
+ new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.onap.model.information.OnapModelInformationBuilder();
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 =