aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/etsi-sol003-adapter/pom.xml2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java32
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql32
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java31
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java5
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java18
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java114
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java3
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java46
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java70
-rw-r--r--adapters/pom.xml1
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java20
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java2
-rw-r--r--adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java1
-rw-r--r--adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java37
15 files changed, 345 insertions, 69 deletions
diff --git a/adapters/etsi-sol003-adapter/pom.xml b/adapters/etsi-sol003-adapter/pom.xml
index fe34ff47c3..9ea25a5eb7 100644
--- a/adapters/etsi-sol003-adapter/pom.xml
+++ b/adapters/etsi-sol003-adapter/pom.xml
@@ -16,7 +16,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<version-swagger-codegen>2.3.1</version-swagger-codegen>
<gson-fire-version>1.8.2</gson-fire-version>
- <retrofit-version>2.3.0</retrofit-version>
+ <retrofit-version>2.7.2</retrofit-version>
<threetenbp-version>1.3.5</threetenbp-version>
<oltu-version>1.0.1</oltu-version>
<swagger-core-version>1.5.21</swagger-core-version>
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
index f283af1ba6..aa039c6ac4 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
@@ -655,4 +655,36 @@ public class CatalogDbAdapterRest {
return Response.status(HttpStatus.SC_NOT_FOUND).header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.build();
}
+
+ @GET
+ @Path("processingFlags")
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public Response getAllProcessingFlags() {
+ return getAllProcessingFlagsImpl();
+ }
+
+ public Response getAllProcessingFlagsImpl() {
+ List<ProcessingFlags> processingFlags = null;
+
+ int respStatus = HttpStatus.SC_OK;
+ try {
+ processingFlags = processingFlagsRepo.findAll();
+ if (processingFlags == null) {
+ logger.debug("ProcessingFlags not found");
+ respStatus = HttpStatus.SC_NOT_FOUND;
+ } else {
+
+ logger.debug("ProcessingFlags processingFlags = {}", processingFlags.toString());
+ }
+ return Response.status(respStatus).entity(processingFlags)
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).build();
+ } catch (Exception e) {
+ logger.error("Exception - queryProcesssingFlags", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
+ CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {}).build();
+ }
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
index a5e546e093..91a0dbd1f0 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
@@ -84,16 +84,17 @@ INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FL
('Service-Macro-Delete', '3', 'DeactivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
('Service-Macro-Delete', '4', 'DeleteVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
('Service-Macro-Delete', '5', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '6', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '7', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '8', 'DeactivateNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '9', 'DeleteNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '10', 'DeactivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '11', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '12', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '13', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '14', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '15', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '6', 'DeactivatePnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '7', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '8', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '9', 'DeactivateNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '10', 'DeleteNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '11', 'DeactivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '12', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '13', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '14', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '15', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '16', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
('Network-Create', '1', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'DEFAULT')),
('Network-Create', '2', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'DEFAULT')),
('Network-Create', '3', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'DEFAULT')),
@@ -280,6 +281,7 @@ VALUES
('DeactivateVolumeGroupBB', 'VOLUME_GROUP', 'DEACTIVATE'),
('DeactivateVfModuleBB', 'VF_MODULE', 'DEACTIVATE'),
('DeactivateNetworkBB', 'NETWORK', 'DEACTIVATE'),
+('DeactivatePnfBB', 'NO_VALIDATE', 'DEACTIVATE'),
('ChangeModelServiceInstanceBB', 'SERVICE', 'CHANGEMODEL'),
@@ -929,3 +931,13 @@ VALUES
('VNFConfigModifyActivity','*','*','*','*','Manual','Abort','*', '*'),
('VNFUnsetInMaintFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
('VNFUnsetClosedLoopDisabledActivity','*','*','*','*','Manual','Abort','*', '*');
+
+UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vnf', ACTION='config-assign' WHERE COMPOSITE_ACTION = 'Service-Macro-Create' and FLOW_NAME = 'ConfigAssignVnfBB';
+UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vnf', ACTION='config-deploy' WHERE COMPOSITE_ACTION = 'Service-Macro-Create' and FLOW_NAME = 'ConfigDeployVnfBB';
+UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vnf', ACTION='HealthCheck' WHERE COMPOSITE_ACTION = 'VFModule-ScaleOut' and FLOW_NAME = 'GenericVnfHealthCheckBB';
+UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vfmodule', ACTION='ScaleOutReconfiguration' WHERE COMPOSITE_ACTION = 'VFModule-ScaleOut' and FLOW_NAME = 'GenericVnfHealthCheckBB';
+
+INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID, SCOPE, ACTION) VALUES
+('VFModule-Delete', '1', 'ControllerExecutionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'DEFAULT'), "vnf", "HealthCheck"),
+('VFModule-Delete', '2', 'ControllerExecutionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'DEFAULT'), "vfmodule", "ScaleInReconfiguration"),
+('VFModule-Delete', '6', 'ControllerExecutionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'DEFAULT'), "vnf", "HealthCheck"); \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
index 04161e9df9..3906229c2c 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
@@ -21,7 +21,9 @@
package org.onap.so.adapters.catalogdb.catalogrest;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.io.IOException;
+import java.util.List;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.json.JSONException;
@@ -37,6 +39,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.util.UriComponentsBuilder;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -831,6 +834,34 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest {
}
@Test
+ public void testGetAllProcessingFlags() throws Exception {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_PROCESSING_FLAGS));
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ ObjectMapper mapper = new ObjectMapper();
+
+ List<ProcessingFlags> processingFlagsResponse =
+ mapper.readValue(response.getBody(), new TypeReference<List<ProcessingFlags>>() {});
+
+ boolean testFlagFound = false;
+ for (int i = 0; i < processingFlagsResponse.size(); i++) {
+ if (processingFlagsResponse.get(i).getFlag().equals("TESTFLAG")) {
+ assertEquals(processingFlagsResponse.get(i).getEndpoint(), "TESTENDPOINT");
+ assertEquals(processingFlagsResponse.get(i).getDescription(), "TEST FLAG");
+ testFlagFound = true;
+ }
+ }
+ assertTrue(testFlagFound);
+ }
+
+ @Test
public void testSetProcessingFlagsFlagValue() throws JSONException {
ProcessingFlags updatedProcessingFlag = new ProcessingFlags();
updatedProcessingFlag.setFlag("TESTFLAG");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
index df4229c985..12751f8c27 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
@@ -35,6 +35,7 @@ import org.openstack4j.model.compute.Flavor;
import org.openstack4j.model.compute.Image;
import org.openstack4j.model.compute.Server;
import org.openstack4j.model.heat.Resource;
+import org.openstack4j.model.network.Network;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -72,6 +73,10 @@ public class CreateAAIInventory {
List<Resource> stackResources =
heatBridgeClient.queryNestedHeatStackResources(cloudInformation.getTemplateInstanceId());
+ List<Network> osNetworks = heatBridgeClient.getAllOpenstackProviderNetworks(stackResources);
+ heatBridgeClient.buildAddNetworksToAaiAction(cloudInformation.getVnfId(), cloudInformation.getVfModuleId(),
+ osNetworks);
+
List<Server> osServers = heatBridgeClient.getAllOpenstackServers(stackResources);
heatBridgeClient.createPserversAndPinterfacesIfNotPresentInAai(stackResources);
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
index 9c098863f2..a4e6cccc06 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
@@ -38,6 +38,7 @@ import org.openstack4j.model.compute.Flavor;
import org.openstack4j.model.compute.Image;
import org.openstack4j.model.compute.Server;
import org.openstack4j.model.heat.Resource;
+import org.openstack4j.model.network.Network;
/**
* Defines the contract to extract Heat Stack Resources from Openstack and inventory it to AAI. This API is used only to
@@ -88,6 +89,14 @@ public interface HeatBridgeApi {
List<Server> getAllOpenstackServers(List<Resource> stackResources);
/**
+ * Query the Openstack provider network objects from the list of stack resources
+ *
+ * @param stackResources A list of stack based resources
+ * @return A list of Openstack Network objects
+ */
+ List<Network> getAllOpenstackProviderNetworks(final List<Resource> stackResources);
+
+ /**
* Extract Openstack Image objects from a a list of Server objects
*
* @param servers A list of Openstack Server objects
@@ -104,6 +113,15 @@ public interface HeatBridgeApi {
List<Flavor> extractOpenstackFlavorsFromServers(List<Server> servers);
/**
+ * Query and build AAI actions for Openstack Compute resources to AAI's l3-network objects with its subnets
+ *
+ * @param genericVnfId AAI generic-vnf-id
+ * @param vfModuleId AAI vf-module-id
+ * @param networks Openstack Network list
+ */
+ void buildAddNetworksToAaiAction(final String genericVnfId, final String vfModuleId, List<Network> networks);
+
+ /**
* Query and build AAI actions for Openstack Image resources to AAI's image objects
*
* @param images List of Openstack Image objects
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
index 3f5d25b93f..92958004ca 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -49,11 +49,15 @@ import org.apache.commons.validator.routines.InetAddressValidator;
import org.onap.aai.domain.yang.Flavor;
import org.onap.aai.domain.yang.Image;
import org.onap.aai.domain.yang.L3InterfaceIpv4AddressList;
+import org.onap.aai.domain.yang.L3Network;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.PInterface;
import org.onap.aai.domain.yang.Pserver;
+import org.onap.aai.domain.yang.Relationship;
+import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aai.domain.yang.SriovPf;
import org.onap.aai.domain.yang.SriovPfs;
+import org.onap.aai.domain.yang.Subnets;
import org.onap.aai.domain.yang.SriovVf;
import org.onap.aai.domain.yang.SriovVfs;
import org.onap.aai.domain.yang.VfModule;
@@ -67,6 +71,7 @@ import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.Relationships;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed;
import org.onap.logging.filter.base.ErrorCode;
@@ -197,6 +202,16 @@ public class HeatBridgeImpl implements HeatBridgeApi {
}
@Override
+ public List<Network> getAllOpenstackProviderNetworks(final List<Resource> stackResources) {
+ Objects.requireNonNull(osClient, ERR_MSG_NULL_OS_CLIENT);
+ // Filter Openstack Compute resources
+ List<String> providerNetworkIds =
+ extractStackResourceIdsByResourceType(stackResources, HeatBridgeConstants.OS_NEUTRON_PROVIDERNET);
+ return providerNetworkIds.stream().map(providerNetworkId -> osClient.getNetworkById(providerNetworkId))
+ .collect(Collectors.toList());
+ }
+
+ @Override
public List<org.openstack4j.model.compute.Image> extractOpenstackImagesFromServers(final List<Server> servers) {
Objects.requireNonNull(osClient, ERR_MSG_NULL_OS_CLIENT);
return servers.stream().map(Server::getImage)
@@ -210,6 +225,27 @@ public class HeatBridgeImpl implements HeatBridgeApi {
.filter(distinctByProperty(org.openstack4j.model.compute.Flavor::getId)).collect(Collectors.toList());
}
+ public void buildAddNetworksToAaiAction(final String genericVnfId, final String vfModuleId,
+ List<Network> networks) {
+ networks.forEach(network -> {
+ L3Network l3Network = aaiHelper.buildNetwork(network);
+ if (l3Network != null) {
+ l3Network.setSubnets(buildSunets(network));
+
+ RelationshipList relationshipList = new RelationshipList();
+ List<Relationship> relationships = relationshipList.getRelationship();
+
+ relationships.add(aaiHelper.getRelationshipToVfModule(genericVnfId, vfModuleId));
+ relationships.add(aaiHelper.getRelationshipToTenant(cloudOwner, cloudRegionId, tenantId));
+
+ l3Network.setRelationshipList(relationshipList);
+ transaction.createIfNotExists(
+ AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3Network.getNetworkId()),
+ Optional.of(l3Network));
+ }
+ });
+ }
+
@Override
public void buildAddImagesToAaiAction(final List<org.openstack4j.model.compute.Image> images)
throws HeatBridgeException {
@@ -291,15 +327,15 @@ public class HeatBridgeImpl implements HeatBridgeApi {
}
}
lIf.setL2Multicasting(isL2Multicast);
+
+ transaction.createIfNotExists(AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner,
+ cloudRegionId, tenantId, port.getDeviceId(), lIf.getInterfaceName()), Optional.of(lIf));
+
updateLInterfaceIps(port, lIf);
if (cloudOwner.equals(env.getProperty("mso.cloudOwner.included", ""))) {
updateLInterfaceVlan(port, lIf);
}
- // Update l-interface to the vserver
- transaction.create(AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner, cloudRegionId,
- tenantId, port.getDeviceId(), lIf.getInterfaceName()), lIf);
-
updateSriovPfToPserver(port, lIf);
}
}
@@ -337,6 +373,20 @@ public class HeatBridgeImpl implements HeatBridgeApi {
return pserverMap;
}
+ private Subnets buildSunets(Network network) {
+ Subnets aaiSubnets = new Subnets();
+ List<String> subnetIds = network.getSubnets();
+
+ subnetIds.forEach(subnetId -> {
+ Subnet subnet = osClient.getSubnetById(subnetId);
+ org.onap.aai.domain.yang.Subnet aaiSubnet = aaiHelper.buildSubnet(subnet);
+ if (aaiSubnet != null) {
+ aaiSubnets.getSubnet().add(aaiSubnet);
+ }
+ });
+ return aaiSubnets;
+ }
+
private void createPServerIfNotExists(Map<String, Pserver> serverHostnames) {
for (Pserver pserver : serverHostnames.values()) {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, pserver.getHostname());
@@ -360,26 +410,29 @@ public class HeatBridgeImpl implements HeatBridgeApi {
vlan.setInMaint(false);
vlan.setIsIpUnnumbered(false);
vlan.setIsPrivate(false);
- Vlans vlans = new Vlans();
- List<Vlan> vlanList = vlans.getVlan();
- vlanList.add(vlan);
- lIf.setVlans(vlans);
+
+ transaction
+ .createIfNotExists(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(port.getDeviceId())
+ .lInterface(lIf.getInterfaceName()).vlan(vlan.getVlanInterface())),
+ Optional.of(vlan));
}
- // Build sriov-vf to the l-interface
+
if (port.getvNicType() != null && port.getvNicType().equalsIgnoreCase(HeatBridgeConstants.OS_SRIOV_PORT_TYPE)) {
- SriovVfs sriovVfs = new SriovVfs();
- // JAXB does not generate setters for list, however getter ensures its creation.
- // Thus, all list manipulations must be made on live list.
- List<SriovVf> sriovVfList = sriovVfs.getSriovVf();
SriovVf sriovVf = new SriovVf();
sriovVf.setPciId(port.getProfile().get(HeatBridgeConstants.OS_PCI_SLOT_KEY).toString());
sriovVf.setNeutronNetworkId(port.getNetworkId());
sriovVf.setVfVlanFilter("0");
sriovVf.setVfVlanAntiSpoofCheck(false);
sriovVf.setVfMacAntiSpoofCheck(false);
- sriovVfList.add(sriovVf);
- lIf.setSriovVfs(sriovVfs);
+ transaction
+ .createIfNotExists(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(port.getDeviceId())
+ .lInterface(lIf.getInterfaceName()).sriovVf(sriovVf.getPciId())),
+ Optional.of(sriovVf));
}
}
@@ -431,13 +484,15 @@ public class HeatBridgeImpl implements HeatBridgeApi {
AAIResourceUri sriovPfUri = AAIUriFactory.createResourceUri(AAIObjectType.SRIOV_PF,
pserverHostName, matchingPifName.get(), sriovPf.getPfPciId());
- transaction.create(sriovPfUri, sriovPf);
+ if (!resourcesClient.exists(sriovPfUri)) {
+ transaction.create(sriovPfUri, sriovPf);
- AAIResourceUri sriovVfUri = AAIUriFactory.createResourceUri(AAIObjectType.SRIOV_VF,
- cloudOwner, cloudRegionId, tenantId, port.getDeviceId(), lIf.getInterfaceName(),
- port.getProfile().get(HeatBridgeConstants.OS_PCI_SLOT_KEY).toString());
+ AAIResourceUri sriovVfUri = AAIUriFactory.createResourceUri(AAIObjectType.SRIOV_VF,
+ cloudOwner, cloudRegionId, tenantId, port.getDeviceId(), lIf.getInterfaceName(),
+ port.getProfile().get(HeatBridgeConstants.OS_PCI_SLOT_KEY).toString());
- transaction.connect(sriovPfUri, sriovVfUri);
+ transaction.connect(sriovPfUri, sriovVfUri);
+ }
}
}
} catch (WebApplicationException e) {
@@ -451,7 +506,6 @@ public class HeatBridgeImpl implements HeatBridgeApi {
}
private void updateLInterfaceIps(final Port port, final LInterface lIf) {
- List<L3InterfaceIpv4AddressList> lInterfaceIps = lIf.getL3InterfaceIpv4AddressList();
for (IP ip : port.getFixedIps()) {
String ipAddress = ip.getIpAddress();
if (InetAddressValidator.getInstance().isValidInet4Address(ipAddress)) {
@@ -462,7 +516,12 @@ public class HeatBridgeImpl implements HeatBridgeApi {
lInterfaceIp.setNeutronNetworkId(port.getNetworkId());
lInterfaceIp.setNeutronSubnetId(ip.getSubnetId());
lInterfaceIp.setL3InterfaceIpv4PrefixLength(Long.parseLong(cidr.getNetworkPrefixLength().toString()));
- lInterfaceIps.add(lInterfaceIp);
+
+ transaction.createIfNotExists(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(port.getDeviceId())
+ .lInterface(lIf.getInterfaceName()).l3InterfaceIpv4AddressList(ipAddress)),
+ Optional.of(lInterfaceIp));
}
}
}
@@ -484,9 +543,9 @@ public class HeatBridgeImpl implements HeatBridgeApi {
Objects.requireNonNull(vnfId, "Null vnf-id!");
Objects.requireNonNull(vfModuleId, "Null vf-module-id!");
try {
- Optional<VfModule> vfModule = resourcesClient.get(
- AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId, NotFoundException.class)
- .depth(Depth.ONE))
+ Optional<VfModule> vfModule = resourcesClient
+ .get(AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId).depth(Depth.ONE),
+ NotFoundException.class)
.asBean(VfModule.class);
AAIResultWrapper resultWrapper = new AAIResultWrapper(vfModule.get());
@@ -560,9 +619,10 @@ public class HeatBridgeImpl implements HeatBridgeApi {
Vserver vserver = vserverWrapper.asBean(Vserver.class).get();
List<String> pciIds = HeatBridgeUtils.extractPciIdsFromVServer(vserver);
if (CollectionUtils.isNotEmpty(pciIds)) {
- List<String> matchingPservers = vserverRelationships.get().getRelatedLinks(AAIObjectType.PSERVER);
+ List<AAIResourceUri> matchingPservers =
+ vserverRelationships.get().getRelatedUris(AAIObjectType.PSERVER);
if (matchingPservers != null && matchingPservers.size() == 1) {
- pserverToPciIdMap.put(matchingPservers.get(0), pciIds);
+ pserverToPciIdMap.put(matchingPservers.get(0).getURIKeys().get("hostname"), pciIds);
}
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
index fdf7ce38f1..71c6a96cd6 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
@@ -40,6 +40,7 @@ public class HeatBridgeConstants {
public static final Integer OS_DEFAULT_HEAT_NESTING = 5;
public static final String OS_SERVER_RESOURCE_TYPE = "OS::Nova::Server";
public static final String OS_PORT_RESOURCE_TYPE = "OS::Neutron::Port";
+ public static final String OS_NEUTRON_PROVIDERNET = "OS::Neutron::ProviderNet";
public static final String OS_SRIOV_PORT_TYPE = "direct";
public static final String OS_PCI_SLOT_KEY = "pci_slot";
public static final String OS_PHYSICAL_NETWORK_KEY = "physical_network";
@@ -64,6 +65,8 @@ public class HeatBridgeConstants {
public static final String AAI_VF_MODULE_ID = "vf-module.vf-module-id";
public static final String AAI_IMAGE = "image";
public static final String AAI_IMAGE_ID = "image.image-id";
+ public static final String AAI_TENANT = "tenant";
+ public static final String AAI_TENANT_ID = "tenant.tenant-id";
public static final String AAI_CLOUD_OWNER = "cloud-region.cloud-owner";
public static final String AAI_CLOUD_REGION_ID = "cloud-region.cloud-region-id";
public static final String AAI_FLAVOR = "flavor";
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
index c4d9cbe871..7d4e92d9ad 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
@@ -42,6 +42,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.onap.aai.domain.yang.Flavor;
import org.onap.aai.domain.yang.Image;
+import org.onap.aai.domain.yang.L3Network;
import org.onap.aai.domain.yang.PInterface;
import org.onap.aai.domain.yang.Pserver;
import org.onap.aai.domain.yang.Relationship;
@@ -54,7 +55,9 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.heatbridge.constants.HeatBridgeConstants;
import org.openstack4j.model.compute.Server;
+import org.openstack4j.model.network.Network;
import org.openstack4j.model.network.Port;
+import org.openstack4j.model.network.Subnet;
import com.google.common.base.Preconditions;
/**
@@ -131,6 +134,49 @@ public class AaiHelper {
return relationshipList;
}
+ public Relationship getRelationshipToVfModule(String vnfId, String vfModuleId) {
+ return buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId));
+ }
+
+ public Relationship getRelationshipToTenant(String cloudOwner, String cloudRegionId, String tenantId) {
+ return buildRelationship(
+ AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegionId, tenantId));
+ }
+
+ public org.onap.aai.domain.yang.Subnet buildSubnet(Subnet subnet) {
+ org.onap.aai.domain.yang.Subnet aaiSubnet = new org.onap.aai.domain.yang.Subnet();
+ aaiSubnet.setSubnetId(subnet.getId());
+ aaiSubnet.setDhcpEnabled(subnet.isDHCPEnabled());
+
+ aaiSubnet.setSubnetName(subnet.getName());
+ aaiSubnet.setGatewayAddress(subnet.getGateway());
+ aaiSubnet.setCidrMask(subnet.getCidr());
+ aaiSubnet.setIpVersion(subnet.getIpVersion().name());
+ return aaiSubnet;
+ }
+
+ public L3Network buildNetwork(Network network) {
+ if (network.getId() == null) {
+ return null;
+ }
+ L3Network l3Network = new L3Network();
+ l3Network.setNetworkId(network.getId());
+ l3Network.setIsBoundToVpn(true);
+ l3Network.setIsProviderNetwork(true);
+
+ // optional fields
+ l3Network.setIsSharedNetwork(network.isShared());
+ l3Network.setIsExternalNetwork(network.isRouterExternal());
+ l3Network.setOperationalStatus(String.valueOf(network.isAdminStateUp()));
+ if (network.getName() != null) {
+ l3Network.setNetworkName(network.getName());
+ }
+ if (network.getProviderPhyNet() != null) {
+ l3Network.setPhysicalNetworkName(network.getProviderPhyNet());
+ }
+ return l3Network;
+ }
+
/**
* Transform Openstack Server object to AAI Vserver object
*
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
index 920bb78e8f..8c21e3f7f7 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
@@ -85,9 +85,11 @@ import org.openstack4j.model.compute.Server;
import org.openstack4j.model.compute.Server.Status;
import org.openstack4j.model.heat.Resource;
import org.openstack4j.model.network.IP;
+import org.openstack4j.model.network.IPVersionType;
import org.openstack4j.model.network.Network;
import org.openstack4j.model.network.NetworkType;
import org.openstack4j.model.network.Port;
+import org.openstack4j.model.network.Subnet;
import org.openstack4j.openstack.heat.domain.HeatResource;
import org.openstack4j.openstack.heat.domain.HeatResource.Resources;
import org.springframework.core.env.Environment;
@@ -444,12 +446,76 @@ public class HeatBridgeImplTest {
heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2"), "CloudOwner");
// Assert
- verify(transaction, times(5)).create(any(AAIResourceUri.class), any(LInterface.class));
+ verify(transaction, times(15)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
verify(osClient, times(5)).getPortById(anyString());
verify(osClient, times(10)).getNetworkById(anyString());
}
@Test
+ public void testUpdateNetworksToAai() throws HeatBridgeException {
+
+ Subnet subnet1 = mock(Subnet.class);
+ when(subnet1.getId()).thenReturn("test-subnet1-id");
+ when(subnet1.getName()).thenReturn("test-subnet1-name");
+ when(subnet1.isDHCPEnabled()).thenReturn(true);
+ when(subnet1.getGateway()).thenReturn("test-subnet1-gateway");
+ when(subnet1.getCidr()).thenReturn("test-subnet1-gateway");
+ when(subnet1.getIpVersion()).thenReturn(IPVersionType.V4);
+
+ Subnet subnet2 = mock(Subnet.class);
+ when(subnet2.getId()).thenReturn("test-subnet2-id");
+ when(subnet2.getName()).thenReturn("test-subnet2-name");
+ when(subnet2.isDHCPEnabled()).thenReturn(true);
+ when(subnet2.getGateway()).thenReturn("test-subnet1-gateway");
+ when(subnet2.getCidr()).thenReturn("test-subnet1-gateway");
+ when(subnet2.getIpVersion()).thenReturn(IPVersionType.V6);
+
+ when(osClient.getSubnetById(subnet1.getId())).thenReturn(subnet1);
+ when(osClient.getSubnetById(subnet2.getId())).thenReturn(subnet2);
+
+ List<String> subnetIds = Arrays.asList(subnet1.getId(), subnet2.getId());
+
+ // Arrange
+ Network network1 = mock(Network.class);
+ when(network1.getId()).thenReturn("test-network1-id");
+ when(network1.isShared()).thenReturn(true);
+ when(network1.isRouterExternal()).thenReturn(true);
+ when(network1.isAdminStateUp()).thenReturn(true);
+ when(network1.getProviderPhyNet()).thenReturn("sriov-network1");
+ when(network1.getName()).thenReturn("network1");
+ when(network1.getSubnets()).thenReturn(subnetIds);
+
+ Network network2 = mock(Network.class);
+ when(network2.getId()).thenReturn("test-network2-id");
+ when(network2.isShared()).thenReturn(true);
+ when(network2.isRouterExternal()).thenReturn(true);
+ when(network2.isAdminStateUp()).thenReturn(true);
+ when(network2.getProviderPhyNet()).thenReturn("sriov-network2");
+ when(network2.getName()).thenReturn("network2");
+ when(network2.getSubnets()).thenReturn(subnetIds);
+
+ String vnfId = "some-uuiid-of-the-vnf";
+ String vfModuleId = "some-uuiid-of-the-vf-module";
+
+ Subnet subnet = mock(Subnet.class);
+
+ List<Network> networks = Arrays.asList(network1, network2);
+
+ // Act #1
+ heatbridge.buildAddNetworksToAaiAction(vnfId, vfModuleId, networks);
+
+ // Assert #1
+ verify(transaction, times(2)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+
+ // Act #2
+ heatbridge.buildAddNetworksToAaiAction(vnfId, vfModuleId, networks);
+
+ // Assert #2
+ verify(transaction, times(4)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+
+ }
+
+ @Test
public void testUpdateVserverLInterfacesToAai_skipVlans() throws HeatBridgeException {
// Arrange
List<Resource> stackResources = (List<Resource>) extractTestStackResources();
@@ -486,7 +552,7 @@ public class HeatBridgeImplTest {
heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2"), "CloudOwner");
// Assert
- verify(transaction, times(5)).create(any(AAIResourceUri.class), any(LInterface.class));
+ verify(transaction, times(5)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
verify(osClient, times(5)).getPortById(anyString());
verify(osClient, times(5)).getNetworkById(anyString());
}
diff --git a/adapters/pom.xml b/adapters/pom.xml
index 9e703b9dab..56d4328577 100644
--- a/adapters/pom.xml
+++ b/adapters/pom.xml
@@ -22,7 +22,6 @@
<module>mso-vfc-adapter</module>
<module>mso-openstack-adapters</module>
<module>etsi-sol003-adapter</module>
- <module>etsi-sol002-adapter</module>
<module>mso-nssmf-adapter</module>
<module>so-appc-orchestrator</module>
</modules>
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java
index 20093be6a4..1da6fc096f 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java
@@ -52,7 +52,6 @@ import org.onap.appc.client.lcm.model.ZULU;
@Component
public class ApplicationControllerClient {
-
@Autowired
public Environment env;
@@ -117,6 +116,7 @@ public class ApplicationControllerClient {
controllerType = DEFAULT_CONTROLLER_TYPE;
}
controllerType = controllerType.toUpperCase();
+
return AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class)
.createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType));
} catch (AppcClientException e) {
@@ -128,7 +128,7 @@ public class ApplicationControllerClient {
}
public Status vnfCommand(Action action, String requestId, String vnfId, Optional<String> vserverId,
- Optional<String> request, String controllerType, ApplicationControllerCallback listener)
+ Optional<String> request, String controllerType, ApplicationControllerCallback listener, String requestorId)
throws ApplicationControllerOrchestratorException {
this.setControllerType(controllerType);
Status status;
@@ -142,7 +142,7 @@ public class ApplicationControllerClient {
payload = new Payload(request.get());
}
- status = runCommand(action, actionIdentifiers, payload, requestId, listener);
+ status = runCommand(action, actionIdentifiers, payload, requestId, listener, requestorId);
if (appCSupport.getCategoryOf(status).equals(StatusCategory.ERROR)) {
throw new ApplicationControllerOrchestratorException(status.getMessage(), status.getCode());
} else {
@@ -152,11 +152,11 @@ public class ApplicationControllerClient {
public Status runCommand(Action action, org.onap.appc.client.lcm.model.ActionIdentifiers actionIdentifiers,
- org.onap.appc.client.lcm.model.Payload payload, String requestID, ApplicationControllerCallback listener)
- throws ApplicationControllerOrchestratorException {
+ org.onap.appc.client.lcm.model.Payload payload, String requestID, ApplicationControllerCallback listener,
+ String requestorId) throws ApplicationControllerOrchestratorException {
Status status;
Object requestObject;
- requestObject = createRequest(action, actionIdentifiers, payload, requestID);
+ requestObject = createRequest(action, actionIdentifiers, payload, requestID, requestorId);
appCSupport.logLCMMessage(requestObject);
LifeCycleManagerStateful client = getAppCClient();
Method lcmMethod = appCSupport.getAPIMethod(action.name(), client, true);
@@ -194,12 +194,13 @@ public class ApplicationControllerClient {
return properties;
}
- public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId) {
+ public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId,
+ String requestorId) {
Object requestObject = appCSupport.getInput(action.name());
try {
- CommonHeader commonHeader = buildCommonHeader(requestId);
+ CommonHeader commonHeader = buildCommonHeader(requestId, requestorId);
requestObject.getClass().getDeclaredMethod("setCommonHeader", CommonHeader.class).invoke(requestObject,
commonHeader);
requestObject.getClass().getDeclaredMethod("setAction", Action.class).invoke(requestObject, action);
@@ -215,12 +216,13 @@ public class ApplicationControllerClient {
return requestObject;
}
- private CommonHeader buildCommonHeader(String requestId) {
+ private CommonHeader buildCommonHeader(String requestId, String requestorId) {
CommonHeader commonHeader = new CommonHeader();
commonHeader.setApiVer(API_VER);
commonHeader.setOriginatorId(ORIGINATOR_ID);
commonHeader.setRequestId(requestId == null ? UUID.randomUUID().toString() : requestId);
commonHeader.setSubRequestId(UUID.randomUUID().toString());
+ commonHeader.setXOnapRequestorid(requestorId);
Flags flags = new Flags();
String flagsMode = "NORMAL";
Mode mode = Mode.valueOf(flagsMode);
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
index 8e38935441..e61053d043 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
@@ -111,7 +111,7 @@ public class ApplicationControllerTaskImpl {
status = appcClient.vnfCommand(request.getAction(), msoRequestId,
request.getApplicationControllerVnf().getVnfId(), vserverId, payload, request.getControllerType(),
- listener);
+ listener, request.getRequestorId());
return status;
}
diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java
index 82b0695ed9..cac8e9e16a 100644
--- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java
+++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java
@@ -63,6 +63,7 @@ public class ApplicationControllerTaskImplITTest {
@Before
public void setup() {
request = new ApplicationControllerTaskRequest();
+ request.setRequestorId("testRequestorId");
request.setBookName("testBookName");
request.setControllerType("testControllerType");
request.setFileParameters("testFileParams");
diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
index ff979acf7b..fe2b4f84b5 100644
--- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
+++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
@@ -52,6 +52,7 @@ public class ApplicationControllerTaskImplTest {
request.setNewSoftwareVersion("2.0");
request.setExistingSoftwareVersion("1.0");
request.setOperationsTimeout("30");
+ request.setRequestorId("testRequestorId");
Map<String, String> reqConfigParams = new HashMap<>();
reqConfigParams.put("name1", "value1");
reqConfigParams.put("name2", "value2");
@@ -77,13 +78,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(Action.HealthCheck, "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(Action.HealthCheck, "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@@ -99,13 +100,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -118,13 +119,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -133,13 +134,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), Optional.empty(),
- "testControllerType", listener)).thenReturn(new Status());
+ "testControllerType", listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), Optional.empty(),
- "testControllerType", listener);
+ "testControllerType", listener, "testRequestorId");
}
@Test
@@ -154,13 +155,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -179,13 +180,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -204,13 +205,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -224,13 +225,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -251,13 +252,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test