summaryrefslogtreecommitdiffstats
path: root/ms/generic-resource-api/src
diff options
context:
space:
mode:
Diffstat (limited to 'ms/generic-resource-api/src')
-rw-r--r--ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiController.java591
-rw-r--r--ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiController.java726
-rwxr-xr-xms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigContrailRouteAllottedResources.java181
-rwxr-xr-xms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigContrailRouteAllottedResourcesRepository.java33
-rwxr-xr-xms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigPortMirrorConfigurations.java181
-rwxr-xr-xms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigPortMirrorConfigurationsRepository.java33
-rwxr-xr-xms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalContrailRouteAllottedResources.java181
-rwxr-xr-xms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalContrailRouteAllottedResourcesRepository.java33
-rwxr-xr-xms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalPortMirrorConfigurations.java181
-rwxr-xr-xms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalPortMirrorConfigurationsRepository.java33
-rw-r--r--ms/generic-resource-api/src/main/resources/schema-derby.sql54
-rw-r--r--ms/generic-resource-api/src/main/resources/schema-mysql.sql54
12 files changed, 2235 insertions, 46 deletions
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiController.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiController.java
index a8aeb99..6a4857b 100644
--- a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiController.java
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiController.java
@@ -32,6 +32,10 @@ import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadData;
import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadDataRepository;
import org.onap.sdnc.apps.ms.gra.data.ConfigServices;
import org.onap.sdnc.apps.ms.gra.data.ConfigServicesRepository;
+import org.onap.sdnc.apps.ms.gra.data.ConfigPortMirrorConfigurations;
+import org.onap.sdnc.apps.ms.gra.data.ConfigPortMirrorConfigurationsRepository;
+import org.onap.sdnc.apps.ms.gra.data.ConfigContrailRouteAllottedResources;
+import org.onap.sdnc.apps.ms.gra.data.ConfigContrailRouteAllottedResourcesRepository;
import org.onap.sdnc.apps.ms.gra.swagger.ConfigApi;
import org.onap.sdnc.apps.ms.gra.swagger.model.*;
import org.slf4j.Logger;
@@ -71,6 +75,13 @@ public class ConfigApiController implements ConfigApi {
private ConfigServicesRepository configServicesRepository;
@Autowired
+ private ConfigPortMirrorConfigurationsRepository configPortMirrorConfigurationsRepository;
+
+ @Autowired
+ private ConfigContrailRouteAllottedResourcesRepository configContrailRouteAllottedResourcesRepository;
+
+
+ @Autowired
public ConfigApiController(ObjectMapper objectMapper, HttpServletRequest request) {
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
@@ -94,6 +105,249 @@ public class ConfigApiController implements ConfigApi {
return (new ResponseEntity<>(HttpStatus.NO_CONTENT));
}
+ /**
+ * Extracts port-mirror configuration data from CONFIG_GRA_PORT_MIRROR_CONFIGURATIONS for a given, configuration-id
+ * <p>
+ * Maps to /config/GENERIC-RESOURCE-API:port-mirror-configurations/port-mirror-configuration/{configuration-id}/
+ * @param configurationId the configuration ID for a port-mirror
+ * @return HttpStatus.OK (200) if the data is found.
+ * @throws RestException if the data does not exist.
+ */
+ public ResponseEntity<GenericResourceApiPortmirrorconfigurationsPortMirrorConfiguration>
+ configGENERICRESOURCEAPIportMirrorConfigurationsPortMirrorConfigurationConfigurationIdGet(
+ String configurationId) throws RestApplicationException {
+ GenericResourceApiPortmirrorconfigurationsPortMirrorConfiguration retval = null;
+
+ List<ConfigPortMirrorConfigurations> pmConfigurations = configPortMirrorConfigurationsRepository.findByConfigurationId(configurationId);
+
+ if (pmConfigurations.isEmpty()) {
+ log.info("No configuration data found with id [{}]",configurationId);
+ return new ResponseEntity<>(HttpStatus.NOT_FOUND);
+ } else {
+ ConfigPortMirrorConfigurations pmConfiguration = pmConfigurations.get(0);
+ retval = new GenericResourceApiPortmirrorconfigurationsPortMirrorConfiguration();
+ retval.setConfigurationId(configurationId);
+ retval.setConfigurationStatus(pmConfiguration.getPortMirrorConfigurationStatus());
+ try {
+ retval.setConfigurationData(objectMapper.readValue(pmConfiguration.getPmcData(), GenericResourceApiPortmirrorconfigurationsPortmirrorconfigurationConfigurationData.class));
+ } catch (JsonProcessingException e) {
+ log.error("Could not deserialize service data for service instance id {}", configurationId, e);
+ throw new RestApplicationException("data-conversion", "Request could not be completed due to internal error", e, HttpStatus.INTERNAL_SERVER_ERROR.value());
+ }
+ }
+ return new ResponseEntity<>(retval, HttpStatus.OK);
+ }
+
+ @Override
+ public ResponseEntity<Void> configGENERICRESOURCEAPIportMirrorConfigurationsPortMirrorConfigurationConfigurationIdPut(
+ String configurationId, @Valid GenericResourceApiPortmirrorconfigurationsPortMirrorConfiguration newConfiguration)
+ throws RestApplicationException {
+
+ boolean dataExists = false;
+
+ String newConfigurationId = newConfiguration.getConfigurationId();
+
+ ConfigPortMirrorConfigurations portMirrorConfiguration = null;
+ List<ConfigPortMirrorConfigurations> existingConfiguration = configPortMirrorConfigurationsRepository.findByConfigurationId(configurationId);
+ if ((existingConfiguration != null) && !existingConfiguration.isEmpty()) {
+ dataExists = true;
+ portMirrorConfiguration = existingConfiguration.get(0);
+ } else {
+ portMirrorConfiguration = new ConfigPortMirrorConfigurations();
+ portMirrorConfiguration.setConfigureationId(configurationId);
+ }
+
+ try {
+ portMirrorConfiguration.setPmcData(objectMapper.writeValueAsString(newConfiguration.getConfigurationData()));
+ } catch (JsonProcessingException e) {
+ log.error("Could not serialize porr-mirror configuration data for {}", portMirrorConfiguration.getConfigureationId(), e);
+ throw new RestApplicationException("data-conversion", "Request could not be completed due to internal error", e, HttpStatus.INTERNAL_SERVER_ERROR.value());
+
+ }
+ portMirrorConfiguration.setPortMirrorConfigurationStatus(newConfiguration.getConfigurationStatus());
+ configPortMirrorConfigurationsRepository.save(portMirrorConfiguration);
+
+ if (dataExists) {
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ } else {
+ return new ResponseEntity<>(HttpStatus.CREATED);
+ }
+ }
+
+ @Override
+ public ResponseEntity<GenericResourceApiPortmirrorconfigurationtopologyPortMirrorConfigurationTopology>
+ configGENERICRESOURCEAPIportMirrorConfigurationsPortMirrorConfigurationConfigurationIdConfigurationDataPortMirrorConfigurationTopologyGet(
+ String configurationId) throws RestApplicationException, RestProtocolException {
+ @Valid GenericResourceApiPortmirrorconfigurationtopologyPortMirrorConfigurationTopology portMirrorConfigurationTopology = null;
+ GenericResourceApiPortmirrorconfigurationsPortmirrorconfigurationConfigurationData portMirrorConfigurationData = null;
+
+ List<ConfigPortMirrorConfigurations> configPortMirrorConfigurations = configPortMirrorConfigurationsRepository.findByConfigurationId(configurationId);
+ if ((configPortMirrorConfigurations == null) || (configPortMirrorConfigurations.isEmpty())) {
+ throw new RestProtocolException("data-missing", "No port-mirror-configuration entry found", HttpStatus.NOT_FOUND.value());
+ }
+
+ try {
+ if ( configPortMirrorConfigurations.get(0).getPmcData().isEmpty()) {
+ throw new RestProtocolException("data-missing", "No configuration-data entry found", HttpStatus.NOT_FOUND.value());
+ } else {
+ portMirrorConfigurationData = objectMapper.readValue(configPortMirrorConfigurations.get(0).getPmcData(), GenericResourceApiPortmirrorconfigurationsPortmirrorconfigurationConfigurationData.class);
+ portMirrorConfigurationTopology = portMirrorConfigurationData.getPortMirrorConfigurationTopology();
+ }
+ if (portMirrorConfigurationTopology == null) {
+ throw new RestProtocolException("data-missing", "No service-topology entry found", HttpStatus.NOT_FOUND.value());
+ }
+ return new ResponseEntity<>(portMirrorConfigurationTopology, HttpStatus.OK);
+ } catch (JsonProcessingException e) {
+ log.error("Could not parse service data", e);
+ throw new RestApplicationException("data-conversion", "Request could not be completed due to internal error", e, HttpStatus.INTERNAL_SERVER_ERROR.value());
+ }
+ }
+
+
+ @Override
+ public ResponseEntity<Void> configGENERICRESOURCEAPIportMirrorConfigurationsPortMirrorConfigurationConfigurationIdDelete(String configurationId) {
+ configPortMirrorConfigurationsRepository.deleteByConfigurationId(configurationId);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+
+ /**
+ * Extracts contrail-route-allotted-resource data from CONFIG_GRA_CONTRAIL_ROUTE_ALLOTTED_RESOURCES for a given allottedResourceId
+ * <p>
+ * Maps to /config/GENERIC-RESOURCE-API:contrail-route-allotted-resources/contrail-route-allotted-resource/{allotted-resource-id}
+ * @param allottedResourceId the allotted-resource-id for a contrail-route
+ * @return HttpStatus.OK (200) if the data is found.
+ * @throws RestException if the data does not exist.
+ */
+ public ResponseEntity<GenericResourceApiContrailrouteallottedresourcesContrailRouteAllottedResource>
+ configGENERICRESOURCEAPIcontrailRouteAllottedResourcesContrailRouteAllottedResourceAllottedResourceIdGet(
+ String allottedResourceId) throws RestApplicationException {
+ GenericResourceApiContrailrouteallottedresourcesContrailRouteAllottedResource retval = null;
+
+ List<ConfigContrailRouteAllottedResources> allottedResources = configContrailRouteAllottedResourcesRepository.findByAllottedResourceId(allottedResourceId);
+
+ if (allottedResources.isEmpty()) {
+ return new ResponseEntity<>(HttpStatus.NOT_FOUND);
+ }
+ else {
+ ConfigContrailRouteAllottedResources allottedResource = allottedResources.get(0);
+ retval = new GenericResourceApiContrailrouteallottedresourcesContrailRouteAllottedResource();
+ retval.setAllottedResourceId(allottedResourceId);
+ retval.setAllottedResourceStatus(allottedResource.getAllottedResourceStatus());
+ try {
+ retval.setAllottedResourceData(objectMapper.readValue(allottedResource.getArData(),
+ GenericResourceApiContrailrouteallottedresourcesContrailrouteallottedresourceAllottedResourceData.class));
+ } catch (JsonProcessingException e) {
+ log.error("Could not deserialize service data for service instance id {}", allottedResourceId, e);
+ throw new RestApplicationException("data-conversion", "Request could not be completed due to internal error", e, HttpStatus.INTERNAL_SERVER_ERROR.value());
+ }
+ }
+ return new ResponseEntity<>(retval, HttpStatus.OK);
+ }
+
+ /**
+ * PUT contrail-route-allotted-resource data from CONFIG_GRA_CONTRAIL_ROUTE_ALLOTTED_RESOURCES for a given allottedResourceId
+ * <p>
+ * Maps to /config/GENERIC-RESOURCE-API:contrail-route-allotted-resources/contrail-route-allotted-resource/{allotted-resource-id}
+ * @param allottedResourceId the allotted-resource-id for a contrail-route
+ * @return HttpStatus.OK (200) if the data is found.
+ * @throws RestException if the data does not exist.
+ */
+ @Override
+ public ResponseEntity<Void> configGENERICRESOURCEAPIcontrailRouteAllottedResourcesContrailRouteAllottedResourceAllottedResourceIdPut(
+ String allottedResourceId, @Valid GenericResourceApiContrailrouteallottedresourcesContrailRouteAllottedResource newAllottedResource)
+ throws RestApplicationException {
+
+ boolean dataExists = false;
+
+ String newAllottedResourceId = newAllottedResource.getAllottedResourceId();
+
+ ConfigContrailRouteAllottedResources allottedResource = null;
+ List<ConfigContrailRouteAllottedResources> existingAllottedResource =
+ configContrailRouteAllottedResourcesRepository.findByAllottedResourceId(allottedResourceId);
+
+ if ((existingAllottedResource != null) && !existingAllottedResource.isEmpty()) {
+ dataExists = true;
+ allottedResource = existingAllottedResource.get(0);
+ } else {
+ allottedResource = new ConfigContrailRouteAllottedResources();
+ allottedResource.setAllottedResourceId(allottedResourceId);
+ }
+
+ try {
+ allottedResource.setArData(objectMapper.writeValueAsString(newAllottedResource.getAllottedResourceData()));
+ } catch (JsonProcessingException e) {
+ log.error("Could not serialize porr-mirror configuration data for {}", allottedResource.getAllottedResourceId(), e);
+ throw new RestApplicationException("data-conversion", "Request could not be completed due to internal error", e, HttpStatus.INTERNAL_SERVER_ERROR.value());
+
+ }
+ allottedResource.setAllottedResourceStatus(newAllottedResource.getAllottedResourceStatus());
+ configContrailRouteAllottedResourcesRepository.save(allottedResource);
+
+ if (dataExists) {
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ } else {
+ return new ResponseEntity<>(HttpStatus.CREATED);
+ }
+ }
+
+ /**
+ * Extracts contrail-route-topology data from CONFIG_GRA_CONTRAIL_ROUTE_ALLOTTED_RESOURCES for a given allottedResourceId
+ * <p>
+ * Maps to /config/GENERIC-RESOURCE-API:contrail-route-allotted-resources/contrail-route-allotted-resource/{allotted-resource-id}/allotted-resource-data/contrail-route-topology/
+ * @param allottedResourceId the allotted-resource-id for a contrail-route
+ * @return HttpStatus.OK (200) if the data is found.
+ * @throws RestException if the data does not exist.
+ */
+ @Override
+ public ResponseEntity<GenericResourceApiContrailroutetopologyContrailRouteTopology>
+ configGENERICRESOURCEAPIcontrailRouteAllottedResourcesContrailRouteAllottedResourceAllottedResourceIdAllottedResourceDataContrailRouteTopologyGet(
+ String allottedResourceId) throws RestApplicationException, RestProtocolException {
+ @Valid GenericResourceApiContrailroutetopologyContrailRouteTopology contrailRouteTopology = null;
+ GenericResourceApiContrailrouteallottedresourcesContrailrouteallottedresourceAllottedResourceData allottedResourceData = null;
+
+ List<ConfigContrailRouteAllottedResources> configContrailRouteAllottedResources =
+ configContrailRouteAllottedResourcesRepository.findByAllottedResourceId(allottedResourceId);
+
+ if ((configContrailRouteAllottedResources == null) || (configContrailRouteAllottedResources.isEmpty())) {
+ throw new RestProtocolException("data-missing", "No port-mirror-configuration entry found", HttpStatus.NOT_FOUND.value());
+ }
+
+ try {
+ if ( configContrailRouteAllottedResources.get(0).getArData().isEmpty()) {
+ throw new RestProtocolException("data-missing", "No allotted-resource-data entry found", HttpStatus.NOT_FOUND.value());
+ } else {
+ allottedResourceData = objectMapper.readValue(configContrailRouteAllottedResources.get(0).getArData(),
+ GenericResourceApiContrailrouteallottedresourcesContrailrouteallottedresourceAllottedResourceData.class);
+
+ contrailRouteTopology = allottedResourceData.getContrailRouteTopology();
+ }
+ if (contrailRouteTopology == null) {
+ throw new RestProtocolException("data-missing", "No contrail-route-topology entry found", HttpStatus.NOT_FOUND.value());
+ }
+ return new ResponseEntity<>(contrailRouteTopology, HttpStatus.OK);
+ } catch (JsonProcessingException e) {
+ log.error("Could not parse port-mirror-configuration data", e);
+ throw new RestApplicationException("data-conversion", "Request could not be completed due to internal error", e, HttpStatus.INTERNAL_SERVER_ERROR.value());
+ }
+ }
+
+
+ /**
+ * DELETE allotted-resource data from CONFIG_GRA_CONTRAIL_ROUTE_ALLOTTED_RESOURCES for a given allottedResourceId
+ * <p>
+ * Maps to /config/GENERIC-RESOURCE-API:contrail-route-allotted-resources/contrail-route-allotted-resource/{allotted-resource-id}
+ * @param allottedResourceId the allotted-resource-id for a contrail-route
+ * @return HttpStatus.NO_CONTENT (204) if the data is found.
+ */
+ @Override
+ public ResponseEntity<Void> configGENERICRESOURCEAPIcontrailRouteAllottedResourcesContrailRouteAllottedResourceAllottedResourceIdDelete(
+ String allottedResourceId) {
+ configContrailRouteAllottedResourcesRepository.deleteByAllottedResourceId(allottedResourceId);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+
+
+
@Override
public ResponseEntity<GenericResourceApiPreloadModelInformation> configGENERICRESOURCEAPIpreloadInformationGet()
throws RestApplicationException {
@@ -1059,29 +1313,44 @@ public class ConfigApiController implements ConfigApi {
}
/**
+ * Extracts a vf-module object from the database,
+ * @param configServices A Config Services option created from a Service
+ * Instance ID
+ * @param vnfId the target VNF ID
+ * @param vfModuleId the target vf-module ID
+ * @return An empty Optional if the Service Data does not exist, an empty
+ * Optional if the VNF is not found, or an optional containing the
+ * found VNF.
+ */
+ private Optional<GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule> getVfModuleObject (
+ ConfigServices configServices, String vnfId, String vfModuleId) {
+ // Map the Marshall the JSON String into a Java Object
+ log.info("Getting vf-module Data for ({})", vfModuleId);
+
+ Optional<GenericResourceApiServicedataServicedataVnfsVnf> vnf = getVnfObject(configServices, vnfId);
+ GenericResourceApiServicedataServicedataVnfsVnfVnfData vnfData = vnf.get().getVnfData();
+
+ return vnfData.getVfModules().getVfModule()
+ .stream()
+ .filter(vf -> vf.getVfModuleId().equals(vfModuleId))
+ .findFirst();
+ }
+
+ /**
* Creates or updates VNF data in the Config table for a specified Service
* Instance. If it is a new Service Instance or a new VNF, creates all necessary
* parent data containers, then performs the updates.
* <p>
- * Maps to
- * /config/GENERIC-RESOURCE-API:services/service/{service-instance-id}/service-data/vnfs/vnf/{vnf-id}/
- *
- * @param serviceInstanceId the Service
- * Instance ID
- * to perform
- * the delete on
- * @param vnfId the VNF ID of
- * the VNF to
- * delete
+ * Maps to /config/GENERIC-RESOURCE-API:services/service/{service-instance-id}/service-data/vnfs/vnf/{vnf-id}/
+ * @param serviceInstanceId the Service Instance ID to perform the delete on
+ * @param vnfId the VNF ID of the VNF to delete
* @param genericResourceApiServicedataServicedataVnfsVnfBodyParam the playload
* @return HttpStatus.CREATED (201) on successful create
- * <p>
- * HttpStatus.NO_CONTENT (204) on successful update
- * <p>
- * HttpStatus.BAD_REQUEST (400) if {@code vnfId} does not match what is
- * specified in the
- * {@code genericResourceApiServicedataServicedataVnfsVnfBodyParam} , or
- * if updating the database fails.
+ * <p>
+ * HttpStatus.NO_CONTENT (204) on successful update
+ * <p>
+ * HttpStatus.BAD_REQUEST (400) if {@code vnfId} does not match what is specified in the
+ * {@code genericResourceApiServicedataServicedataVnfsVnfBodyParam} , or if updating the database fails.
* @throws RestException
*/
@Override
@@ -1422,33 +1691,15 @@ public class ConfigApiController implements ConfigApi {
* Service Instance. If it is a new Service Instance or a new VNF, creates all
* necessary parent data containers, then performs the updates.
* <p>
- * Maps to
- * /config/GENERIC-RESOURCE-API:services/service/{service-instance-id}/service-data/vnfs/vnf/{vnf-id}/vnf-data/vnf-topology/vnf-resource-assignments/vnf-networks/
- *
- * @param serviceInstanceId the
- * Service
- * Instance
- * ID
- * to
- * perform
- * the
- * delete
- * on
- * @param vnfId the
- * VNF
- * ID
- * of
- * the
- * VNF
- * to
- * delete
- * @param genericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworksBodyParam the
- * payload
+ * Maps to /config/GENERIC-RESOURCE-API:services/service/{service-instance-id}/service-data/vnfs/vnf/{vnf-id}/vnf-data/vnf-topology/vnf-resource-assignments/vnf-networks/
+ * @param serviceInstanceId the Service Instance ID to perform the delete on
+ * @param vnfId the VNF ID of the VNF to delete
+ * @param genericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworksBodyParam the * payload
* @return HttpStatus.CREATED (201) on successful create.
- * <p>
- * HttpStatus.NO_CONTENT (204) on successful update.
- * <p>
- * HttpStatus.BAD_REQUEST (400) if updating the database fails.
+ * <p>
+ * HttpStatus.NO_CONTENT (204) on successful update.
+ * <p>
+ * HttpStatus.BAD_REQUEST (400) if updating the database fails.
* @throws RestException
*/
@Override
@@ -1753,5 +2004,259 @@ public class ConfigApiController implements ConfigApi {
}
+ /**
+ * Extracts VF MODULE data from CONFIG_GRA_SERVICES for a given, service-instance-id, vnf-id, and vf-module-id
+ * <p>
+ * Maps to /config/GENERIC-RESOURCE-API:services/service/{service-instance-id}/service-data/vnfs/vnf/{vnf-id}/vnf-data/vf-modules/vf-module/{vf-module-id}/
+ * @param serviceInstanceId the Service Instance ID to lookup data for
+ * @param vnfId the VNF ID of the VNF to return
+ * @param vfModuleId the vf-moudle ID of a specific VNF to return
+ * @return HttpStatus.OK (200) if the data is found.
+ * @throws RestException if the data does not exist.
+ */
+ @Override
+ public ResponseEntity<GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule>
+ configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataVnfsVnfVnfIdVnfDataVfModulesVfModuleVfModuleIdGet(
+ String serviceInstanceId, String vnfId, String vfModuleId) throws RestException {
+
+ log.info("GET | Vf Module Data for ({})", vfModuleId);
+
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ if(getAcceptHeader().get().contains("application/json")) {
+ }
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default ConfigApi interface so no example is generated");
+ }
+ List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId);
+ if((services == null) || (services.isEmpty())) {
+ throw new RestProtocolException("data-missing", "No service entry found", HttpStatus.NOT_FOUND.value());
+ }
+
+ Optional<GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule> vfModule =
+ getVfModuleObject(services.get(0), vnfId, vfModuleId);
+ if(vfModule.isPresent()) {
+ return new ResponseEntity<>(vfModule.get(), HttpStatus.OK);
+ } else {
+ log.info("No vf-module found for [{}]", vfModuleId);
+ throw new RestApplicationException("data-missing", "Request could not be completed because the relevant data model content does not exist", HttpStatus.NOT_FOUND.value());
+ }
+ }
+
+ /**
+ * PUT VF MODULE data into CONFIG_GRA_SERVICES of a given, service-instance-id, vnf-id
+ * <p>
+ * Maps to /config/GENERIC-RESOURCE-API:services/service/{service-instance-id}/service-data/vnfs/vnf/{vnf-id}/vnf-data/vf-modules/vf-module/{vf-module-id}/
+ * @param serviceInstanceId the Service Instance ID
+ * @param vnfId the VNF ID as the parent of the specified vf-module-id and child of the specified service-instance
+ * @param vfModuleId the vf-moudle ID as a child of the specified VNF
+ * @return HttpStatus.OK (200) if the data is found.
+ * @throws RestException if the data does not exist.
+ */
+ @Override
+ public ResponseEntity<Void> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataVnfsVnfVnfIdVnfDataVfModulesVfModuleVfModuleIdPut(
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule genericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModuleBodyParam)
+ throws RestException {
+ log.info("PUT | vf-module Data of ({}) for vnf ({}) in service({})", vfModuleId, vnfId, serviceInstanceId);
+
+ if(! vfModuleId.equals(genericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModuleBodyParam.getVfModuleId())) {
+ throw new RestProtocolException("bad-attribute", "vf-module-id mismatch", HttpStatus.BAD_REQUEST.value());
+ }
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ log.info("Something with header");
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default ConfigApi interface so no example is generated");
+ }
+
+ HttpStatus responseStatus = HttpStatus.NO_CONTENT;
+ ConfigServices service;
+ GenericResourceApiServicedataServiceData svcData;
+ List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId);
+
+ if((services == null) || (services.isEmpty())) {
+ log.error("service-instance-id ({}) not found in SDN.", serviceInstanceId);
+ return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
+ } else {
+ service = services.get(0);
+ }
+
+ try {
+ svcData = objectMapper.readValue(service.getSvcData(), GenericResourceApiServicedataServiceData.class);
+ } catch(JsonProcessingException e) {
+ log.error("Error", e);
+ return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
+ }
+
+ GenericResourceApiServicedataServicedataVnfs vnfs = svcData.getVnfs();
+ Optional<GenericResourceApiServicedataServicedataVnfsVnf> vnf =
+ vnfs.getVnf()
+ .stream()
+ .filter(targetVnf -> targetVnf.getVnfId().equals(vnfId))
+ .findFirst();
+
+ if(! vnf.isPresent()) {
+ log.error("vnf-id ({}) not found in SDN.", vnfId);
+ return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
+ }
+
+ GenericResourceApiServicedataServicedataVnfsVnfVnfData vnfData = vnf.get().getVnfData();
+ GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules existingVfModules = vnfData.getVfModules();
+ GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules newVfModules = new GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules();
+ if (existingVfModules == null || existingVfModules.getVfModule().isEmpty()) {
+ log.info("No existing vf-module found. Creating the first vf-module for vnf [{}]", vnfId);
+ newVfModules.addVfModuleItem(genericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModuleBodyParam);
+ responseStatus = HttpStatus.CREATED;
+ }
+ else {
+ ArrayList<String> vfModuleIds = new ArrayList<>();
+ for (GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule vf : existingVfModules.getVfModule()) {
+ vfModuleIds.add(vf.getVfModuleId());
+ }
+ log.info("[{}] vf-module(s) {} found in vnf [{}]", existingVfModules.getVfModule().size(), vfModuleIds, vnfId);
+ if (!vfModuleIds.isEmpty() && vfModuleIds.contains(vfModuleId)) {
+ log.info("Overwriting vf-module [{}] in vnf [{}]", vfModuleId, vnfId);
+ } else {
+ log.info("Adding vf-module [{}] to vnf [{}]", vfModuleId, vnfId);
+ }
+ existingVfModules.getVfModule()
+ .stream()
+ .filter(vf -> ! vf.getVfModuleId().equals(vfModuleId))
+ .forEach(newVfModules::addVfModuleItem);
+ newVfModules.addVfModuleItem(genericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModuleBodyParam);
+ responseStatus = HttpStatus.OK;
+ }
+ vnfData.setVfModules(newVfModules);
+ // Map and save the new data
+ try {
+ service.setSvcData(objectMapper.writeValueAsString(svcData));
+ configServicesRepository.save(service);
+ return new ResponseEntity<>(responseStatus);
+ } catch(JsonProcessingException e) {
+ log.error("Error mapping object to JSON", e);
+ // Should probably be a 500 INTERNAL_SERVICE_ERROR
+ return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
+ }
+ }
+
+ /**
+ * Extracts VF MODULE Topology data from the Config table specified Service
+ * Instance and VNF ID.
+ * <p>
+ * Maps to /config/GENERIC-RESOURCE-API:services/service/{service-instance-id}/service-data/vnfs/vnf/{vnf-id}/vnf-data/vf-modules/vf-module/{vf-module-id}/vf-module-data/vf-module-topology/
+ * @param serviceInstanceId the Service Instance ID to lookup data for
+ * @param vnfId the VNF ID of the VNF to extract topology data from.
+ * @param vfModuleId the vf-module-idof the vf-module to extract topology data from.
+ * @return HttpStatus.OK (200) if the data is found.
+ * @throws RestException if the data does not exist.
+ */
+ @Override
+ public ResponseEntity<GenericResourceApiVfmoduletopologyVfModuleTopology>
+ configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataVnfsVnfVnfIdVnfDataVfModulesVfModuleVfModuleIdVfModuleDataVfModuleTopologyGet(
+ String serviceInstanceId, String vnfId, String vfModuleId) throws RestException {
+ log.info("GET | vf-module-topology for ({})", vfModuleId);
+ if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ if (getAcceptHeader().get().contains("application/json")) {
+
+ }
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default ConfigApi interface so no example is generated");
+ }
+ List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId);
+ if((services == null) || (services.isEmpty())) {
+ throw new RestProtocolException("data-missing", "No service entry found", HttpStatus.NOT_FOUND.value());
+ }
+
+ Optional<GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule> vfModule =
+ getVfModuleObject(services.get(0), vnfId, vfModuleId);
+ if(vfModule.isPresent()
+ && vfModule.get().getVfModuleData() != null
+ && vfModule.get().getVfModuleData().getVfModuleTopology() != null) {
+ return new ResponseEntity<>(vfModule.get().getVfModuleData().getVfModuleTopology(), HttpStatus.OK);
+ } else {
+ log.info("No information found for {}", vfModuleId);
+ throw new RestApplicationException("data-missing", "Request could not be completed because the relevant data model content does not exist", HttpStatus.NOT_FOUND.value());
+ }
+ }
+
+ @Override
+ public ResponseEntity<Void> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataVnfsVnfVnfIdVnfDataVfModulesVfModuleVfModuleIdDelete(
+ String serviceInstanceId, String vnfId, String vfModuleId) throws RestProtocolException {
+
+ log.info("DELETE | vf-module Data for ({})", vfModuleId);
+
+ if (getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
+ log.info("Something with header.");
+ } else {
+ log.warn("ObjectMapper or HttpServletRequest not configured in default ConfigApi interface so no example is generated");
+ }
+
+ ConfigServices service;
+ GenericResourceApiServicedataServiceData svcData;
+ List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId);
+
+ if((services == null) || (services.isEmpty())) {
+ log.error("service-instance-id ({}) not found in SDN.", serviceInstanceId);
+ return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
+ } else {
+ service = services.get(0);
+ }
+
+ try {
+ svcData = objectMapper.readValue(service.getSvcData(), GenericResourceApiServicedataServiceData.class);
+ } catch(JsonProcessingException e) {
+ log.error("Error", e);
+ return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
+ }
+
+ GenericResourceApiServicedataServicedataVnfs vnfs = svcData.getVnfs();
+ Optional<GenericResourceApiServicedataServicedataVnfsVnf> vnf =
+ vnfs.getVnf()
+ .stream()
+ .filter(targetVnf -> targetVnf.getVnfId().equals(vnfId))
+ .findFirst();
+
+ if(! vnf.isPresent()) {
+ log.error("vnf-id ({}) not found in SDN.", vnfId);
+ return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
+ }
+
+ GenericResourceApiServicedataServicedataVnfsVnfVnfData vnfData = vnf.get().getVnfData();
+ GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules existingVfModules = vnfData.getVfModules();
+ GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules newVfModules = new GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfModules();
+
+ if (existingVfModules == null || existingVfModules.getVfModule().isEmpty()) {
+ log.info("No existing vf-module found. Creating the first vf-module for vnf [{}]", vnfId);
+ return new ResponseEntity<>(HttpStatus.OK);
+ }
+
+ ArrayList<String> vfModuleIds = new ArrayList<>();
+ for (GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule vf : existingVfModules.getVfModule()) {
+ vfModuleIds.add(vf.getVfModuleId());
+ }
+ log.info("[{}] vf-module(s) {} found in vnf [{}]", existingVfModules.getVfModule().size(), vfModuleIds, vnfId);
+ if (!vfModuleIds.isEmpty() && vfModuleIds.contains(vfModuleId)) {
+ log.info("Deleting vf-module [{}] from vnf [{}]", vfModuleId, vnfId);
+ } else {
+ log.info("vf-module [{}] not found in vnf [{}]", vfModuleId, vnfId);
+ return new ResponseEntity<>(HttpStatus.OK);
+ }
+ existingVfModules.getVfModule()
+ .stream()
+ .filter(vf -> ! vf.getVfModuleId().equals(vfModuleId))
+ .forEach(newVfModules::addVfModuleItem);
+ vnfData.setVfModules(newVfModules);
+ log.info("vf-module [{}] deleted from vnf [{}]", vfModuleId, vnfId);
+
+ // Map and save the new data
+ try {
+ service.setSvcData(objectMapper.writeValueAsString(svcData));
+ configServicesRepository.save(service);
+ return new ResponseEntity<>(HttpStatus.OK);
+ } catch(JsonProcessingException e) {
+ log.error("Error mapping object to JSON", e);
+ // Should probably be a 500 INTERNAL_SERVICE_ERROR
+ return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
+ }
+ }
}
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiController.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiController.java
index 6a4e561..4806652 100644
--- a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiController.java
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiController.java
@@ -35,10 +35,18 @@ import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadData;
import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadDataRepository;
import org.onap.sdnc.apps.ms.gra.data.ConfigServices;
import org.onap.sdnc.apps.ms.gra.data.ConfigServicesRepository;
+import org.onap.sdnc.apps.ms.gra.data.ConfigContrailRouteAllottedResources;
+import org.onap.sdnc.apps.ms.gra.data.ConfigContrailRouteAllottedResourcesRepository;
+import org.onap.sdnc.apps.ms.gra.data.ConfigPortMirrorConfigurations;
+import org.onap.sdnc.apps.ms.gra.data.ConfigPortMirrorConfigurationsRepository;
import org.onap.sdnc.apps.ms.gra.data.OperationalPreloadData;
import org.onap.sdnc.apps.ms.gra.data.OperationalPreloadDataRepository;
import org.onap.sdnc.apps.ms.gra.data.OperationalServices;
import org.onap.sdnc.apps.ms.gra.data.OperationalServicesRepository;
+import org.onap.sdnc.apps.ms.gra.data.OperationalContrailRouteAllottedResources;
+import org.onap.sdnc.apps.ms.gra.data.OperationalContrailRouteAllottedResourcesRepository;
+import org.onap.sdnc.apps.ms.gra.data.OperationalPortMirrorConfigurations;
+import org.onap.sdnc.apps.ms.gra.data.OperationalPortMirrorConfigurationsRepository;
import org.onap.sdnc.apps.ms.gra.swagger.OperationsApi;
import org.onap.sdnc.apps.ms.gra.swagger.model.*;
import org.springframework.beans.factory.annotation.Autowired;
@@ -70,8 +78,12 @@ public class OperationsApiController implements OperationsApi {
private static final String VNF_OBJECT_PATH_PARAM = "vnf-object-path";
private static final String PNF_OBJECT_PATH_PARAM = "pnf-object-path";
private static final String VF_MODULE_OBJECT_PATH_PARAM = "vf-module-object-path";
- private static final String VF_MODULE_ID_PARAM = "vf-module-id";
-
+ private static final String PORT_MIRROR_OBJECT_PATH_PARAM = "port-mirror-object-path";
+ private static final String BACKGROUND_THREAD_STARTED_MESSAGE = "Start background thread";
+ private static final String BACKGROUND_THREAD_INFO = "Background thread: input conf_id is {}";
+ private static final String SKIP_MDSAL_UPDATE_PROP = "skip-mdsal-update";
+ private static final String ADDING_INPUT_DATA_LOG = "Adding INPUT data for {} [{}] input: {}";
+ private static final String ADDING_OPERATIONAL_DATA_LOG = "Adding OPERATIONAL data for {} [{}] operational-data: {}";
private final ObjectMapper objectMapper;
@@ -92,6 +104,18 @@ public class OperationsApiController implements OperationsApi {
@Autowired
private OperationalServicesRepository operationalServicesRepository;
+ @Autowired
+ private ConfigContrailRouteAllottedResourcesRepository configContrailRouteAllottedResourcesRepository;
+
+ @Autowired
+ private OperationalContrailRouteAllottedResourcesRepository operationalContrailRouteAllottedResourcesRepository;
+
+ @Autowired
+ private ConfigPortMirrorConfigurationsRepository configPortMirrorConfigurationsRepository;
+
+ @Autowired
+ private OperationalPortMirrorConfigurationsRepository operationalPortMirrorConfigurationsRepository;
+
private static class Iso8601Util {
private static TimeZone timeZone = TimeZone.getTimeZone("UTC");
@@ -385,6 +409,44 @@ public class OperationsApiController implements OperationsApi {
|| input.getServiceInformation().getServiceInstanceId().length() == 0;
}
+ private boolean hasInvalidServiceId(GenericResourceApiVfModuleOperationInformation input) {
+
+ return input == null || input.getServiceInformation() == null
+ || input.getServiceInformation().getServiceInstanceId() == null
+ || input.getServiceInformation().getServiceInstanceId().length() == 0;
+ }
+
+ private boolean hasInvalidServiceId(GenericResourceApiPortMirrorTopologyOperationInformation input) {
+
+ return input == null || input.getServiceInformation() == null
+ || input.getServiceInformation().getServiceInstanceId() == null
+ || input.getServiceInformation().getServiceInstanceId().length() == 0;
+ }
+
+ private boolean hasInvalidServiceId(GenericResourceApiVnfgetresourcerequestInput input) {
+
+ return input == null || input.getServiceInformation() == null
+ || input.getServiceInformation().getServiceInstanceId() == null
+ || input.getServiceInformation().getServiceInstanceId().length() == 0;
+ }
+
+ private boolean hasInvalidVnfId(GenericResourceApiVfModuleOperationInformation input) {
+
+ return input == null || input.getVnfInformation() == null
+ || input.getVnfInformation().getVnfId() == null
+ || input.getVnfInformation().getVnfId().length() == 0;
+ }
+
+ private boolean hasInvalidConfigurationId(GenericResourceApiPortMirrorTopologyOperationInformation input) {
+ return input.getConfigurationInformation() == null
+ || input.getConfigurationInformation().getConfigurationId() == null
+ || input.getConfigurationInformation().getConfigurationId().length() == 0;
+ }
+
+ private boolean hasInvalidPolicyUpdateInput(GenericResourceApiPolicyupdatenotifyoperationInput input) {
+ return (input.getPolicyName() == null) || (input.getUpdateType() == null) || (input.getVersionId() == null);
+ }
+
private GenericResourceApiPreloaddataPreloadData getConfigPreloadData(String preloadId, String preloadType)
throws JsonProcessingException {
@@ -857,5 +919,663 @@ public class OperationsApiController implements OperationsApi {
return (new ResponseEntity<>(retval, HttpStatus.OK));
}
-
+ @Override
+ public ResponseEntity<GenericResourceApiVfModuleTopologyOperation> operationsGENERICRESOURCEAPIvfModuleTopologyOperationPost(
+ @Valid GenericResourceApiVfModuleOperationInformationBodyparam input)
+ throws RestException {
+ final String svcOperation = "vf-module-topology-operation";
+ GenericResourceApiVfModuleTopologyOperation retval = new GenericResourceApiVfModuleTopologyOperation();
+ GenericResourceApiVfmoduletopologyoperationOutput resp = new GenericResourceApiVfmoduletopologyoperationOutput();
+
+ log.info(CALLED_STR, svcOperation);
+ // Verify input contains service instance id
+ if (hasInvalidServiceId(input.getInput())) {
+ log.debug("exiting {} because of null or empty service-instance-id", svcOperation);
+
+ resp.setResponseCode("404");
+ resp.setResponseMessage("null or empty service-instance-id");
+ resp.setAckFinalIndicator("Y");
+ retval.setOutput(resp);
+ return new ResponseEntity<>(retval, HttpStatus.OK);
+ }
+
+ // Verify input contains vnf-id
+ if (hasInvalidVnfId(input.getInput())) {
+ log.debug("exiting {} because of null or empty vnf-id", svcOperation);
+
+ resp.setResponseCode("404");
+ resp.setResponseMessage("null or empty vnf-id");
+ resp.setAckFinalIndicator("Y");
+ retval.setOutput(resp);
+ return new ResponseEntity<>(retval, HttpStatus.OK);
+ }
+
+ String svcInstanceId = input.getInput().getServiceInformation().getServiceInstanceId();
+ String vnfId = input.getInput().getVnfInformation().getVnfId();
+ String vfModuleId = input.getInput().getVfModuleInformation().getVfModuleId();
+
+ SvcLogicContext ctxIn = new SvcLogicContext();
+
+ // Add input to SvcLogicContext
+ try {
+ ctxIn.mergeJson(svcOperation + "-input", objectMapper.writeValueAsString(input.getInput()));
+ } catch (JsonProcessingException e) {
+ log.error("exiting {} due to parse error on input data", svcOperation);
+ resp.setResponseCode("500");
+ resp.setResponseMessage("internal error");
+ resp.setAckFinalIndicator("Y");
+ retval.setOutput(resp);
+ return new ResponseEntity<>(retval, HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+
+ // Add config tree data to SvcLogicContext
+ List<ConfigServices> configServices = configServicesRepository.findBySvcInstanceId(svcInstanceId);
+ ConfigServices configService = null;
+ if (configServices != null && !configServices.isEmpty()) {
+ configService = configServices.get(0);
+ log.info("Read ({}) data for [{}] service-data: {}",
+ "CONFIG_GRA_PORT_MIRROR_CONFIGURATIONS", svcInstanceId, configService.getSvcData().toString());
+ ctxIn.mergeJson("service-data", configService.getSvcData());
+ } else {
+ log.debug("exiting {} because the service-instance does not have any service data in SDN", svcOperation);
+ resp.setResponseCode("404");
+ resp.setResponseMessage("invalid input: the service-instance does not have any service data in SDNC");
+ resp.setAckFinalIndicator("Y");
+ retval.setOutput(resp);
+ return new ResponseEntity<>(retval, HttpStatus.OK);
+ }
+
+ // Add operational tree data to SvcLogicContext
+ List<OperationalServices> operServices = operationalServicesRepository.findBySvcInstanceId(svcInstanceId);
+ OperationalServices operService = null;
+
+ if (operServices != null && !operServices.isEmpty()) {
+ operService = operServices.get(0);
+ log.info("Read ({}) data for [{}] operational-data: {}",
+ "OPERATIONAL_GRA_PORT_MIRROR_CONFIGURATIONS", svcInstanceId, operService.getSvcData().toString());
+ //ctxIn.mergeJson("operational-data", operService.getSvcData());
+ } else {
+ log.info("No operational-data found in OPERATIONAL_GRA_PORT_MIRROR_CONFIGURATIONS for [{}]", svcInstanceId);
+ operService = new OperationalServices(svcInstanceId, null, null);
+ }
+
+ // Update service status info in config entry from input
+ configService.setServiceStatusAction(input.getInput().getRequestInformation().getRequestAction().toString());
+ configService.setServiceStatusRpcAction(input.getInput().getSdncRequestHeader().getSvcAction().toString());
+ configService.setServiceStatusRpcName(svcOperation);
+
+ String ackFinal = "Y";
+ String skipMdsalUpdate;
+
+ // Call DG
+ try {
+ // Any of these can throw a nullpointer exception
+ // execute should only throw a SvcLogicException
+ SvcLogicContext ctxOut = svc.execute(MODULE_NAME, svcOperation, null, "sync", ctxIn);
+ Properties respProps = ctxOut.toProperties();
+
+ ackFinal = respProps.getProperty("ack-final", "Y");
+ skipMdsalUpdate = respProps.getProperty("skip-mdsal-update", "N");
+ log.info("ackFinal [{}], skipMdsalUpdate [{}]", ackFinal, skipMdsalUpdate);
+
+ resp.setAckFinalIndicator(ackFinal);
+ resp.setResponseCode(respProps.getProperty("error-code", "200"));
+ resp.setResponseMessage(respProps.getProperty("error-message", "SUCCESS"));
+
+ // Update status in config services entry
+ configService.setServiceStatusFinalIndicator(resp.getAckFinalIndicator());
+ configService.setServiceStatusResponseCode(resp.getResponseCode());
+ configService.setServiceStatusResponseMessage(resp.getResponseMessage());
+ configService.setServiceStatusResponseTimestamp(Iso8601Util.now());
+ configService
+ .setServiceStatusRequestStatus(GenericResourceApiRequestStatusEnumeration.SYNCCOMPLETE.toString());
+
+ if ("200".equals(resp.getResponseCode())) {
+
+ GenericResourceApiInstanceReference serviceReference = new GenericResourceApiInstanceReference();
+ serviceReference.setInstanceId(svcInstanceId);
+ serviceReference.setObjectPath(respProps.getProperty(SERVICE_OBJECT_PATH_PARAM));
+ resp.setServiceResponseInformation(serviceReference);
+
+ GenericResourceApiInstanceReference vnfReference = new GenericResourceApiInstanceReference();
+ vnfReference.setInstanceId(vnfId);
+ vnfReference.setObjectPath(respProps.getProperty(VNF_OBJECT_PATH_PARAM));
+ resp.setVnfResponseInformation(vnfReference);
+
+ GenericResourceApiInstanceReference vfModuleReference = new GenericResourceApiInstanceReference();
+ vnfReference.setInstanceId(vfModuleId);
+ vnfReference.setObjectPath(respProps.getProperty(VF_MODULE_OBJECT_PATH_PARAM));
+ resp.setVnfResponseInformation(vfModuleReference);
+
+ if (skipMdsalUpdate.equals("N")) {
+ // If DG returns success,
+ // ONLY update svcData in config and operational trees
+ // and remember to save operational data when skip-mdsal-update is Y in ctx.
+ String ctxJson = ctxOut.toJsonString("service-data");
+ log.info("Saving service-data in SDN because skiMdsalUpdate is {}", skipMdsalUpdate);
+ configService.setSvcData(ctxJson);
+ configServicesRepository.save(configService);
+
+ log.info("Copying service-data to operational-data");
+ operService.setSvcData(ctxJson);
+ operService.setServiceStatus(configService.getServiceStatus());
+ operationalServicesRepository.save(operService);
+ }
+ }
+ } catch (NullPointerException npe) {
+ resp.setAckFinalIndicator("Y");
+ resp.setResponseCode("500");
+ resp.setResponseMessage("Check that you populated module, rpc and or mode correctly.");
+ } catch (SvcLogicException e) {
+ resp.setAckFinalIndicator("Y");
+ }
+
+ if (ackFinal.equals("N")) {
+ // Spawn background thread to invoke the Async DG
+ Runnable backgroundThread = new Runnable() {
+ public void run() {
+ log.info(BACKGROUND_THREAD_STARTED_MESSAGE);
+ processAsyncVfModuleTopologyOperation(svcOperation, input);
+ }
+ };
+ new Thread(backgroundThread).start();
+ }
+ retval.setOutput(resp);
+ return (new ResponseEntity<>(retval, HttpStatus.OK));
+ }
+
+ public void processAsyncVfModuleTopologyOperation( String parentOperation,
+ @Valid GenericResourceApiVfModuleOperationInformationBodyparam input) {
+ log.info(BACKGROUND_THREAD_INFO, input.getInput().getVfModuleInformation().getVfModuleId());
+ final String svcOperation = "vf-module-topology-operation-async";
+
+ log.info(CALLED_STR, svcOperation);
+ String svcInstanceId = input.getInput().getServiceInformation().getServiceInstanceId();
+ SvcLogicContext ctxIn = new SvcLogicContext();
+
+ // Add input to SvcLogicContext
+ try {
+ ctxIn.mergeJson(parentOperation + "-input", objectMapper.writeValueAsString(input.getInput()));
+ } catch (JsonProcessingException e) {
+ log.error("exiting {} due to parse error on input data", svcOperation);
+ return;
+ }
+
+ // Add config tree data to SvcLogicContext
+ List<ConfigServices> configServices = configServicesRepository.findBySvcInstanceId(svcInstanceId);
+ ConfigServices configService = null;
+ if (configServices != null && !configServices.isEmpty()) {
+ configService = configServices.get(0);
+ log.info("Read ({}) data for [{}] service-data: {}",
+ "CONFIG_GRA_PORT_MIRROR_CONFIGURATIONS", svcInstanceId, configService.getSvcData().toString());
+ ctxIn.mergeJson("service-data", configService.getSvcData());
+ } else {
+ log.debug("exiting {} because the service-instance does not have any service data in SDN", svcOperation);
+ return;
+ }
+
+ // Add operational tree data to SvcLogicContext
+ List<OperationalServices> operServices = operationalServicesRepository.findBySvcInstanceId(svcInstanceId);
+ OperationalServices operService = null;
+
+ if (operServices != null && !operServices.isEmpty()) {
+ operService = operServices.get(0);
+ log.info("Read ({}) data for [{}] operational-data: {}",
+ "OPERATIONAL_GRA_PORT_MIRROR_CONFIGURATIONS", svcInstanceId, operService.getSvcData().toString());
+ //ctxIn.mergeJson("operational-data", operService.getSvcData());
+ } else {
+ log.info("No operational-data found in OPERATIONAL_GRA_PORT_MIRROR_CONFIGURATIONS for [{}]", svcInstanceId);
+ operService = new OperationalServices(svcInstanceId, null, null);
+ }
+
+ // Update service status info in config entry from input
+ configService.setServiceStatusAction(input.getInput().getRequestInformation().getRequestAction().toString());
+ configService.setServiceStatusRpcAction(input.getInput().getSdncRequestHeader().getSvcAction().toString());
+ configService.setServiceStatusRpcName(svcOperation);
+
+ String respStatus = "SUCCESS";
+ String errorMessage = null;
+
+ log.info ("Adding INPUT data for {} [{}] input: {}", svcOperation, svcInstanceId, input.getInput().toString());
+
+ // Call DG
+ try {
+ // Any of these can throw a nullpointer exception
+ // execute should only throw a SvcLogicException
+ SvcLogicContext ctxOut = svc.execute(MODULE_NAME, svcOperation, null, "sync", ctxIn);
+ Properties respProps = ctxOut.toProperties();
+
+ String ackFinal = respProps.getProperty("ack-final-indicator", "Y");
+ String errorCode = respProps.getProperty("error-code", "200");
+ errorMessage = respProps.getProperty("error-message", "SUCCESS");
+
+ if (! "200".equals(errorCode)) {
+ respStatus = "FAILED";
+ }
+
+ // Update status in config services entry
+ configService.setServiceStatusFinalIndicator(ackFinal);
+ configService.setServiceStatusResponseTimestamp(Iso8601Util.now());
+ configService.setServiceStatusResponseCode(errorCode);
+ configService.setServiceStatusResponseMessage(errorMessage);
+ configService
+ .setServiceStatusRequestStatus(GenericResourceApiRequestStatusEnumeration.SYNCCOMPLETE.toString());
+
+ String ctxJson = ctxOut.toJsonString("service-data");
+ configServicesRepository.save(configService);
+
+ operService.setSvcData(ctxJson);
+ operService.setServiceStatus(configService.getServiceStatus());
+ operationalServicesRepository.save(operService);
+
+ } catch (Exception ex) {
+ log.error("Caught Exception updating service status in SDN for {} [{}] \n", svcOperation, svcInstanceId);
+ }
+ log.info("Returned {} for {} [{}] {}.", respStatus, svcOperation, svcInstanceId, errorMessage);
+ }
+
+ @Override
+ public ResponseEntity<GenericResourceApiPortMirrorTopologyOperation> operationsGENERICRESOURCEAPIportMirrorTopologyOperationPost(
+ @Valid GenericResourceApiPortMirrorTopologyOperationInformationBodyparam input)
+ throws RestException {
+ final String svcOperation = "port-mirror-topology-operation";
+ GenericResourceApiPortMirrorTopologyOperation retval = new GenericResourceApiPortMirrorTopologyOperation();
+ GenericResourceApiPortmirrortopologyoperationOutput resp = new GenericResourceApiPortmirrortopologyoperationOutput();
+
+ log.info(CALLED_STR, svcOperation);
+
+ // Verify input contains configuration-id
+ if (hasInvalidConfigurationId(input.getInput())) {
+ log.debug("exiting {} because of null or empty configuration-id", svcOperation);
+
+ resp.setResponseCode("404");
+ resp.setResponseMessage("null or empty configuration-id");
+ resp.setAckFinalIndicator("Y");
+ retval.setOutput(resp);
+ return new ResponseEntity<>(retval, HttpStatus.OK);
+ }
+
+ // Verify input contains service instance id
+ if (hasInvalidServiceId(input.getInput())) {
+ log.debug("exiting {} because of null or empty service-instance-id", svcOperation);
+
+ resp.setResponseCode("404");
+ resp.setResponseMessage("null or empty service-instance-id");
+ resp.setAckFinalIndicator("Y");
+ retval.setOutput(resp);
+ return new ResponseEntity<>(retval, HttpStatus.OK);
+ }
+
+ String svcInstanceId = input.getInput().getServiceInformation().getServiceInstanceId();
+ String configurationId = input.getInput().getConfigurationInformation().getConfigurationId();
+
+ SvcLogicContext ctxIn = new SvcLogicContext();
+
+ // Add input to SvcLogicContext
+ try {
+ ctxIn.mergeJson(svcOperation + "-input", objectMapper.writeValueAsString(input.getInput()));
+ } catch (JsonProcessingException e) {
+ log.error("exiting {} due to parse error on input data", svcOperation);
+ resp.setResponseCode("500");
+ resp.setResponseMessage("internal error");
+ resp.setAckFinalIndicator("Y");
+ retval.setOutput(resp);
+ return new ResponseEntity<>(retval, HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+
+ // Add service instance config data to SvcLogicContext
+ List<ConfigServices> configServices = configServicesRepository.findBySvcInstanceId(svcInstanceId);
+ ConfigServices configService = null;
+ if (configServices != null && !configServices.isEmpty()) {
+ configService = configServices.get(0);
+ log.info("Read ({}) data for [{}] service-data: {}", "CONFIG_GRA_SERVICES", svcInstanceId, configService.getSvcData());
+ ctxIn.mergeJson("service-data", configService.getSvcData());
+
+ } else {
+ log.debug("exiting {} because there is no service data with id [{}] in SDN", svcOperation, svcInstanceId);
+ resp.setResponseCode("404");
+ resp.setResponseMessage("invalid input: there is no service-instance with id [{}] in SDNC");
+ resp.setAckFinalIndicator("Y");
+
+ retval.setOutput(resp);
+ return new ResponseEntity<>(retval, HttpStatus.OK);
+ }
+
+ // Add configuration config data to SvcLogicContext
+ List<ConfigPortMirrorConfigurations> configPortMirrorConfigurations =
+ configPortMirrorConfigurationsRepository.findByConfigurationId(configurationId);
+ ConfigPortMirrorConfigurations configPortMirrorConfiguration;
+ if (configPortMirrorConfigurations != null && !configPortMirrorConfigurations.isEmpty()) {
+ configPortMirrorConfiguration = configPortMirrorConfigurations.get(0);
+ log.info("Read ({}) data for [{}] configuration-data: {}",
+ "CONFIG_GRA_PORT_MIRROR_CONFIGURATIONS", configurationId, configPortMirrorConfiguration.getPmcData());
+ ctxIn.mergeJson("configuration-data", configPortMirrorConfiguration.getPmcData());
+
+ } else {
+ log.info("No configuration-data found ({}) for [{}]", "CONFIG_GRA_PORT_MIRROR_CONFIGURATIONS", configurationId);
+ configPortMirrorConfiguration = new ConfigPortMirrorConfigurations(configurationId, null);
+ }
+
+ /*
+ // Add configuration operational data to SvcLogicContext
+ List<OperationalPortMirrorConfigurations> operPortMirrorConfigurations =
+ operationalPortMirrorConfigurationsRepository.findByConfigurationId(configurationId);
+ OperationalPortMirrorConfigurations operPortMirrorConfiguration;
+
+ if (operPortMirrorConfigurations != null && !operPortMirrorConfigurations.isEmpty()) {
+ operPortMirrorConfiguration = operPortMirrorConfigurations.get(0);
+ log.info("Read ({}) data for [{}] operational-data: {}",
+ "OPERATIONAL_GRA_PORT_MIRROR_CONFIGURATIONS", configurationId, operPortMirrorConfiguration.getPmcData());
+ ctxIn.mergeJson("operational-data", operPortMirrorConfiguration.getPmcData());
+
+ } else {
+ log.info("No operational-data found ({}) for [{}]", "OPERATIONAL_GRA_PORT_MIRROR_CONFIGURATIONS", configurationId);
+ operPortMirrorConfiguration = new OperationalPortMirrorConfigurations(configurationId, null, null);
+ }
+
+ */
+
+ String ackFinal = "Y";
+ String errorCode = "200";
+ String errorMessage = "SUCCESS";
+ String respStatus = "SUCCESS";
+
+ log.info(ADDING_INPUT_DATA_LOG, svcOperation, svcInstanceId, input.getInput().toString());
+ //log.info(ADDING_INPUT_DATA_LOG, svcOperation, svcInstanceId, input.toString());
+
+ // Update service status info in config entry from input
+ configPortMirrorConfiguration.setPortMirrorConfigurationStatusAction(input.getInput().getRequestInformation().getRequestAction().toString());
+ configPortMirrorConfiguration.setPortMirrorConfigurationStatusRpcAction(input.getInput().getSdncRequestHeader().getSvcAction().toString());
+ configPortMirrorConfiguration.setPortMirrorConfigurationStatusRpcName(svcOperation);
+
+ // Call DG
+ try {
+ // Any of these can throw a nullpointer exception
+ // execute should only throw a SvcLogicException
+ SvcLogicContext ctxOut = svc.execute(MODULE_NAME, svcOperation, null, "sync", ctxIn);
+ Properties respProps = ctxOut.toProperties();
+
+ ackFinal = respProps.getProperty("ack-final", "Y");
+ errorCode = respProps.getProperty("error-code", "200");
+ errorMessage = respProps.getProperty("error-message", "SUCCESS");
+ log.info("ackFinal [{}], error-code [{}], error-message [{}]", ackFinal, errorCode, errorMessage);
+
+ resp.setAckFinalIndicator(ackFinal);
+ resp.setResponseCode(errorCode);
+ resp.setResponseMessage(errorMessage);
+
+ // Update status in config services entry
+ configPortMirrorConfiguration
+ .setPortMirrorConfigurationStatusRequestStatus(GenericResourceApiRequestStatusEnumeration.SYNCCOMPLETE.toString());
+ configPortMirrorConfiguration.setPortMirrorConfigurationStatusFinalIndicator(resp.getAckFinalIndicator());
+ configPortMirrorConfiguration.setPortMirrorConfigurationStatusResponseCode(resp.getResponseCode());
+ configPortMirrorConfiguration.setPortMirrorConfigurationStatusResponseMessage(resp.getResponseMessage());
+ configPortMirrorConfiguration.setPortMirrorConfigurationStatusResponseTimestamp(Iso8601Util.now());
+
+ GenericResourceApiInstanceReference serviceReference = new GenericResourceApiInstanceReference();
+ serviceReference.setInstanceId(svcInstanceId);
+ serviceReference.setObjectPath(respProps.getProperty(SERVICE_OBJECT_PATH_PARAM));
+ resp.setServiceResponseInformation(serviceReference);
+
+ GenericResourceApiInstanceReference pmcReference = new GenericResourceApiInstanceReference();
+ serviceReference.setInstanceId(configurationId);
+ serviceReference.setObjectPath(respProps.getProperty(PORT_MIRROR_OBJECT_PATH_PARAM));
+ resp.setServiceResponseInformation(pmcReference);
+
+ retval.setOutput(resp);
+
+ // ONLY update pmcData in config and operational trees
+ //String ctxJson = ctxOut.toJsonString("configuration-data");
+ //configPortMirrorConfiguration.setPmcData(ctxJson);
+ //operPortMirrorConfiguration.setPmcData(ctxJson);
+ //configPortMirrorConfigurationsRepository.save(configPortMirrorConfiguration);
+
+ // If necessary, sync status to operation service entry and save
+ //operPortMirrorConfiguration.setPortMirrorConfigurationStatus(configPortMirrorConfiguration.getPortMirrorConfigurationStatus());
+ //operationalPortMirrorConfigurationsRepository.save(operPortMirrorConfiguration);
+
+ if (! "200".equals(errorCode)) {
+ respStatus = "FAILED";
+ }
+
+ } catch (NullPointerException npe) {
+ resp.setAckFinalIndicator("Y");
+ resp.setResponseCode("500");
+ resp.setResponseMessage("Check that you populated module, rpc and or mode correctly.");
+ } catch (SvcLogicException e) {
+ resp.setAckFinalIndicator("Y");
+ }
+
+ if (ackFinal.equals("N")) {
+ // Spawn background thread to invoke the Async DG
+ Runnable backgroundThread = new Runnable() {
+ public void run() {
+ log.info(BACKGROUND_THREAD_STARTED_MESSAGE);
+ processAsyncPortMirrorTopologyOperation(svcOperation, input);
+ }
+ };
+ new Thread(backgroundThread).start();
+ }
+ log.info("Returned {} for {} [{}] {}.", respStatus, svcOperation, configurationId, errorMessage);
+ return (new ResponseEntity<>(retval, HttpStatus.OK));
+ }
+
+ public void processAsyncPortMirrorTopologyOperation( String parentOperation,
+ @Valid GenericResourceApiPortMirrorTopologyOperationInformationBodyparam input) {
+ log.info(BACKGROUND_THREAD_INFO, input.getInput().getConfigurationInformation().getConfigurationId());
+ final String svcOperation = "port-mirror-topology-operation-async";
+
+ log.info(CALLED_STR, svcOperation);
+ String svcInstanceId = input.getInput().getServiceInformation().getServiceInstanceId();
+ String configurationId = input.getInput().getConfigurationInformation().getConfigurationId();
+ SvcLogicContext ctxIn = new SvcLogicContext();
+
+ String errorMessage;
+
+ // Add input to SvcLogicContext
+ try {
+ ctxIn.mergeJson(parentOperation + "-input", objectMapper.writeValueAsString(input.getInput()));
+ } catch (JsonProcessingException e) {
+ log.error("exiting {} due to parse error on input data", svcOperation);
+ return;
+ }
+
+ // Add service instance config data to SvcLogicContext
+ List<ConfigServices> configServices = configServicesRepository.findBySvcInstanceId(svcInstanceId);
+ ConfigServices configService = null;
+ if (configServices != null && !configServices.isEmpty()) {
+ configService = configServices.get(0);
+ ctxIn.mergeJson("service-data", configService.getSvcData());
+ } else {
+ log.error("exiting {} because there is no service data with id [{}] in SDN", svcOperation, svcInstanceId);
+ return;
+ }
+
+ // Add config tree data to SvcLogicContext
+ List<ConfigPortMirrorConfigurations> configPortMirrorConfigurations = configPortMirrorConfigurationsRepository.findByConfigurationId(configurationId);
+ ConfigPortMirrorConfigurations configPortMirrorConfiguration;
+ if (configPortMirrorConfigurations != null && !configPortMirrorConfigurations.isEmpty()) {
+ configPortMirrorConfiguration = configPortMirrorConfigurations.get(0);
+ ctxIn.mergeJson("configuration-data", configPortMirrorConfiguration.getPmcData());
+ } else {
+ configPortMirrorConfiguration = new ConfigPortMirrorConfigurations(configurationId, null);
+ }
+
+ /*
+ // Add operational tree data to SvcLogicContext
+ List<OperationalPortMirrorConfigurations> operPortMirrorConfigurations = operationalPortMirrorConfigurationsRepository.findByConfigurationId(configurationId);
+ OperationalPortMirrorConfigurations operPortMirrorConfiguration = null;
+
+ if (operPortMirrorConfigurations != null && !operPortMirrorConfigurations.isEmpty()) {
+ operPortMirrorConfiguration = operPortMirrorConfigurations.get(0);
+ ctxIn.mergeJson("operational-data", operPortMirrorConfiguration.getPmcData());
+ } else {
+ operPortMirrorConfiguration = new OperationalPortMirrorConfigurations(configurationId, null, null);
+ }
+
+ */
+
+ // Update service status info in config entry from input
+ configPortMirrorConfiguration.setPortMirrorConfigurationStatusAction(input.getInput().getRequestInformation().getRequestAction().toString());
+ configPortMirrorConfiguration.setPortMirrorConfigurationStatusRpcAction(input.getInput().getSdncRequestHeader().getSvcAction().toString());
+ configPortMirrorConfiguration.setPortMirrorConfigurationStatusRpcName(parentOperation);
+
+ log.info("Adding INPUT data for {} [{}] input: {}", svcOperation, svcInstanceId, input.toString());
+
+ // Call DG
+ try {
+ // Any of these can throw a nullpointer exception
+ // execute should only throw a SvcLogicException
+ SvcLogicContext ctxOut = svc.execute(MODULE_NAME, svcOperation, null, "sync", ctxIn);
+ Properties respProps = ctxOut.toProperties();
+
+ String ackFinalIndicator = respProps.getProperty("ack-final-indicator", "Y");
+ String errorCode = respProps.getProperty("error-code", "200");
+ errorMessage = respProps.getProperty("error-message", "SUCCESS");
+
+ // Update status in config services entry
+ configPortMirrorConfiguration.setPortMirrorConfigurationStatusFinalIndicator(ackFinalIndicator);
+ configPortMirrorConfiguration.setPortMirrorConfigurationStatusResponseTimestamp(Iso8601Util.now());
+ configPortMirrorConfiguration.setPortMirrorConfigurationStatusResponseCode(errorCode);
+ configPortMirrorConfiguration.setPortMirrorConfigurationStatusResponseMessage(errorMessage);
+ configPortMirrorConfiguration
+ .setPortMirrorConfigurationStatusRequestStatus(GenericResourceApiRequestStatusEnumeration.SYNCCOMPLETE.toString());
+
+ // ONLY update status
+ //String ctxJson = ctxOut.toJsonString("configuration-data");
+ //configPortMirrorConfiguration.setPmcData(ctxJson);
+ //configPortMirrorConfiguration.setPmcData(ctxJson);
+
+ // Update config tree
+ configPortMirrorConfigurationsRepository.save(configPortMirrorConfiguration);
+
+ //update operational tree
+ //operPortMirrorConfiguration.setPortMirrorConfigurationStatus(configPortMirrorConfiguration.getPortMirrorConfigurationStatus());
+ //operationalPortMirrorConfigurationsRepository.save(operPortMirrorConfiguration);
+
+ } catch (Exception e) {
+ log.error("Caught Exception updating configuration status in SDN for {} [{}] \n", svcOperation, configurationId);
+ }
+ log.info("Returned SUCCESS for {} [{}]", svcOperation, configurationId);
+ }
+
+ @Override
+ public ResponseEntity<GenericResourceApiVnfGetResourceRequest> operationsGENERICRESOURCEAPIvnfGetResourceRequestPost(
+ @Valid GenericResourceApiVnfgetresourcerequestInputBodyparam input)
+ throws RestException {
+ final String svcOperation = "vnf-get-resource-request";
+ GenericResourceApiVnfGetResourceRequest retval = new GenericResourceApiVnfGetResourceRequest();
+
+ log.info(CALLED_STR, svcOperation);
+ // Verify input contains service instance id
+ if (hasInvalidServiceId(input.getInput())) {
+ log.debug("exiting {} because of null or empty service-instance-id", svcOperation);
+ //return new ResponseEntity<>(retval, HttpStatus.OK);
+ }
+
+ String svcInstanceId = input.getInput().getServiceInformation().getServiceInstanceId();
+ SvcLogicContext ctxIn = new SvcLogicContext();
+
+ // Add input to SvcLogicContext
+ try {
+ ctxIn.mergeJson(svcOperation + "-input", objectMapper.writeValueAsString(input.getInput()));
+ } catch (JsonProcessingException e) {
+ log.error("exiting {} due to parse error on input data", svcOperation);
+ return new ResponseEntity<>(retval, HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+
+ // Add config tree data to SvcLogicContext
+ List<ConfigServices> configServices = configServicesRepository.findBySvcInstanceId(svcInstanceId);
+ ConfigServices configService = null;
+ if (configServices != null && !configServices.isEmpty()) {
+ configService = configServices.get(0);
+ ctxIn.mergeJson("service-data", configService.getSvcData());
+ } else {
+ log.debug("exiting {} because the service-instance does not have any service data in SDN", svcOperation);
+ return new ResponseEntity<>(retval, HttpStatus.OK);
+ }
+
+ // Call DG
+ try {
+ // Any of these can throw a nullpointer exception
+ // execute should only throw a SvcLogicException
+ SvcLogicContext ctxOut = svc.execute(MODULE_NAME, svcOperation, null, "sync", ctxIn);
+ Properties respProps = ctxOut.toProperties();
+
+ /* For debugging Only
+ respProps.forEach((k,v) -> {
+ log.debug("prop: {} -> {}",k,v);
+ });
+ */
+
+ String ctxJson = ctxOut.toJsonString("vnf-get-resource-request-output");
+ GenericResourceApiVnfgetresourcerequestOutput vnfgetresourcerequestOutput =
+ objectMapper.readValue(ctxJson, GenericResourceApiVnfgetresourcerequestOutput.class);
+
+ retval.setOutput(vnfgetresourcerequestOutput);
+
+ } catch (Exception e) {
+ return (new ResponseEntity<>(retval, HttpStatus.INTERNAL_SERVER_ERROR));
+ }
+ return (new ResponseEntity<>(retval, HttpStatus.OK));
+ }
+
+ @Override
+ public ResponseEntity<GenericResourceApiPolicyUpdateNotifyOperation> operationsGENERICRESOURCEAPIpolicyUpdateNotifyOperationPost(
+ @Valid GenericResourceApiPolicyupdatenotifyoperationInputBodyparam input)
+ throws RestException {
+ final String svcOperation = "policy-update-notify-operation";
+ GenericResourceApiPolicyUpdateNotifyOperation retval = new GenericResourceApiPolicyUpdateNotifyOperation();
+ GenericResourceApiPolicyupdatenotifyoperationOutput resp = new GenericResourceApiPolicyupdatenotifyoperationOutput();
+
+ log.info(CALLED_STR, svcOperation);
+ // Verify required input elements
+ if (hasInvalidPolicyUpdateInput(input.getInput())) {
+ log.debug("exiting {} because policy name, update type, or version id was not provided", svcOperation);
+ resp.setErrorCode("404");
+ resp.setErrorMsg("policy-name, update-type, and/or version-id is null or empty");
+ retval.setOutput(resp);
+ return new ResponseEntity<>(retval, HttpStatus.OK);
+ }
+
+ SvcLogicContext ctxIn = new SvcLogicContext();
+
+ // Add input to SvcLogicContext
+ try {
+ ctxIn.mergeJson(svcOperation + "-input", objectMapper.writeValueAsString(input.getInput()));
+ } catch (JsonProcessingException e) {
+ log.error("exiting {} due to parse error on input data", svcOperation);
+ resp.setErrorCode("500");
+ resp.setErrorMsg("internal error");
+ retval.setOutput(resp);
+ return new ResponseEntity<>(retval, HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+
+ // Call DG
+ try {
+ // Any of these can throw a nullpointer exception
+ // execute should only throw a SvcLogicException
+ SvcLogicContext ctxOut = svc.execute(MODULE_NAME, svcOperation, null, "sync", ctxIn);
+ Properties respProps = ctxOut.toProperties();
+ resp.setErrorCode(respProps.getProperty("error-code", "200"));
+ resp.setErrorMsg(respProps.getProperty("error-message", "SUCCESS"));
+
+ /* For debugging Only
+ respProps.forEach((k,v) -> {
+ log.debug("prop: {} -> {}",k,v);
+ });
+ */
+
+ } catch (NullPointerException npe) {
+ resp.setErrorCode("500");
+ resp.setErrorMsg("Check that you populated module, rpc and or mode correctly.");
+ } catch (SvcLogicException e) {
+ resp.setErrorCode("500");
+ resp.setErrorMsg(e.getMessage());
+ }
+
+ retval.setOutput(resp);
+ return (new ResponseEntity<>(retval, HttpStatus.OK));
+ }
+
}
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigContrailRouteAllottedResources.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigContrailRouteAllottedResources.java
new file mode 100755
index 0000000..8fcf6d2
--- /dev/null
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigContrailRouteAllottedResources.java
@@ -0,0 +1,181 @@
+package org.onap.sdnc.apps.ms.gra.data;
+
+import org.hibernate.validator.constraints.Length;
+import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiRequestStatusEnumeration;
+import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiAllottedresourcestatusAllottedResourceStatus;
+
+import javax.persistence.*;
+
+@Entity(name="CONFIG_GRA_CONTRAIL_ROUTE_ALLOTTED_RESOURCES")
+@Table(name="CONFIG_GRA_CONTRAIL_ROUTE_ALLOTTED_RESOURCES")
+public class ConfigContrailRouteAllottedResources {
+ @Id
+ @Length(max = 255)
+ @Column(length = 255)
+ String allottedResourceId;
+
+ @Lob
+ String arData;
+
+ // allottedResource status fields
+ String allottedResourceStatusResponseCode;
+
+ String allottedResourceStatusResponseMessage;
+
+ String allottedResourceStatusFinalIndicator;
+
+ String allottedResourceStatusRequestStatus;
+
+ String allottedResourceStatusAction;
+
+ String allottedResourceStatusRpcName;
+
+ String allottedResourceStatusRpcAction;
+
+ String allottedResourceStatusResponseTimestamp;
+
+
+ public ConfigContrailRouteAllottedResources() {
+ this.allottedResourceId = "";
+ this.arData = "";
+ }
+
+ public ConfigContrailRouteAllottedResources(String allottedResourceId, String arData) {
+ this.allottedResourceId = allottedResourceId;
+ this.arData = arData;
+ }
+
+ public ConfigContrailRouteAllottedResources(String allottedResourceId, String arData, GenericResourceApiAllottedresourcestatusAllottedResourceStatus allottedResourceStatus) {
+ this.allottedResourceId = allottedResourceId;
+ this.arData = arData;
+
+ if (allottedResourceStatus != null) {
+ this.allottedResourceStatusAction = allottedResourceStatus.getAction();
+ this.allottedResourceStatusFinalIndicator = allottedResourceStatus.getFinalIndicator();
+ this.allottedResourceStatusRequestStatus = allottedResourceStatus.getRequestStatus().toString();
+ this.allottedResourceStatusResponseCode = allottedResourceStatus.getResponseCode();
+ this.allottedResourceStatusResponseMessage = allottedResourceStatus.getResponseMessage();
+ this.allottedResourceStatusResponseTimestamp = allottedResourceStatus.getResponseTimestamp();
+ }
+ }
+
+ public String getAllottedResourceId() {
+ return allottedResourceId;
+ }
+
+ public void setAllottedResourceId(String allottedResourceId) {
+ this.allottedResourceId = allottedResourceId;
+ }
+
+ public String getArData() {
+ return arData;
+ }
+
+ public void setArData(String arData) {
+ this.arData = arData;
+ }
+
+ public String getAllottedResourceStatusResponseCode() {
+ return allottedResourceStatusResponseCode;
+ }
+
+ public void setAllottedResourceStatusResponseCode(String allottedResourceStatusResponseCode) {
+ this.allottedResourceStatusResponseCode = allottedResourceStatusResponseCode;
+ }
+
+ public String getAllottedResourceStatusResponseMessage() {
+ return allottedResourceStatusResponseMessage;
+ }
+
+ public void setAllottedResourceStatusResponseMessage(String allottedResourcesStatusResponseMessage) {
+ this.allottedResourceStatusResponseMessage = allottedResourcesStatusResponseMessage;
+ }
+
+ public String getAllottedResourceStatusFinalIndicator() {
+ return allottedResourceStatusFinalIndicator;
+ }
+
+ public void setAllottedResourceStatusFinalIndicator(String allottedResourceStatusFinalIndicator) {
+ this.allottedResourceStatusFinalIndicator = allottedResourceStatusFinalIndicator;
+ }
+
+ public String getAllottedResourceStatusRequestStatus() {
+ return allottedResourceStatusRequestStatus;
+ }
+
+ public void setAllottedResourceStatusRequestStatus(String allottedResourceStatusRequestStatus) {
+ this.allottedResourceStatusRequestStatus = allottedResourceStatusRequestStatus;
+ }
+
+ public String getAllottedResourceStatusAction() {
+ return allottedResourceStatusAction;
+ }
+
+ public void setAllottedResourceStatusAction(String allottedResourceStatusAction) {
+ this.allottedResourceStatusAction = allottedResourceStatusAction;
+ }
+
+ public String getAllottedResourceStatusRpcName() {
+ return allottedResourceStatusRpcName;
+ }
+
+ public void setAllottedResourceStatusRpcName(String allottedResourceStatusRpcName) {
+ this.allottedResourceStatusRpcName = allottedResourceStatusRpcName;
+ }
+
+ public String getAllottedResourceStatusRpcAction() {
+ return allottedResourceStatusRpcAction;
+ }
+
+ public void setAllottedResourceStatusRpcAction(String allottedResourceStatusRpcAction) {
+ this.allottedResourceStatusRpcAction = allottedResourceStatusRpcAction;
+ }
+
+ public String getAllottedResourceStatusResponseTimestamp() {
+ return allottedResourceStatusResponseTimestamp;
+ }
+
+ public void setAllottedResourceStatusResponseTimestamp(String allottedResourceStatusResponseTimestamp) {
+ this.allottedResourceStatusResponseTimestamp = allottedResourceStatusResponseTimestamp;
+ }
+
+ public GenericResourceApiAllottedresourcestatusAllottedResourceStatus getAllottedResourceStatus() {
+
+ if ((allottedResourceStatusAction == null) &&
+ (allottedResourceStatusFinalIndicator == null) &&
+ (allottedResourceStatusRequestStatus == null) &&
+ (allottedResourceStatusResponseCode == null) &&
+ (allottedResourceStatusResponseMessage == null) &&
+ (allottedResourceStatusResponseTimestamp == null)) {
+ return null;
+ }
+
+ GenericResourceApiAllottedresourcestatusAllottedResourceStatus allottedResourceStatus = new GenericResourceApiAllottedresourcestatusAllottedResourceStatus();
+ allottedResourceStatus.setAction(allottedResourceStatusAction);
+ allottedResourceStatus.setFinalIndicator(allottedResourceStatusFinalIndicator);
+ allottedResourceStatus.setRequestStatus(GenericResourceApiRequestStatusEnumeration.fromValue(allottedResourceStatusRequestStatus));
+ allottedResourceStatus.setResponseCode(allottedResourceStatusResponseCode);
+ allottedResourceStatus.setResponseMessage(allottedResourceStatusResponseMessage);
+ allottedResourceStatus.setResponseTimestamp(allottedResourceStatusResponseTimestamp);
+
+ return(allottedResourceStatus);
+ }
+
+ public void setAllottedResourceStatus(GenericResourceApiAllottedresourcestatusAllottedResourceStatus allottedResourceStatus) {
+ if (allottedResourceStatus == null) {
+ this.allottedResourceStatusAction = null;
+ this.allottedResourceStatusFinalIndicator = null;
+ this.allottedResourceStatusRequestStatus = null;
+ this.allottedResourceStatusResponseCode = null;
+ this.allottedResourceStatusResponseMessage = null;
+ this.allottedResourceStatusResponseTimestamp = null;
+ } else {
+ this.allottedResourceStatusAction = allottedResourceStatus.getAction();
+ this.allottedResourceStatusFinalIndicator = allottedResourceStatus.getFinalIndicator();
+ this.allottedResourceStatusRequestStatus = allottedResourceStatus.getRequestStatus().toString();
+ this.allottedResourceStatusResponseCode = allottedResourceStatus.getResponseCode();
+ this.allottedResourceStatusResponseMessage = allottedResourceStatus.getResponseMessage();
+ this.allottedResourceStatusResponseTimestamp = allottedResourceStatus.getResponseTimestamp();
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigContrailRouteAllottedResourcesRepository.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigContrailRouteAllottedResourcesRepository.java
new file mode 100755
index 0000000..4aa0960
--- /dev/null
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigContrailRouteAllottedResourcesRepository.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SDNC
+ * ================================================================================
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdnc.apps.ms.gra.data;
+
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.List;
+
+
+public interface ConfigContrailRouteAllottedResourcesRepository extends CrudRepository<ConfigContrailRouteAllottedResources, Long> {
+
+ List<ConfigContrailRouteAllottedResources> findByAllottedResourceId(String allottedResourceId);
+ long deleteByAllottedResourceId(String allottedResourceId);
+
+}
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigPortMirrorConfigurations.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigPortMirrorConfigurations.java
new file mode 100755
index 0000000..cdc5462
--- /dev/null
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigPortMirrorConfigurations.java
@@ -0,0 +1,181 @@
+package org.onap.sdnc.apps.ms.gra.data;
+
+import org.hibernate.validator.constraints.Length;
+import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiConfigurationstatusConfigurationStatus;
+import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiRequestStatusEnumeration;
+
+import javax.persistence.*;
+
+@Entity(name="CONFIG_GRA_PORT_MIRROR_CONFIGURATIONS")
+@Table(name="CONFIG_GRA_PORT_MIRROR_CONFIGURATIONS")
+public class ConfigPortMirrorConfigurations {
+ @Id
+ @Length(max = 255)
+ @Column(length = 255)
+ String configurationId;
+
+ @Lob
+ String pmcData;
+
+ // portMirrorConfiguration status fields
+ String portMirrorConfigurationStatusResponseCode;
+
+ String portMirrorConfigurationStatusResponseMessage;
+
+ String portMirrorConfigurationStatusFinalIndicator;
+
+ String portMirrorConfigurationStatusRequestStatus;
+
+ String portMirrorConfigurationStatusAction;
+
+ String portMirrorConfigurationStatusRpcName;
+
+ String portMirrorConfigurationStatusRpcAction;
+
+ String portMirrorConfigurationStatusResponseTimestamp;
+
+
+ public ConfigPortMirrorConfigurations() {
+ this.configurationId = "";
+ this.pmcData = "";
+ }
+
+ public ConfigPortMirrorConfigurations(String configurationId, String pmcData) {
+ this.configurationId = configurationId;
+ this.pmcData = pmcData;
+ }
+
+ public ConfigPortMirrorConfigurations(String configurationId, String pmcData, GenericResourceApiConfigurationstatusConfigurationStatus portMirrorConfigurationStatus) {
+ this.configurationId = configurationId;
+ this.pmcData = pmcData;
+
+ if (portMirrorConfigurationStatus != null) {
+ this.portMirrorConfigurationStatusAction = portMirrorConfigurationStatus.getAction();
+ this.portMirrorConfigurationStatusFinalIndicator = portMirrorConfigurationStatus.getFinalIndicator();
+ this.portMirrorConfigurationStatusRequestStatus = portMirrorConfigurationStatus.getRequestStatus().toString();
+ this.portMirrorConfigurationStatusResponseCode = portMirrorConfigurationStatus.getResponseCode();
+ this.portMirrorConfigurationStatusResponseMessage = portMirrorConfigurationStatus.getResponseMessage();
+ this.portMirrorConfigurationStatusResponseTimestamp = portMirrorConfigurationStatus.getResponseTimestamp();
+ }
+ }
+
+ public String getConfigureationId() {
+ return configurationId;
+ }
+
+ public void setConfigureationId(String configureationId) {
+ this.configurationId = configureationId;
+ }
+
+ public String getPmcData() {
+ return pmcData;
+ }
+
+ public void setPmcData(String pmcData) {
+ this.pmcData = pmcData;
+ }
+
+ public String getPortMirrorConfigurationStatusResponseCode() {
+ return portMirrorConfigurationStatusResponseCode;
+ }
+
+ public void setPortMirrorConfigurationStatusResponseCode(String portMirrorConfigurationStatusResponseCode) {
+ this.portMirrorConfigurationStatusResponseCode = portMirrorConfigurationStatusResponseCode;
+ }
+
+ public String getPortMirrorConfigurationStatusResponseMessage() {
+ return portMirrorConfigurationStatusResponseMessage;
+ }
+
+ public void setPortMirrorConfigurationStatusResponseMessage(String portMirrorConfigurationsStatusResponseMessage) {
+ this.portMirrorConfigurationStatusResponseMessage = portMirrorConfigurationsStatusResponseMessage;
+ }
+
+ public String getPortMirrorConfigurationStatusFinalIndicator() {
+ return portMirrorConfigurationStatusFinalIndicator;
+ }
+
+ public void setPortMirrorConfigurationStatusFinalIndicator(String portMirrorConfigurationStatusFinalIndicator) {
+ this.portMirrorConfigurationStatusFinalIndicator = portMirrorConfigurationStatusFinalIndicator;
+ }
+
+ public String getPortMirrorConfigurationStatusRequestStatus() {
+ return portMirrorConfigurationStatusRequestStatus;
+ }
+
+ public void setPortMirrorConfigurationStatusRequestStatus(String portMirrorConfigurationStatusRequestStatus) {
+ this.portMirrorConfigurationStatusRequestStatus = portMirrorConfigurationStatusRequestStatus;
+ }
+
+ public String getPortMirrorConfigurationStatusAction() {
+ return portMirrorConfigurationStatusAction;
+ }
+
+ public void setPortMirrorConfigurationStatusAction(String portMirrorConfigurationStatusAction) {
+ this.portMirrorConfigurationStatusAction = portMirrorConfigurationStatusAction;
+ }
+
+ public String getPortMirrorConfigurationStatusRpcName() {
+ return portMirrorConfigurationStatusRpcName;
+ }
+
+ public void setPortMirrorConfigurationStatusRpcName(String portMirrorConfigurationStatusRpcName) {
+ this.portMirrorConfigurationStatusRpcName = portMirrorConfigurationStatusRpcName;
+ }
+
+ public String getPortMirrorConfigurationStatusRpcAction() {
+ return portMirrorConfigurationStatusRpcAction;
+ }
+
+ public void setPortMirrorConfigurationStatusRpcAction(String portMirrorConfigurationStatusRpcAction) {
+ this.portMirrorConfigurationStatusRpcAction = portMirrorConfigurationStatusRpcAction;
+ }
+
+ public String getPortMirrorConfigurationStatusResponseTimestamp() {
+ return portMirrorConfigurationStatusResponseTimestamp;
+ }
+
+ public void setPortMirrorConfigurationStatusResponseTimestamp(String portMirrorConfigurationStatusResponseTimestamp) {
+ this.portMirrorConfigurationStatusResponseTimestamp = portMirrorConfigurationStatusResponseTimestamp;
+ }
+
+ public GenericResourceApiConfigurationstatusConfigurationStatus getPortMirrorConfigurationStatus() {
+
+ if ((portMirrorConfigurationStatusAction == null) &&
+ (portMirrorConfigurationStatusFinalIndicator == null) &&
+ (portMirrorConfigurationStatusRequestStatus == null) &&
+ (portMirrorConfigurationStatusResponseCode == null) &&
+ (portMirrorConfigurationStatusResponseMessage == null) &&
+ (portMirrorConfigurationStatusResponseTimestamp == null)) {
+ return null;
+ }
+
+ GenericResourceApiConfigurationstatusConfigurationStatus portMirrorConfigurationStatus = new GenericResourceApiConfigurationstatusConfigurationStatus();
+ portMirrorConfigurationStatus.setAction(portMirrorConfigurationStatusAction);
+ portMirrorConfigurationStatus.setFinalIndicator(portMirrorConfigurationStatusFinalIndicator);
+ portMirrorConfigurationStatus.setRequestStatus(GenericResourceApiRequestStatusEnumeration.fromValue(portMirrorConfigurationStatusRequestStatus));
+ portMirrorConfigurationStatus.setResponseCode(portMirrorConfigurationStatusResponseCode);
+ portMirrorConfigurationStatus.setResponseMessage(portMirrorConfigurationStatusResponseMessage);
+ portMirrorConfigurationStatus.setResponseTimestamp(portMirrorConfigurationStatusResponseTimestamp);
+
+ return(portMirrorConfigurationStatus);
+ }
+
+ public void setPortMirrorConfigurationStatus(GenericResourceApiConfigurationstatusConfigurationStatus portMirrorConfigurationStatus) {
+ if (portMirrorConfigurationStatus == null) {
+ this.portMirrorConfigurationStatusAction = null;
+ this.portMirrorConfigurationStatusFinalIndicator = null;
+ this.portMirrorConfigurationStatusRequestStatus = null;
+ this.portMirrorConfigurationStatusResponseCode = null;
+ this.portMirrorConfigurationStatusResponseMessage = null;
+ this.portMirrorConfigurationStatusResponseTimestamp = null;
+ } else {
+ this.portMirrorConfigurationStatusAction = portMirrorConfigurationStatus.getAction();
+ this.portMirrorConfigurationStatusFinalIndicator = portMirrorConfigurationStatus.getFinalIndicator();
+ this.portMirrorConfigurationStatusRequestStatus = portMirrorConfigurationStatus.getRequestStatus().toString();
+ this.portMirrorConfigurationStatusResponseCode = portMirrorConfigurationStatus.getResponseCode();
+ this.portMirrorConfigurationStatusResponseMessage = portMirrorConfigurationStatus.getResponseMessage();
+ this.portMirrorConfigurationStatusResponseTimestamp = portMirrorConfigurationStatus.getResponseTimestamp();
+ }
+ }
+}
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigPortMirrorConfigurationsRepository.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigPortMirrorConfigurationsRepository.java
new file mode 100755
index 0000000..4c630c9
--- /dev/null
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigPortMirrorConfigurationsRepository.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SDNC
+ * ================================================================================
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdnc.apps.ms.gra.data;
+
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.List;
+
+
+public interface ConfigPortMirrorConfigurationsRepository extends CrudRepository<ConfigPortMirrorConfigurations, Long> {
+
+ List<ConfigPortMirrorConfigurations> findByConfigurationId(String configurationId);
+ long deleteByConfigurationId(String configurationId);
+
+}
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalContrailRouteAllottedResources.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalContrailRouteAllottedResources.java
new file mode 100755
index 0000000..51ab88f
--- /dev/null
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalContrailRouteAllottedResources.java
@@ -0,0 +1,181 @@
+package org.onap.sdnc.apps.ms.gra.data;
+
+import org.hibernate.validator.constraints.Length;
+import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiAllottedresourcestatusAllottedResourceStatus;
+import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiRequestStatusEnumeration;
+
+import javax.persistence.*;
+
+@Entity(name="OPERATIONAL_GRA_CONTRAIL_ROUTE_ALLOTTED_RESOURCES")
+@Table(name="OPERATIONAL_GRA_CONTRAIL_ROUTE_ALLOTTED_RESOURCES")
+public class OperationalContrailRouteAllottedResources {
+ @Id
+ @Length(max = 255)
+ @Column(length = 255)
+ String allottedResourceId;
+
+ @Lob
+ String arData;
+
+ // allottedResource status fields
+ String allottedResourceStatusResponseCode;
+
+ String allottedResourceStatusResponseMessage;
+
+ String allottedResourceStatusFinalIndicator;
+
+ String allottedResourceStatusRequestStatus;
+
+ String allottedResourceStatusAction;
+
+ String allottedResourceStatusRpcName;
+
+ String allottedResourceStatusRpcAction;
+
+ String allottedResourceStatusResponseTimestamp;
+
+
+ public OperationalContrailRouteAllottedResources() {
+ this.allottedResourceId = "";
+ this.arData = "";
+ }
+
+ public OperationalContrailRouteAllottedResources(String allottedResourceId, String arData) {
+ this.allottedResourceId = allottedResourceId;
+ this.arData = arData;
+ }
+
+ public OperationalContrailRouteAllottedResources(String allottedResourceId, String arData, GenericResourceApiAllottedresourcestatusAllottedResourceStatus allottedResourceStatus) {
+ this.allottedResourceId = allottedResourceId;
+ this.arData = arData;
+
+ if (allottedResourceStatus != null) {
+ this.allottedResourceStatusAction = allottedResourceStatus.getAction();
+ this.allottedResourceStatusFinalIndicator = allottedResourceStatus.getFinalIndicator();
+ this.allottedResourceStatusRequestStatus = allottedResourceStatus.getRequestStatus().toString();
+ this.allottedResourceStatusResponseCode = allottedResourceStatus.getResponseCode();
+ this.allottedResourceStatusResponseMessage = allottedResourceStatus.getResponseMessage();
+ this.allottedResourceStatusResponseTimestamp = allottedResourceStatus.getResponseTimestamp();
+ }
+ }
+
+ public String getAllottedResourceId() {
+ return allottedResourceId;
+ }
+
+ public void setAllottedResourceId(String allottedResourceId) {
+ this.allottedResourceId = allottedResourceId;
+ }
+
+ public String getArData() {
+ return arData;
+ }
+
+ public void setArData(String arData) {
+ this.arData = arData;
+ }
+
+ public String getAllottedResourceStatusResponseCode() {
+ return allottedResourceStatusResponseCode;
+ }
+
+ public void setAllottedResourceStatusResponseCode(String allottedResourceStatusResponseCode) {
+ this.allottedResourceStatusResponseCode = allottedResourceStatusResponseCode;
+ }
+
+ public String getAllottedResourceStatusResponseMessage() {
+ return allottedResourceStatusResponseMessage;
+ }
+
+ public void setAllottedResourceStatusResponseMessage(String allottedResourcesStatusResponseMessage) {
+ this.allottedResourceStatusResponseMessage = allottedResourcesStatusResponseMessage;
+ }
+
+ public String getAllottedResourceStatusFinalIndicator() {
+ return allottedResourceStatusFinalIndicator;
+ }
+
+ public void setAllottedResourceStatusFinalIndicator(String allottedResourceStatusFinalIndicator) {
+ this.allottedResourceStatusFinalIndicator = allottedResourceStatusFinalIndicator;
+ }
+
+ public String getAllottedResourceStatusRequestStatus() {
+ return allottedResourceStatusRequestStatus;
+ }
+
+ public void setAllottedResourceStatusRequestStatus(String allottedResourceStatusRequestStatus) {
+ this.allottedResourceStatusRequestStatus = allottedResourceStatusRequestStatus;
+ }
+
+ public String getAllottedResourceStatusAction() {
+ return allottedResourceStatusAction;
+ }
+
+ public void setAllottedResourceStatusAction(String allottedResourceStatusAction) {
+ this.allottedResourceStatusAction = allottedResourceStatusAction;
+ }
+
+ public String getAllottedResourceStatusRpcName() {
+ return allottedResourceStatusRpcName;
+ }
+
+ public void setAllottedResourceStatusRpcName(String allottedResourceStatusRpcName) {
+ this.allottedResourceStatusRpcName = allottedResourceStatusRpcName;
+ }
+
+ public String getAllottedResourceStatusRpcAction() {
+ return allottedResourceStatusRpcAction;
+ }
+
+ public void setAllottedResourceStatusRpcAction(String allottedResourceStatusRpcAction) {
+ this.allottedResourceStatusRpcAction = allottedResourceStatusRpcAction;
+ }
+
+ public String getAllottedResourceStatusResponseTimestamp() {
+ return allottedResourceStatusResponseTimestamp;
+ }
+
+ public void setAllottedResourceStatusResponseTimestamp(String allottedResourceStatusResponseTimestamp) {
+ this.allottedResourceStatusResponseTimestamp = allottedResourceStatusResponseTimestamp;
+ }
+
+ public GenericResourceApiAllottedresourcestatusAllottedResourceStatus getAllottedResourceStatus() {
+
+ if ((allottedResourceStatusAction == null) &&
+ (allottedResourceStatusFinalIndicator == null) &&
+ (allottedResourceStatusRequestStatus == null) &&
+ (allottedResourceStatusResponseCode == null) &&
+ (allottedResourceStatusResponseMessage == null) &&
+ (allottedResourceStatusResponseTimestamp == null)) {
+ return null;
+ }
+
+ GenericResourceApiAllottedresourcestatusAllottedResourceStatus allottedResourceStatus = new GenericResourceApiAllottedresourcestatusAllottedResourceStatus();
+ allottedResourceStatus.setAction(allottedResourceStatusAction);
+ allottedResourceStatus.setFinalIndicator(allottedResourceStatusFinalIndicator);
+ allottedResourceStatus.setRequestStatus(GenericResourceApiRequestStatusEnumeration.fromValue(allottedResourceStatusRequestStatus));
+ allottedResourceStatus.setResponseCode(allottedResourceStatusResponseCode);
+ allottedResourceStatus.setResponseMessage(allottedResourceStatusResponseMessage);
+ allottedResourceStatus.setResponseTimestamp(allottedResourceStatusResponseTimestamp);
+
+ return(allottedResourceStatus);
+ }
+
+ public void setAllottedResourceStatus(GenericResourceApiAllottedresourcestatusAllottedResourceStatus allottedResourceStatus) {
+ if (allottedResourceStatus == null) {
+ this.allottedResourceStatusAction = null;
+ this.allottedResourceStatusFinalIndicator = null;
+ this.allottedResourceStatusRequestStatus = null;
+ this.allottedResourceStatusResponseCode = null;
+ this.allottedResourceStatusResponseMessage = null;
+ this.allottedResourceStatusResponseTimestamp = null;
+ } else {
+ this.allottedResourceStatusAction = allottedResourceStatus.getAction();
+ this.allottedResourceStatusFinalIndicator = allottedResourceStatus.getFinalIndicator();
+ this.allottedResourceStatusRequestStatus = allottedResourceStatus.getRequestStatus().toString();
+ this.allottedResourceStatusResponseCode = allottedResourceStatus.getResponseCode();
+ this.allottedResourceStatusResponseMessage = allottedResourceStatus.getResponseMessage();
+ this.allottedResourceStatusResponseTimestamp = allottedResourceStatus.getResponseTimestamp();
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalContrailRouteAllottedResourcesRepository.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalContrailRouteAllottedResourcesRepository.java
new file mode 100755
index 0000000..2bb98cb
--- /dev/null
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalContrailRouteAllottedResourcesRepository.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SDNC
+ * ================================================================================
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdnc.apps.ms.gra.data;
+
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.List;
+
+
+public interface OperationalContrailRouteAllottedResourcesRepository extends CrudRepository<OperationalContrailRouteAllottedResources, Long> {
+
+ List<OperationalContrailRouteAllottedResources> findByAllottedResourceId(String allottedResourceId);
+ long deleteByAllottedResourceId(String allottedResourceId);
+
+}
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalPortMirrorConfigurations.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalPortMirrorConfigurations.java
new file mode 100755
index 0000000..da9c0ce
--- /dev/null
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalPortMirrorConfigurations.java
@@ -0,0 +1,181 @@
+package org.onap.sdnc.apps.ms.gra.data;
+
+import org.hibernate.validator.constraints.Length;
+import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiConfigurationstatusConfigurationStatus;
+import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiRequestStatusEnumeration;
+
+import javax.persistence.*;
+
+@Entity(name="OPERATIONAL_GRA_PORT_MIRROR_CONFIGURATIONS")
+@Table(name="OPERATIONAL_GRA_PORT_MIRROR_CONFIGURATIONS")
+public class OperationalPortMirrorConfigurations {
+ @Id
+ @Length(max = 255)
+ @Column(length = 255)
+ String configurationId;
+
+ @Lob
+ String pmcData;
+
+ // portMirrorConfiguration status fields
+ String portMirrorConfigurationStatusResponseCode;
+
+ String portMirrorConfigurationStatusResponseMessage;
+
+ String portMirrorConfigurationStatusFinalIndicator;
+
+ String portMirrorConfigurationStatusRequestStatus;
+
+ String portMirrorConfigurationStatusAction;
+
+ String portMirrorConfigurationStatusRpcName;
+
+ String portMirrorConfigurationStatusRpcAction;
+
+ String portMirrorConfigurationStatusResponseTimestamp;
+
+
+ public OperationalPortMirrorConfigurations() {
+ this.configurationId = "";
+ this.pmcData = "";
+ }
+
+ public OperationalPortMirrorConfigurations(String configurationId, String pmcData) {
+ this.configurationId = configurationId;
+ this.pmcData = pmcData;
+ }
+
+ public OperationalPortMirrorConfigurations(String configurationId, String pmcData, GenericResourceApiConfigurationstatusConfigurationStatus portMirrorConfigurationStatus) {
+ this.configurationId = configurationId;
+ this.pmcData = pmcData;
+
+ if (portMirrorConfigurationStatus != null) {
+ this.portMirrorConfigurationStatusAction = portMirrorConfigurationStatus.getAction();
+ this.portMirrorConfigurationStatusFinalIndicator = portMirrorConfigurationStatus.getFinalIndicator();
+ this.portMirrorConfigurationStatusRequestStatus = portMirrorConfigurationStatus.getRequestStatus().toString();
+ this.portMirrorConfigurationStatusResponseCode = portMirrorConfigurationStatus.getResponseCode();
+ this.portMirrorConfigurationStatusResponseMessage = portMirrorConfigurationStatus.getResponseMessage();
+ this.portMirrorConfigurationStatusResponseTimestamp = portMirrorConfigurationStatus.getResponseTimestamp();
+ }
+ }
+
+ public String getConfigurationId() {
+ return configurationId;
+ }
+
+ public void setConfigurationId(String configurationId) {
+ this.configurationId = configurationId;
+ }
+
+ public String getPmcData() {
+ return pmcData;
+ }
+
+ public void setPmcData(String pmcData) {
+ this.pmcData = pmcData;
+ }
+
+ public String getPortMirrorConfigurationStatusResponseCode() {
+ return portMirrorConfigurationStatusResponseCode;
+ }
+
+ public void setPortMirrorConfigurationStatusResponseCode(String portMirrorConfigurationStatusResponseCode) {
+ this.portMirrorConfigurationStatusResponseCode = portMirrorConfigurationStatusResponseCode;
+ }
+
+ public String getPortMirrorConfigurationStatusResponseMessage() {
+ return portMirrorConfigurationStatusResponseMessage;
+ }
+
+ public void setPortMirrorConfigurationStatusResponseMessage(String portMirrorConfigurationsStatusResponseMessage) {
+ this.portMirrorConfigurationStatusResponseMessage = portMirrorConfigurationsStatusResponseMessage;
+ }
+
+ public String getPortMirrorConfigurationStatusFinalIndicator() {
+ return portMirrorConfigurationStatusFinalIndicator;
+ }
+
+ public void setPortMirrorConfigurationStatusFinalIndicator(String portMirrorConfigurationStatusFinalIndicator) {
+ this.portMirrorConfigurationStatusFinalIndicator = portMirrorConfigurationStatusFinalIndicator;
+ }
+
+ public String getPortMirrorConfigurationStatusRequestStatus() {
+ return portMirrorConfigurationStatusRequestStatus;
+ }
+
+ public void setPortMirrorConfigurationStatusRequestStatus(String portMirrorConfigurationStatusRequestStatus) {
+ this.portMirrorConfigurationStatusRequestStatus = portMirrorConfigurationStatusRequestStatus;
+ }
+
+ public String getPortMirrorConfigurationStatusAction() {
+ return portMirrorConfigurationStatusAction;
+ }
+
+ public void setPortMirrorConfigurationStatusAction(String portMirrorConfigurationStatusAction) {
+ this.portMirrorConfigurationStatusAction = portMirrorConfigurationStatusAction;
+ }
+
+ public String getPortMirrorConfigurationStatusRpcName() {
+ return portMirrorConfigurationStatusRpcName;
+ }
+
+ public void setPortMirrorConfigurationStatusRpcName(String portMirrorConfigurationStatusRpcName) {
+ this.portMirrorConfigurationStatusRpcName = portMirrorConfigurationStatusRpcName;
+ }
+
+ public String getPortMirrorConfigurationStatusRpcAction() {
+ return portMirrorConfigurationStatusRpcAction;
+ }
+
+ public void setPortMirrorConfigurationStatusRpcAction(String portMirrorConfigurationStatusRpcAction) {
+ this.portMirrorConfigurationStatusRpcAction = portMirrorConfigurationStatusRpcAction;
+ }
+
+ public String getPortMirrorConfigurationStatusResponseTimestamp() {
+ return portMirrorConfigurationStatusResponseTimestamp;
+ }
+
+ public void setPortMirrorConfigurationStatusResponseTimestamp(String portMirrorConfigurationStatusResponseTimestamp) {
+ this.portMirrorConfigurationStatusResponseTimestamp = portMirrorConfigurationStatusResponseTimestamp;
+ }
+
+ public GenericResourceApiConfigurationstatusConfigurationStatus getPortMirrorConfigurationStatus() {
+
+ if ((portMirrorConfigurationStatusAction == null) &&
+ (portMirrorConfigurationStatusFinalIndicator == null) &&
+ (portMirrorConfigurationStatusRequestStatus == null) &&
+ (portMirrorConfigurationStatusResponseCode == null) &&
+ (portMirrorConfigurationStatusResponseMessage == null) &&
+ (portMirrorConfigurationStatusResponseTimestamp == null)) {
+ return null;
+ }
+
+ GenericResourceApiConfigurationstatusConfigurationStatus portMirrorConfigurationStatus = new GenericResourceApiConfigurationstatusConfigurationStatus();
+ portMirrorConfigurationStatus.setAction(portMirrorConfigurationStatusAction);
+ portMirrorConfigurationStatus.setFinalIndicator(portMirrorConfigurationStatusFinalIndicator);
+ portMirrorConfigurationStatus.setRequestStatus(GenericResourceApiRequestStatusEnumeration.fromValue(portMirrorConfigurationStatusRequestStatus));
+ portMirrorConfigurationStatus.setResponseCode(portMirrorConfigurationStatusResponseCode);
+ portMirrorConfigurationStatus.setResponseMessage(portMirrorConfigurationStatusResponseMessage);
+ portMirrorConfigurationStatus.setResponseTimestamp(portMirrorConfigurationStatusResponseTimestamp);
+
+ return(portMirrorConfigurationStatus);
+ }
+
+ public void setPortMirrorConfigurationStatus(GenericResourceApiConfigurationstatusConfigurationStatus portMirrorConfigurationStatus) {
+ if (portMirrorConfigurationStatus == null) {
+ this.portMirrorConfigurationStatusAction = null;
+ this.portMirrorConfigurationStatusFinalIndicator = null;
+ this.portMirrorConfigurationStatusRequestStatus = null;
+ this.portMirrorConfigurationStatusResponseCode = null;
+ this.portMirrorConfigurationStatusResponseMessage = null;
+ this.portMirrorConfigurationStatusResponseTimestamp = null;
+ } else {
+ this.portMirrorConfigurationStatusAction = portMirrorConfigurationStatus.getAction();
+ this.portMirrorConfigurationStatusFinalIndicator = portMirrorConfigurationStatus.getFinalIndicator();
+ this.portMirrorConfigurationStatusRequestStatus = portMirrorConfigurationStatus.getRequestStatus().toString();
+ this.portMirrorConfigurationStatusResponseCode = portMirrorConfigurationStatus.getResponseCode();
+ this.portMirrorConfigurationStatusResponseMessage = portMirrorConfigurationStatus.getResponseMessage();
+ this.portMirrorConfigurationStatusResponseTimestamp = portMirrorConfigurationStatus.getResponseTimestamp();
+ }
+ }
+}
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalPortMirrorConfigurationsRepository.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalPortMirrorConfigurationsRepository.java
new file mode 100755
index 0000000..5f4dce7
--- /dev/null
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalPortMirrorConfigurationsRepository.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SDNC
+ * ================================================================================
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdnc.apps.ms.gra.data;
+
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.List;
+
+
+public interface OperationalPortMirrorConfigurationsRepository extends CrudRepository<OperationalPortMirrorConfigurations, Long> {
+
+ List<OperationalPortMirrorConfigurations> findByConfigurationId(String configurationId);
+ long deleteByConfigurationId(String configurationId);
+
+}
diff --git a/ms/generic-resource-api/src/main/resources/schema-derby.sql b/ms/generic-resource-api/src/main/resources/schema-derby.sql
index 7b2d78e..9fbf95f 100644
--- a/ms/generic-resource-api/src/main/resources/schema-derby.sql
+++ b/ms/generic-resource-api/src/main/resources/schema-derby.sql
@@ -2699,3 +2699,57 @@ CREATE TABLE OPERATIONAL_GRA_SERVICES (
svcData clob,
primary key (svcInstanceId)
) ;
+
+CREATE TABLE CONFIG_GRA_PORT_MIRROR_CONFIGURATIONS (
+ configurationId varchar(255) not null,
+ portMirrorConfigurationStatusAction varchar(255),
+ portMirrorConfigurationStatusFinalIndicator varchar(255),
+ portMirrorConfigurationStatusRequestStatus varchar(255),
+ portMirrorConfigurationStatusResponseCode varchar(255),
+ portMirrorConfigurationStatusResponseMessage varchar(255),
+ portMirrorConfigurationStatusResponseTimestamp varchar(255),
+ portMirrorConfigurationStatusRpcAction varchar(255),
+ portMirrorConfigurationStatusRpcName varchar(255),
+ pmcData clob, primary key (configurationId)
+) ;
+
+CREATE TABLE OPERATIONAL_GRA_PORT_MIRROR_CONFIGURATIONS (
+ configurationId varchar(255) not null,
+ portMirrorConfigurationStatusAction varchar(255),
+ portMirrorConfigurationStatusFinalIndicator varchar(255),
+ portMirrorConfigurationStatusRequestStatus varchar(255),
+ portMirrorConfigurationStatusResponseCode varchar(255),
+ portMirrorConfigurationStatusResponseMessage varchar(255),
+ portMirrorConfigurationStatusResponseTimestamp varchar(255),
+ portMirrorConfigurationStatusRpcAction varchar(255),
+ portMirrorConfigurationStatusRpcName varchar(255),
+ pmcData clob,
+ primary key (configurationId)
+) ;
+
+CREATE TABLE CONFIG_GRA_CONTRAIL_ROUTE_ALLOTTED_RESOURCES (
+ allottedResourceId varchar(255) not null,
+ allottedResourceStatusAction varchar(255),
+ allottedResourceStatusFinalIndicator varchar(255),
+ allottedResourceStatusRequestStatus varchar(255),
+ allottedResourceStatusResponseCode varchar(255),
+ allottedResourceStatusResponseMessage varchar(255),
+ allottedResourceStatusResponseTimestamp varchar(255),
+ allottedResourceStatusRpcAction varchar(255),
+ allottedResourceStatusRpcName varchar(255),
+ arData clob, primary key (allottedResourceId)
+) ;
+
+CREATE TABLE OPERATIONAL_GRA_CONTRAIL_ROUTE_ALLOTTED_RESOURCES (
+ allottedResourceId varchar(255) not null,
+ allottedResourceStatusAction varchar(255),
+ allottedResourceStatusFinalIndicator varchar(255),
+ allottedResourceStatusRequestStatus varchar(255),
+ allottedResourceStatusResponseCode varchar(255),
+ allottedResourceStatusResponseMessage varchar(255),
+ allottedResourceStatusResponseTimestamp varchar(255),
+ allottedResourceStatusRpcAction varchar(255),
+ allottedResourceStatusRpcName varchar(255),
+ arData clob,
+ primary key (allottedResourceId)
+) ;
diff --git a/ms/generic-resource-api/src/main/resources/schema-mysql.sql b/ms/generic-resource-api/src/main/resources/schema-mysql.sql
index 90e4ca7..ddd3217 100644
--- a/ms/generic-resource-api/src/main/resources/schema-mysql.sql
+++ b/ms/generic-resource-api/src/main/resources/schema-mysql.sql
@@ -2791,3 +2791,57 @@ CREATE TABLE OPERATIONAL_GRA_SERVICES (
svcData longtext,
primary key (svcInstanceId)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
+
+CREATE TABLE CONFIG_GRA_PORT_MIRROR_CONFIGURATIONS (
+ configurationId varchar(255) not null,
+ portMirrorConfigurationStatusAction varchar(255),
+ portMirrorConfigurationStatusFinalIndicator varchar(255),
+ portMirrorConfigurationStatusRequestStatus varchar(255),
+ portMirrorConfigurationStatusResponseCode varchar(255),
+ portMirrorConfigurationStatusResponseMessage varchar(255),
+ portMirrorConfigurationStatusResponseTimestamp varchar(255),
+ portMirrorConfigurationStatusRpcAction varchar(255),
+ portMirrorConfigurationStatusRpcName varchar(255),
+ pmcData longtext, primary key (configurationId)
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
+
+CREATE TABLE OPERATIONAL_GRA_PORT_MIRROR_CONFIGURATIONS (
+ configurationId varchar(255) not null,
+ portMirrorConfigurationStatusAction varchar(255),
+ portMirrorConfigurationStatusFinalIndicator varchar(255),
+ portMirrorConfigurationStatusRequestStatus varchar(255),
+ portMirrorConfigurationStatusResponseCode varchar(255),
+ portMirrorConfigurationStatusResponseMessage varchar(255),
+ portMirrorConfigurationStatusResponseTimestamp varchar(255),
+ portMirrorConfigurationStatusRpcAction varchar(255),
+ portMirrorConfigurationStatusRpcName varchar(255),
+ pmcData longtext,
+ primary key (configurationId)
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
+
+CREATE TABLE CONFIG_GRA_CONTRAIL_ROUTE_ALLOTTED_RESOURCES (
+ allottedResourceId varchar(255) not null,
+ allottedResourceStatusAction varchar(255),
+ allottedResourceStatusFinalIndicator varchar(255),
+ allottedResourceStatusRequestStatus varchar(255),
+ allottedResourceStatusResponseCode varchar(255),
+ allottedResourceStatusResponseMessage varchar(255),
+ allottedResourceStatusResponseTimestamp varchar(255),
+ allottedResourceStatusRpcAction varchar(255),
+ allottedResourceStatusRpcName varchar(255),
+ arData longtext, primary key (allottedResourceId)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
+
+CREATE TABLE OPERATIONAL_GRA_CONTRAIL_ROUTE_ALLOTTED_RESOURCES (
+ allottedResourceId varchar(255) not null,
+ allottedResourceStatusAction varchar(255),
+ allottedResourceStatusFinalIndicator varchar(255),
+ allottedResourceStatusRequestStatus varchar(255),
+ allottedResourceStatusResponseCode varchar(255),
+ allottedResourceStatusResponseMessage varchar(255),
+ allottedResourceStatusResponseTimestamp varchar(255),
+ allottedResourceStatusRpcAction varchar(255),
+ allottedResourceStatusRpcName varchar(255),
+ arData longtext,
+ primary key (allottedResourceId)
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;