summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java30
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java31
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java8
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java17
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java17
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt128
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java14
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java39
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java4
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java8
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java16
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java96
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java4
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java29
-rw-r--r--bpmn/mso-infrastructure-bpmn/pom.xml18
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.p12bin0 -> 4095 bytes
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.trust.jksbin0 -> 1413 bytes
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java12
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java27
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java60
-rw-r--r--docs/developer_info/developer_information.rst5
-rw-r--r--docs/developer_info/instantiate/index.rst31
-rw-r--r--docs/developer_info/instantiate/instantiation/index.rst28
-rw-r--r--docs/developer_info/instantiate/instantiation/nbi/index.rst97
-rw-r--r--docs/developer_info/instantiate/instantiation/pnf_instance/index.rst107
-rw-r--r--docs/developer_info/instantiate/instantiation/so1/index.rst366
-rw-r--r--docs/developer_info/instantiate/instantiation/so2/index.rst197
-rw-r--r--docs/developer_info/instantiate/instantiation/uui/index.rst14
-rw-r--r--docs/developer_info/instantiate/instantiation/vid/index.rst13
-rw-r--r--docs/developer_info/instantiate/pre_instantiation/index.rst225
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java96
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java53
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java2
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java2
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java2
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java10
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java8
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java8
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java35
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java82
49 files changed, 1688 insertions, 287 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java b/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java
index 469a7ad7e4..354c3d07f7 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java
@@ -9,9 +9,9 @@
* 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.
@@ -67,35 +67,35 @@ public class R__CloudConfigMigration implements JdbcMigration, MigrationInfoProv
public void migrate(Connection connection) throws Exception {
logger.debug("Starting migration for CloudConfig");
- CloudConfig cloudConfig = null;
+ CloudConfig cloudConfiguration = null;
// Try the override file
String configLocation = System.getProperty("spring.config.additional-location");
if (configLocation != null) {
try (InputStream stream = new FileInputStream(Paths.get(configLocation).normalize().toString())) {
- cloudConfig = loadCloudConfig(stream);
+ cloudConfiguration = loadCloudConfig(stream);
} catch (Exception e) {
logger.warn("Error Loading override.yaml", e);
}
}
- if (cloudConfig == null) {
+ if (cloudConfiguration == null) {
logger.debug("No CloudConfig defined in {}", configLocation);
// Try the application.yaml file
try (InputStream stream = R__CloudConfigMigration.class.getResourceAsStream(getApplicationYamlName())) {
- cloudConfig = loadCloudConfig(stream);
+ cloudConfiguration = loadCloudConfig(stream);
}
- if (cloudConfig == null) {
+ if (cloudConfiguration == null) {
logger.debug("No CloudConfig defined in {}", getApplicationYamlName());
}
}
- if (cloudConfig != null) {
- migrateCloudIdentity(cloudConfig.getIdentityServices().values(), connection);
- migrateCloudSite(cloudConfig.getCloudSites().values(), connection);
- migrateCloudifyManagers(cloudConfig.getCloudifyManagers().values(), connection);
+ if (cloudConfiguration != null) {
+ migrateCloudIdentity(cloudConfiguration.getIdentityServices().values(), connection);
+ migrateCloudSite(cloudConfiguration.getCloudSites().values(), connection);
+ migrateCloudifyManagers(cloudConfiguration.getCloudifyManagers().values(), connection);
}
}
@@ -110,13 +110,13 @@ public class R__CloudConfigMigration implements JdbcMigration, MigrationInfoProv
private CloudConfig loadCloudConfig(InputStream stream) throws IOException {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
R__CloudConfigMigration cloudConfigMigration = mapper.readValue(stream, R__CloudConfigMigration.class);
- CloudConfig cloudConfig = cloudConfigMigration.getCloudConfig();
+ CloudConfig cloudConfiguration = cloudConfigMigration.getCloudConfig();
- if (cloudConfig != null) {
- cloudConfig.populateId();
+ if (cloudConfiguration != null) {
+ cloudConfiguration.populateId();
}
- return cloudConfig;
+ return cloudConfiguration;
}
private String getApplicationYamlName() {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
index 999d27335b..6a42456715 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
@@ -40,6 +40,10 @@ public class AuditStackService {
private static final Logger logger = LoggerFactory.getLogger(AuditStackService.class);
+ private static final String DEFAULT_AUDIT_LOCK_TIME = "60000";
+
+ private static final String DEFAULT_MAX_CLIENTS_FOR_TOPIC = "10";
+
@Autowired
public Environment env;
@@ -53,41 +57,40 @@ public class AuditStackService {
private AuditQueryStackService auditQueryStack;
@PostConstruct
- public void auditAddAAIInventory() throws Exception {
+ public void auditAddAAIInventory() {
for (int i = 0; i < getMaxClients(); i++) {
ExternalTaskClient client = createExternalTaskClient();
client.subscribe("InventoryAddAudit")
- .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME)))
.handler(auditCreateStack::executeExternalTask).open();
}
}
@PostConstruct
- public void auditDeleteAAIInventory() throws Exception {
+ public void auditDeleteAAIInventory() {
for (int i = 0; i < getMaxClients(); i++) {
ExternalTaskClient client = createExternalTaskClient();
client.subscribe("InventoryDeleteAudit")
- .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME)))
.handler(auditDeleteStack::executeExternalTask).open();
}
}
@PostConstruct
- public void auditQueryInventory() throws Exception {
+ public void auditQueryInventory() {
for (int i = 0; i < getMaxClients(); i++) {
ExternalTaskClient client = createExternalTaskClient();
client.subscribe("InventoryQueryAudit")
- .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME)))
.handler(auditQueryStack::executeExternalTask).open();
}
}
- protected ExternalTaskClient createExternalTaskClient() throws Exception {
+ protected ExternalTaskClient createExternalTaskClient() {
ClientRequestInterceptor interceptor = createClientRequestInterceptor();
- ExternalTaskClient client = ExternalTaskClient.create()
- .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
- .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build();
- return client;
+ return ExternalTaskClient.create().baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1)
+ .addInterceptor(interceptor).asyncResponseTimeout(120000)
+ .backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build();
}
protected ClientRequestInterceptor createClientRequestInterceptor() {
@@ -97,13 +100,11 @@ public class AuditStackService {
} catch (IllegalStateException | GeneralSecurityException e) {
logger.error("Error Decrypting Password", e);
}
- ClientRequestInterceptor interceptor =
- new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth);
- return interceptor;
+ return new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth);
}
protected int getMaxClients() {
- return Integer.parseInt(env.getProperty("workflow.topics.maxClients", "10"));
+ return Integer.parseInt(env.getProperty("workflow.topics.maxClients", DEFAULT_MAX_CLIENTS_FOR_TOPIC));
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
index a9af3683f5..e95e9a3a83 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
@@ -11,9 +11,9 @@
* 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.
@@ -370,8 +370,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl);
notifyPort.deleteNetworkNotification(messageId, false, exCat, eMsg, null);
} catch (Exception e1) {
- logger.error("{} {} Error sending createNetwork notification {} ",
- MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, ErrorCode.DataError.getValue(), e1.getMessage(), e1);
+ logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
+ ErrorCode.DataError.getValue(), e1.getMessage(), e1);
}
return;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
index c934291246..4c115271f0 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
@@ -90,6 +90,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private static final String NETWORK_FQDN = "network_fqdn";
private static final String CREATE_NETWORK_CONTEXT = "CreateNetwork";
private static final String NEUTRON_MODE = "NEUTRON";
+ private static final String CLOUD_OWNER = "CloudOwner";
private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class);
@@ -310,7 +311,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
StackInfo heatStack = null;
long queryNetworkStarttime = System.currentTimeMillis();
try {
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkName);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName);
} catch (MsoException me) {
me.addContext(CREATE_NETWORK_CONTEXT);
logger.error("{} {} Create Network (heat): query network {} in {}/{}: ",
@@ -424,7 +425,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
try {
if (backout == null)
backout = true;
- heatStack = heat.createStack(cloudSiteId, "CloudOwner", tenantId, networkName, null, template,
+ heatStack = heat.createStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName, null, template,
stackParams, true, heatTemplate.getTimeoutMinutes(), null, null, null, backout.booleanValue());
} catch (MsoException me) {
me.addContext(CREATE_NETWORK_CONTEXT);
@@ -607,7 +608,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
StackInfo heatStack = null;
long queryStackStarttime = System.currentTimeMillis();
try {
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkName);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName);
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
logger.error("{} {} Exception - QueryStack query {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC,
@@ -727,7 +728,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Ignore MsoStackNotFound exception because we already checked.
long updateStackStarttime = System.currentTimeMillis();
try {
- heatStack = heatWithUpdate.updateStack(cloudSiteId, "CloudOwner", tenantId, networkId, template,
+ heatStack = heatWithUpdate.updateStack(cloudSiteId, CLOUD_OWNER, tenantId, networkId, template,
stackParams, true, heatTemplate.getTimeoutMinutes());
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
@@ -919,7 +920,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
StackInfo heatStack = null;
long queryStackStarttime = System.currentTimeMillis();
try {
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkNameOrId);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkNameOrId);
} catch (MsoException me) {
me.addContext("QueryNetwork");
logger.error("{} {} Exception - Query Network (heat): {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC,
@@ -1072,9 +1073,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// was deleted.
// So query first to report back if stack WAS deleted or just NOTOFUND
StackInfo heatStack = null;
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkId);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkId);
if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) {
- heat.deleteStack(tenantId, "CloudOwner", cloudSiteId, networkId, true);
+ heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true);
networkDeleted.value = true;
} else {
networkDeleted.value = false;
@@ -1157,7 +1158,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
try {
// The deleteStack function in MsoHeatUtils returns success if the stack
// was not found. So don't bother to query first.
- heat.deleteStack(tenantId, "CloudOwner", cloudSiteId, networkId, true);
+ heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true);
} catch (MsoException me) {
me.addContext("RollbackNetwork");
logger.error("{} {} Exception - Rollback Network (heat): {} in {}/{} ",
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
index df2c3a2973..4eb5d5637f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
@@ -90,6 +90,7 @@ public class NetworkAdapterRest {
private static final String TESTING_KEYWORD = "___TESTING___";
private String exceptionMsg = "Exception:";
private static final String SHARED = "shared";
+ private static final String EXTERNAL = "external";
@Autowired
private MsoNetworkAdapterImpl adapter;
@@ -207,8 +208,8 @@ public class NetworkAdapterRest {
shared = ctn.getShared();
}
}
- if (params.containsKey("external")) {
- external = params.get("external");
+ if (params.containsKey(EXTERNAL)) {
+ external = params.get(EXTERNAL);
} else {
if (ctn.getExternal() != null) {
external = ctn.getExternal();
@@ -228,8 +229,8 @@ public class NetworkAdapterRest {
}
if (params.containsKey(SHARED))
shared = params.get(SHARED);
- if (params.containsKey("external"))
- external = params.get("external");
+ if (params.containsKey(EXTERNAL))
+ external = params.get(EXTERNAL);
adapter.createNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
req.getModelCustomizationUuid(), req.getNetworkName(),
req.getProviderVlanNetwork().getPhysicalNetworkName(),
@@ -603,8 +604,8 @@ public class NetworkAdapterRest {
shared = ctn.getShared();
}
}
- if (params.containsKey("external")) {
- external = params.get("external");
+ if (params.containsKey(EXTERNAL)) {
+ external = params.get(EXTERNAL);
} else {
if (ctn.getExternal() != null) {
external = ctn.getExternal();
@@ -624,8 +625,8 @@ public class NetworkAdapterRest {
if (params.containsKey(SHARED)) {
shared = params.get(SHARED);
}
- if (params.containsKey("external")) {
- external = params.get("external");
+ if (params.containsKey(EXTERNAL)) {
+ external = params.get(EXTERNAL);
}
adapter.updateNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getNetworkName(),
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
index 96e5db7ce7..f09fa34cb9 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
@@ -854,7 +854,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Include aliases.
String alias = htp.getParamAlias();
- if (alias != null && !alias.equals("") && !params.containsKey(alias)) {
+ if (alias != null && !"".equals(alias) && !params.containsKey(alias)) {
params.put(alias, htp);
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
index d5fe285274..41bcc8c481 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
@@ -323,7 +323,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String type = templateParam.getParamType();
logger.debug("Parameter: {} is of type ", templateParam.getParamName(), type);
- if (type.equalsIgnoreCase("number")) {
+ if ("number".equalsIgnoreCase(type)) {
try {
return Integer.valueOf(inputValue.toString());
} catch (Exception e) {
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt
new file mode 100644
index 0000000000..66876311db
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt
@@ -0,0 +1,128 @@
+The following describes how to configure authentication for the VNFM adapter.
+
+
+==========================================
+To confgure TLS
+==========================================
+
+---------------
+VNFM Adapter
+---------------
+The following parameters can be set to configure the certificate for the VNFM adapter
+server:
+ ssl:
+ key-alias: so@so.onap.org
+ key--store-password: 'I,re7WWEJR$e]x370wRgx?qE'
+ key-store: classpath:org.onap.so.p12
+ key-store-type: PKCS12
+The values shown above relate to the certificate included in the VNFM adapter jar which has been generated from AAF. If a different certificate is to be used then these values should be changed accordingly.
+
+The following paramters can be set to configure the trust store for the VNFM adapter:
+http:
+ client:
+ ssl:
+ trust-store: org.onap.so.trust.jks
+ trust-store-password: NyRD](z:EJJNIt?},QgM3o7H
+The values shown above relate to the trust store included in the VNFM adapter jar which has been generated from AAI. If a different trust store is to be used then these values should be changed accordingly.
+
+Ensure the value for the below parameter uses https instead of http
+vnfmadapter:
+ endpoint: http://so-vnfm-adapter.onap:9092
+
+---------------
+bpmn-infra
+---------------
+For bpmn-infra, ensure the value for the below parameter uses https instead of http
+so:
+ vnfm:
+ adapter:
+ url: https://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/
+
+
+==========================================
+To use two way TLS
+==========================================
+
+Ensure the value for username and password are empty in the AAI entry for the VNFM (The VNFM adapter will use oauth instead of two way TLS if the username/password is set).
+Ensure TLS has been configuered as detailed above.
+
+---------------
+VNFM adapter
+---------------
+Set the following parameter for the VNFM adapter:
+server:
+ ssl:
+ client-auth: need
+
+---------------
+bpmn-infra:
+---------------
+Set the following paramters for bpmn-infra:
+rest:
+ http:
+ client:
+ configuration:
+ ssl:
+ keyStore: classpath:org.onap.so.p12
+ keyStorePassword: 'RLe5ExMWW;Kd6GTSt0WQz;.Y'
+ trustStore: classpath:org.onap.so.trust.jks
+ trustStorePassword: '6V%8oSU$,%WbYp3IUe;^mWt4'
+Ensure the value for the below parameter uses https instead of http
+so:
+ vnfm:
+ adapter:
+ url: https://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/
+
+---------------
+VNFM simulator:
+---------------
+Set the following parameters for the VNFM simulator (if used):
+server:
+ ssl:
+ client-auth: need
+ request:
+ grant:
+ auth: twowaytls
+
+==========================================
+To use oauth token base authentication
+==========================================
+
+---------------
+VNFM adapter:
+---------------
+Ensure the value for username and password set set in the AAI entry for the VNFM. The VNFM adapter will use this username/password as the client credentials in the request for a token for the VNFM. The token endpoint
+for the VNFM will by default will be derived from the service url for the VNFM in AAI as follows: <base of service url>/oauth/token, e.g. if the service url is https://so-vnfm-simulator.onap/vnflcm/v1 then the token url will
+be taken to be https://so-vnfm-simulator.onap/oauth/token. This can be overriden using the following parameter for the VNFM adapter:
+vnfmadapter:
+ temp:
+ vnfm:
+ oauth:
+ endpoint:
+
+The VNFM adapter exposes a token point at url: https://<hostname>:<port>/oauth/token e.g. https://so-vnfm-adapter.onap:9092/oauth/token. The VNFM can request a token from this endpoint for use in grant requests and notifications
+to the VNFM adapter. The username/password to be used in the token request are passed to the VNFM in a subscription request. The username/password sent by the VNFM adpater in the subscription request can be configuered using the
+following parameter:
+vnfmadapter:
+ auth: <encoded value>
+where <encoded value> is '<username>:<password>' encoded using org.onap.so.utils.CryptoUtils with the key set by the paramter:
+mso:
+ key: <key>
+The default username:password is vnfm-adapter:123456 when vnfm-adapter.auth is not set.
+
+---------------
+VNFM simulator:
+---------------
+Set the following parameters for the simulator:
+spring:
+ profiles:
+ active: oauth-authentication
+server:
+ request:
+ grant:
+ auth: oauth
+
+==========================================
+To use basic auth for notifications
+==========================================
+The same username/password is used as for oauth token requests as describe above and passed to the VNFM in the subscription request. \ No newline at end of file
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java
index 2b33e8b11d..f45d5a0219 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java
@@ -22,6 +22,7 @@ package org.onap.so.adapters.vnfmadapter;
import org.onap.so.security.MSOSpringFirewall;
import org.onap.so.security.WebSecurityConfig;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@@ -34,11 +35,18 @@ import org.springframework.util.StringUtils;
@EnableWebSecurity
public class WebSecurityConfigImpl extends WebSecurityConfig {
+ @Value("${server.ssl.client-auth:none}")
+ private String clientAuth;
+
@Override
protected void configure(final HttpSecurity http) throws Exception {
- http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll()
- .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and()
- .httpBasic();
+ if (clientAuth.equalsIgnoreCase("need")) {
+ http.csrf().disable().authorizeRequests().anyRequest().permitAll();
+ } else {
+ http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll()
+ .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and()
+ .httpBasic();
+ }
}
@Override
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
index b4355efc20..7c22020287 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
@@ -212,6 +212,8 @@ public class VnfmHelper {
basicAuthParams.setPassword(decrypedAuth[1]);
authentication.addAuthTypeItem(AuthTypeEnum.BASIC);
authentication.paramsBasic(basicAuthParams);
+
+ authentication.addAuthTypeItem(AuthTypeEnum.TLS_CERT);
return authentication;
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
index a604f9a6b9..93312cfa64 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
@@ -24,11 +24,12 @@ import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
import com.google.gson.Gson;
import java.io.IOException;
import java.security.KeyManagementException;
+import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.util.Iterator;
-import java.util.ListIterator;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
@@ -42,7 +43,6 @@ import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.JSON;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
-import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
import org.slf4j.Logger;
@@ -52,7 +52,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
-import org.springframework.http.client.ClientHttpRequestInterceptor;
+import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.GsonHttpMessageConverter;
@@ -73,7 +73,12 @@ public class VnfmServiceProviderConfiguration {
@Value("${http.client.ssl.trust-store:#{null}}")
private Resource trustStore;
@Value("${http.client.ssl.trust-store-password:#{null}}")
- private String trustPassword;
+ private String trustStorePassword;
+
+ @Value("${server.ssl.key-store:#{null}}")
+ private Resource keyStoreResource;
+ @Value("${server.ssl.key--store-password:#{null}}")
+ private String keyStorePassword;
/**
* This property is only intended to be temporary until the AAI schema is updated to support setting the endpoint
@@ -98,7 +103,6 @@ public class VnfmServiceProviderConfiguration {
if (trustStore != null) {
setTrustStore(restTemplate);
}
- removeSpringClientFilter(restTemplate);
return new HttpRestServiceProviderImpl(restTemplate, new BasicHttpHeadersProvider());
}
@@ -141,27 +145,26 @@ public class VnfmServiceProviderConfiguration {
private void setTrustStore(final RestTemplate restTemplate) {
SSLContext sslContext;
try {
- sslContext =
- new SSLContextBuilder().loadTrustMaterial(trustStore.getURL(), trustPassword.toCharArray()).build();
+ if (keyStoreResource != null) {
+ KeyStore keystore = KeyStore.getInstance("pkcs12");
+ keystore.load(keyStoreResource.getInputStream(), keyStorePassword.toCharArray());
+ sslContext =
+ new SSLContextBuilder().loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray())
+ .loadKeyMaterial(keystore, keyStorePassword.toCharArray()).build();
+ } else {
+ sslContext = new SSLContextBuilder()
+ .loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray()).build();
+ }
logger.info("Setting truststore: {}", trustStore.getURL());
final SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext);
final HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory).build();
final HttpComponentsClientHttpRequestFactory factory =
new HttpComponentsClientHttpRequestFactory(httpClient);
- restTemplate.setRequestFactory(factory);
+ restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(factory));
} catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
- | IOException exception) {
+ | IOException | UnrecoverableKeyException exception) {
logger.error("Error reading truststore, TLS connection to VNFM will fail.", exception);
}
}
- private void removeSpringClientFilter(final RestTemplate restTemplate) {
- ListIterator<ClientHttpRequestInterceptor> interceptorIterator = restTemplate.getInterceptors().listIterator();
- while (interceptorIterator.hasNext()) {
- if (interceptorIterator.next() instanceof SpringClientFilter) {
- interceptorIterator.remove();
- }
- }
- }
-
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
index 6cdabb9374..fe55907420 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
@@ -133,7 +133,7 @@ public class VnfmAdapterControllerTest {
setUpVimInMockAai();
final String expectedsubscriptionRequest =
- "{\"filter\":{\"vnfInstanceSubscriptionFilter\":{\"vnfInstanceIds\":[\"vnfId\"]},\"notificationTypes\":[\"VnfLcmOperationOccurrenceNotification\"]},\"callbackUri\":\"https://so-vnfm-adapter.onap:30406/so/vnfm-adapter/v1/lcn/VnfLcmOperationOccurrenceNotification\",\"authentication\":{\"authType\":[\"OAUTH2_CLIENT_CREDENTIALS\", \"BASIC\"],\"paramsOauth2ClientCredentials\":{\"clientId\":\"vnfm\",\"clientPassword\":\"password1$\",\"tokenEndpoint\":\"https://so-vnfm-adapter.onap:30406/oauth/token\"},\"paramsBasic\":{\"userName\":\"vnfm\",\"password\":\"password1$\"}}}";
+ "{\"filter\":{\"vnfInstanceSubscriptionFilter\":{\"vnfInstanceIds\":[\"vnfId\"]},\"notificationTypes\":[\"VnfLcmOperationOccurrenceNotification\"]},\"callbackUri\":\"https://so-vnfm-adapter.onap:30406/so/vnfm-adapter/v1/lcn/VnfLcmOperationOccurrenceNotification\",\"authentication\":{\"authType\":[\"OAUTH2_CLIENT_CREDENTIALS\", \"BASIC\", \"TLS_CERT\"],\"paramsOauth2ClientCredentials\":{\"clientId\":\"vnfm\",\"clientPassword\":\"password1$\",\"tokenEndpoint\":\"https://so-vnfm-adapter.onap:30406/oauth/token\"},\"paramsBasic\":{\"userName\":\"vnfm\",\"password\":\"password1$\"}}}";
final InlineResponse2001 subscriptionResponse = new InlineResponse2001();
final InlineResponse201 createResponse = createCreateResponse();
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
index 325ba913f8..e048d4c567 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
@@ -92,7 +92,7 @@ public class DeployActivitySpecs {
private void mapCategoryList(List<ActivitySpecActivitySpecCategories> activitySpecActivitySpecCategories,
ActivitySpec activitySpec) {
- if (activitySpecActivitySpecCategories == null || activitySpecActivitySpecCategories.size() == 0) {
+ if (activitySpecActivitySpecCategories == null || activitySpecActivitySpecCategories.isEmpty()) {
return;
}
List<String> categoryList = new ArrayList<>();
@@ -108,7 +108,7 @@ public class DeployActivitySpecs {
private void mapInputsAndOutputs(List<ActivitySpecActivitySpecParameters> activitySpecActivitySpecParameters,
ActivitySpec activitySpec) {
- if (activitySpecActivitySpecParameters == null || activitySpecActivitySpecParameters.size() == 0) {
+ if (activitySpecActivitySpecParameters == null || activitySpecActivitySpecParameters.isEmpty()) {
return;
}
List<Input> inputs = new ArrayList<>();
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
index 46c440db0d..a68d98e0b0 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
@@ -140,7 +140,7 @@ public class WorkflowResource {
VnfResourceWorkflow vnfResourceWorkflow = new VnfResourceWorkflow();
vnfResourceWorkflow.setVnfResourceModelUUID(vfResourceModelUuid);
vnfResourceWorkflow.setWorkflow(workflow);
- List<VnfResourceWorkflow> vnfResourceWorkflows = new ArrayList<VnfResourceWorkflow>();
+ List<VnfResourceWorkflow> vnfResourceWorkflows = new ArrayList<>();
vnfResourceWorkflows.add(vnfResourceWorkflow);
workflow.setVnfResourceWorkflow(vnfResourceWorkflows);
@@ -174,7 +174,7 @@ public class WorkflowResource {
}
protected List<String> getActivityNameList(String bpmnContent) {
- List<String> activityNameList = new ArrayList<String>();
+ List<String> activityNameList = new ArrayList<>();
Pattern p = Pattern.compile(pattern);
Matcher m = p.matcher(bpmnContent);
@@ -186,10 +186,10 @@ public class WorkflowResource {
protected List<WorkflowActivitySpecSequence> getWorkflowActivitySpecSequence(List<String> activityNames,
Workflow workflow) throws Exception {
- if (activityNames == null || activityNames.size() == 0) {
+ if (activityNames == null || activityNames.isEmpty()) {
return null;
}
- List<WorkflowActivitySpecSequence> workflowActivitySpecs = new ArrayList<WorkflowActivitySpecSequence>();
+ List<WorkflowActivitySpecSequence> workflowActivitySpecs = new ArrayList<>();
int seqNo = 1;
for (String activityName : activityNames) {
ActivitySpec activitySpec = activityRepo.findByName(activityName);
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index ef1e5128de..276b8183a8 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -1117,7 +1117,7 @@ public class ToscaResourceInstaller {
}
}
- if (tempGroupList.size() != 0 && tempGroupList.size() < groupList.size()) {
+ if (!tempGroupList.isEmpty() && tempGroupList.size() < groupList.size()) {
getVNFCGroupSequenceList(strSequence, tempGroupList, nodes, iSdcCsarHelper);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java
index 9828d11186..c05557a317 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java
@@ -78,8 +78,24 @@ public class ApplicationControllerAction {
appCStatus = healthCheckAction(msoRequestId, vnfId, vnfName, vnfHostIpAddress, controllerType);
break;
case Snapshot:
+ if (vmIdList.isEmpty()) {
+ logger.warn("vmIdList is Empty in AppCClient");
+ break;
+ }
String vmIds = JsonUtils.getJsonValue(vmIdList, "vmIds");
+ if (vmIds == null) {
+ logger.warn("vmIds null in AppCClient");
+ break;
+ }
+ if (vserverIdList.isEmpty()) {
+ logger.warn("vserverIdList is empty in AppCClient");
+ break;
+ }
String vserverIds = JsonUtils.getJsonValue(vserverIdList, "vserverIds");
+ if (vserverIds == null) {
+ logger.warn("vserverIds null in AppCClient");
+ break;
+ }
String vmId = "";
String vserverId = "";
ObjectMapper mapper = new ObjectMapper();
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java
index 32db3a7bf6..48c6995715 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java
@@ -481,4 +481,100 @@ public class ApplicationControllerActionTest extends BaseTest {
assertEquals(expectedErrorCode, appCAction.getErrorCode());
}
+ @Test
+ public void runAppCCommand_Snapshot_vmIdList_Empty_Test()
+ throws ApplicationControllerOrchestratorException, JsonProcessingException {
+ Action action = Action.Snapshot;
+ String msoRequestId = "testMsoRequestId";
+ String vnfId = "testVnfId";
+ Optional<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("identityUrl", "testIdentityUrl");
+ String controllerType = "testControllerType";
+
+ Status status = new Status();
+ Optional<String> otherPayloadVm = PayloadClient.snapshotFormat("", "identityUrl");
+ doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+
+ appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+
+ verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+ }
+
+ @Test
+ public void runAppCCommand_Snapshot_vmId_null_Test()
+ throws ApplicationControllerOrchestratorException, JsonProcessingException {
+ Action action = Action.Snapshot;
+ String msoRequestId = "testMsoRequestId";
+ String vnfId = "testVnfId";
+ Optional<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("identityUrl", "testIdentityUrl");
+
+ JSONObject vmIdListJson = new JSONObject();
+ payloadInfo.put("vmIdList", vmIdListJson.toString());
+ String controllerType = "testControllerType";
+
+ Status status = new Status();
+ Optional<String> otherPayloadVm = PayloadClient.snapshotFormat("", payloadInfo.get("identityUrl"));
+ doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+
+ appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+
+ verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+ }
+
+ @Test
+ public void runAppCCommand_Snapshot_vserverIdList_Empty_Test()
+ throws ApplicationControllerOrchestratorException, JsonProcessingException {
+ Action action = Action.Snapshot;
+ String msoRequestId = "testMsoRequestId";
+ String vnfId = "testVnfId";
+ Optional<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("identityUrl", "testIdentityUrl");
+ ArrayList<String> vmIdList = new ArrayList<String>();
+ String vmId = "testlink:testVmId";
+ vmIdList.add(vmId);
+ JSONObject vmIdListJson = new JSONObject();
+ vmIdListJson.put("vmIds", vmIdList);
+ payloadInfo.put("vmIdList", vmIdListJson.toString());
+ String controllerType = "testControllerType";
+
+ Status status = new Status();
+ Optional<String> otherPayloadVm = PayloadClient.snapshotFormat(vmId, payloadInfo.get("identityUrl"));
+ doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+
+ appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+
+ verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+ }
+
+ @Test
+ public void runAppCCommand_Snapshot_vserverId_null_Test()
+ throws ApplicationControllerOrchestratorException, JsonProcessingException {
+ Action action = Action.Snapshot;
+ String msoRequestId = "testMsoRequestId";
+ String vnfId = "testVnfId";
+ Optional<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("identityUrl", "testIdentityUrl");
+ ArrayList<String> vmIdList = new ArrayList<String>();
+ String vmId = "testlink:testVmId1";
+ vmIdList.add(vmId);
+ JSONObject vmIdListJson = new JSONObject();
+ vmIdListJson.put("vmIds", vmIdList);
+ payloadInfo.put("vmIdList", vmIdListJson.toString());
+ JSONObject vserverIdListJson = new JSONObject();
+ payloadInfo.put("vserverIdList", vserverIdListJson.toString());
+ String controllerType = "testControllerType";
+
+ Status status = new Status();
+ Optional<String> otherPayloadVm = PayloadClient.snapshotFormat(vmId, payloadInfo.get("identityUrl"));
+ doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+
+ appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+
+ verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+ }
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
index 7d5bb0dcf1..21847e1c4e 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
@@ -33,7 +33,7 @@ public class WorkflowException implements Serializable {
private final int errorCode;
private final String errorMessage;
private final String workStep;
- private TargetEntities extSystemErrorSource;
+ private transient TargetEntities extSystemErrorSource;
/**
* Constructor
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java
index b0b837b3b9..fad6490df2 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java
@@ -22,9 +22,7 @@ package org.onap.so.bpmn.core.domain;
import java.io.Serializable;
import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonRootName;
/**
* This class is used to store instance data of services aka ServiceDecomposition
@@ -46,7 +44,7 @@ public class ServiceInstance extends JsonWrapper implements Serializable {
private ModelInfo modelInfo;
private String environmentContext;
private String workloadContext;
- private Map serviceParams;
+ private transient Map serviceParams;
private Customer customer = new Customer();
private String e2eVpnKey;
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java
index d3d07f9014..3f10df36ab 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java
@@ -323,7 +323,7 @@ public class JsonUtils {
logger.debug("getJsonValue(): the raw value is a String Object={}", rawValue);
return (String) rawValue;
} else {
- logger.debug("getJsonValue(): the raw value is NOT a String Object={}", rawValue.toString());
+ logger.debug("getJsonValue(): the raw value is NOT a String Object={}", rawValue);
return rawValue.toString();
}
}
@@ -352,7 +352,7 @@ public class JsonUtils {
logger.debug("getJsonNodeValue(): the raw value is a String Object={}", rawValue);
return (String) rawValue;
} else {
- logger.debug("getJsonNodeValue(): the raw value is NOT a String Object={}", rawValue.toString());
+ logger.debug("getJsonNodeValue(): the raw value is NOT a String Object={}", rawValue);
return rawValue.toString();
}
}
@@ -380,11 +380,10 @@ public class JsonUtils {
return 0;
} else {
if (rawValue instanceof Integer) {
- logger.debug("getJsonIntValue(): the raw value is an Integer Object={}",
- ((String) rawValue).toString());
+ logger.debug("getJsonIntValue(): the raw value is an Integer Object={}", rawValue);
return (Integer) rawValue;
} else {
- logger.debug("getJsonIntValue(): the raw value is NOT an Integer Object={}", rawValue.toString());
+ logger.debug("getJsonIntValue(): the raw value is NOT an Integer Object={}", rawValue);
return 0;
}
}
@@ -412,8 +411,7 @@ public class JsonUtils {
logger.debug("getJsonBooleanValue(): the raw value is a Boolean Object={}", rawValue);
return (Boolean) rawValue;
} else {
- logger.debug("getJsonBooleanValue(): the raw value is NOT an Boolean Object={}",
- rawValue.toString());
+ logger.debug("getJsonBooleanValue(): the raw value is NOT an Boolean Object={}", rawValue);
return false;
}
}
@@ -455,7 +453,7 @@ public class JsonUtils {
return null;
} else {
if (rawValue instanceof JSONArray) {
- logger.debug("getJsonParamValue(): keys={} points to JSONArray: {}", keys, rawValue.toString());
+ logger.debug("getJsonParamValue(): keys={} points to JSONArray: {}", keys, rawValue);
int arrayLen = ((JSONArray) rawValue).length();
if (index < 0 || arrayLen < index + 1) {
logger.debug("getJsonParamValue(): index: {} is out of bounds for array size of {}", index,
@@ -464,8 +462,7 @@ public class JsonUtils {
}
int foundCnt = 0;
for (int i = 0; i < arrayLen; i++) {
- logger.debug("getJsonParamValue(): index: {}, value: {}", i,
- ((JSONArray) rawValue).get(i).toString());
+ logger.debug("getJsonParamValue(): index: {}, value: {}", i, ((JSONArray) rawValue).get(i));
if (((JSONArray) rawValue).get(i) instanceof JSONObject) {
JSONObject jsonObj = (JSONObject) ((JSONArray) rawValue).get(i);
String parmValue = jsonObj.get(name).toString();
@@ -482,16 +479,14 @@ public class JsonUtils {
continue;
}
} else {
- logger.debug("getJsonParamValue(): the JSONArray element is NOT a JSONObject={}",
- rawValue.toString());
+ logger.debug("getJsonParamValue(): the JSONArray element is NOT a JSONObject={}", rawValue);
return null;
}
}
logger.debug("getJsonParamValue(): content value NOT found for name: {}", name);
return null;
} else {
- logger.debug("getJsonParamValue(): the raw value is NOT a JSONArray Object={}",
- rawValue.toString());
+ logger.debug("getJsonParamValue(): the raw value is NOT a JSONArray Object={}", rawValue);
return null;
}
}
@@ -1057,13 +1052,13 @@ public class JsonUtils {
JsonValidator validator = factory.getValidator();
ProcessingReport report = validator.validate(schema, document);
- logger.debug("JSON schema validation report: {}", report.toString());
+ logger.debug("JSON schema validation report: {}", report);
return report.toString();
} catch (IOException e) {
- logger.debug("IOException performing JSON schema validation on document: {}", e.toString());
+ logger.debug("IOException performing JSON schema validation on document:", e);
throw new ValidationException(e.getMessage());
} catch (ProcessingException e) {
- logger.debug("ProcessingException performing JSON schema validation on document: {}", e.toString());
+ logger.debug("ProcessingException performing JSON schema validation on document:", e);
throw new ValidationException(e.getMessage());
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml
index ea1a205317..25913eabba 100644
--- a/bpmn/mso-infrastructure-bpmn/pom.xml
+++ b/bpmn/mso-infrastructure-bpmn/pom.xml
@@ -134,6 +134,24 @@
</executions>
</plugin>
</plugins>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <excludes>
+ <exclude>**/*.p12</exclude>
+ <exclude>**/*.jks</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/*.p12</include>
+ <include>**/*.jks</include>
+ </includes>
+ </resource>
+ </resources>
</build>
<dependencyManagement>
<dependencies>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.p12 b/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.p12
new file mode 100644
index 0000000000..79631bf344
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.p12
Binary files differ
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.trust.jks b/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.trust.jks
new file mode 100644
index 0000000000..6f8168d896
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.trust.jks
Binary files differ
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
index fc0f51b032..91cfa93a34 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
@@ -63,8 +63,9 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenAaiEntryExists() {
// given
variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITH_ENTRY);
- if (getUpdateResInputObj("OLT") != null) {
- variables.put("resourceInput", getUpdateResInputObj("OLT").toString());
+ ResourceInput ri = getUpdateResInputObj("OLT");
+ if (ri != null) {
+ variables.put("resourceInput", ri.toString());
} else {
variables.put("resourceInput", null);
}
@@ -86,7 +87,12 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntryExists() {
// given
variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY);
- variables.put("resourceInput", getUpdateResInputObj("OLT").toString());
+ ResourceInput ri = getUpdateResInputObj("OLT");
+ if (ri != null) {
+ variables.put("resourceInput", ri.toString());
+ } else {
+ variables.put("resourceInput", null);
+ }
// when
ProcessInstance instance =
runtimeService.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
diff --git a/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java b/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java
index e4f1998c40..12f30cfa58 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java
+++ b/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java
@@ -31,6 +31,8 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.springframework.stereotype.Component;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@Component
public class DeployActivitySpecs {
@@ -38,10 +40,12 @@ public class DeployActivitySpecs {
private static final String ACTIVITY_SPEC_URI = "/activityspec-api/v1.0/activity-spec";
private static final String CONTENT_TYPE_JSON = "application/json";
+ private static final Logger logger = LoggerFactory.getLogger(DeployActivitySpecs.class);
+
public static void main(String[] args) throws Exception {
if (args == null || args.length == 0) {
- System.out.println("Please specify hostname argument");
+ logger.info("Please specify hostname argument");
return;
}
@@ -49,20 +53,23 @@ public class DeployActivitySpecs {
File dir = new File(ACTIVITY_FILE_LOCATION);
if (!dir.isDirectory()) {
- System.out.println("ActivitySpec store is not a directory");
+ logger.debug("ActivitySpec store is not a directory");
return;
}
- for (File f : dir.listFiles()) {
- String activitySpecName = f.getName();
- String errorMessage = deployActivitySpec(hostname, activitySpecName);
- if (errorMessage == null) {
- System.out.println("Deployed Activity Spec: " + activitySpecName);
- } else {
- System.out.println("Error deploying Activity Spec: " + activitySpecName + " : " + errorMessage);
+ if (dir.listFiles() != null) {
+ for (File f : dir.listFiles()) {
+ String activitySpecName = f.getName();
+ String errorMessage = deployActivitySpec(hostname, activitySpecName);
+ if (errorMessage == null) {
+ logger.debug("Deployed Activity Spec: " + activitySpecName);
+ } else {
+ logger.error("Error deploying Activity Spec: " + activitySpecName + " : " + errorMessage);
+ }
}
+ } else {
+ logger.error("Null file list for Activity Specs.");
}
- return;
}
protected static String deployActivitySpec(String hostname, String activitySpecName) throws Exception {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
index 1516f289fe..579e7b72df 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
@@ -98,12 +98,17 @@ public class ServicePluginFactory {
new String[] {VS_MONITORED, VS_UNMONITORED, TS_MONITORED, TS_UNMONITORED};
static {
- try (InputStream is = ClassLoader.class.getResourceAsStream("/application.properties")) {
- Properties prop = new Properties();
- prop.load(is);
- OOF_DEFAULT_ENDPOINT = prop.getProperty("oof.default.endpoint");
- THIRD_SP_DEFAULT_ENDPOINT = prop.getProperty("third.sp.default.endpoint");
- INVENTORY_OSS_DEFAULT_ENDPOINT = prop.getProperty("inventory.oss.default.endpoint");
+ try {
+ InputStream is = ClassLoader.class.getResourceAsStream("/application.properties");
+ if (null != is) {
+ Properties prop = new Properties();
+ prop.load(is);
+ OOF_DEFAULT_ENDPOINT = prop.getProperty("oof.default.endpoint");
+ THIRD_SP_DEFAULT_ENDPOINT = prop.getProperty("third.sp.default.endpoint");
+ INVENTORY_OSS_DEFAULT_ENDPOINT = prop.getProperty("inventory.oss.default.endpoint");
+ } else {
+ logger.error("Failed to load property file, Either property file is missing or empty!");
+ }
} catch (IOException e) {
logger.error("Failed to load property file!");
}
@@ -434,7 +439,7 @@ public class ServicePluginFactory {
}
}
- logger.error("There is no matching logical link for allowed list :" + allowedList.toString());
+ logger.error("There is no matching logical link for allowed list :" + Arrays.toString(allowedList));
return null;
} else {
logger.info("link customization is not required");
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
index 638ecefa49..a436f7b5c2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -99,6 +99,7 @@ public class ExecuteActivity implements JavaDelegate {
variables.put(G_REQUEST_ID, requestId);
variables.put("retryCount", 1);
variables.put("aLaCarte", true);
+ variables.put("suppressRollback", true);
execution.getVariables().forEach((key, value) -> {
if (value instanceof Serializable) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
index f5bae2c82a..c3c0047fff 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
@@ -21,14 +21,32 @@
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import java.io.IOException;
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
+import javax.net.ssl.SSLContext;
+import org.apache.http.client.HttpClient;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.ssl.SSLContextBuilder;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.onap.so.configuration.rest.HttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.Resource;
+import org.springframework.http.client.BufferingClientHttpRequestFactory;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
/**
@@ -40,13 +58,55 @@ import org.springframework.web.client.RestTemplate;
@Configuration
public class VnfmAdapterCreateVnfTaskConfiguration {
+ private static final Logger logger = LoggerFactory.getLogger(VnfmAdapterCreateVnfTaskConfiguration.class);
+
+ @Value("${rest.http.client.configuration.ssl.trustStore:#{null}}")
+ private Resource trustStore;
+
+ @Value("${rest.http.client.configuration.ssl.trustStorePassword:#{null}}")
+ private String trustStorePassword;
+
+ @Value("${rest.http.client.configuration.ssl.keyStore:#{null}}")
+ private Resource keyStoreResource;
+
+ @Value("${rest.http.client.configuration.ssl.keyStorePassword:#{null}}")
+ private String keyStorePassword;
+
@Bean
public HttpRestServiceProvider databaseHttpRestServiceProvider(
@Qualifier(CONFIGURABLE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate,
@Autowired final VnfmBasicHttpConfigProvider etsiVnfmAdapter) {
+ if (trustStore != null) {
+ setTrustStore(restTemplate);
+ }
return getHttpRestServiceProvider(restTemplate, new BasicHttpHeadersProvider(etsiVnfmAdapter.getAuth()));
}
+ private void setTrustStore(final RestTemplate restTemplate) {
+ SSLContext sslContext;
+ try {
+ if (keyStoreResource != null) {
+ KeyStore keystore = KeyStore.getInstance("pkcs12");
+ keystore.load(keyStoreResource.getInputStream(), keyStorePassword.toCharArray());
+ sslContext =
+ new SSLContextBuilder().loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray())
+ .loadKeyMaterial(keystore, keyStorePassword.toCharArray()).build();
+ } else {
+ sslContext = new SSLContextBuilder()
+ .loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray()).build();
+ }
+ logger.info("Setting truststore: {}", trustStore.getURL());
+ final SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext);
+ final HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory).build();
+ final HttpComponentsClientHttpRequestFactory factory =
+ new HttpComponentsClientHttpRequestFactory(httpClient);
+ restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(factory));
+ } catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
+ | IOException | UnrecoverableKeyException exception) {
+ logger.error("Error reading truststore, TLS connection to VNFM will fail.", exception);
+ }
+ }
+
private HttpRestServiceProvider getHttpRestServiceProvider(final RestTemplate restTemplate,
final HttpHeadersProvider httpHeadersProvider) {
return new HttpRestServiceProviderImpl(restTemplate, httpHeadersProvider);
diff --git a/docs/developer_info/developer_information.rst b/docs/developer_info/developer_information.rst
index ac1a15b8b9..10ea8360b9 100644
--- a/docs/developer_info/developer_information.rst
+++ b/docs/developer_info/developer_information.rst
@@ -8,14 +8,15 @@ SO Developer Information
.. toctree::
:maxdepth: 1
- Camunda_Modeler.rst
+
Building_SO.rst
Working_with_SO_Docker.rst
Camunda_Cockpit_Community_Edition.rst
Camunda_Cockpit_Enterprise_Edition.rst
- Camunda_Modeler
+ Camunda_Modeler.rst
BPMN_Project_Structure.rst
BPMN_Main_Process_Flows.rst
BPMN_Subprocess_Process_Flows.rst
BPMN_Project_Deployment_Strategy.rst
+ instantiate/index.rst
FAQs.rst
diff --git a/docs/developer_info/instantiate/index.rst b/docs/developer_info/instantiate/index.rst
new file mode 100644
index 0000000000..21177b59ad
--- /dev/null
+++ b/docs/developer_info/instantiate/index.rst
@@ -0,0 +1,31 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2017 AT&T Intellectual Property. All rights reserved.
+
+
+Instantiate
+===========
+The following guides are provided to describe tasks that a user of
+ONAP may need to perform when instantiating a service.
+
+Instantiation includes the following topics:
+
+.. toctree::
+ :maxdepth: 2
+
+ Pre-instantiation operations <./pre_instantiation/index.rst>
+
+ Instantiation operation(s) <./instantiation/index.rst>
+
+
+**e2eServiceInstance** method is a hard-coded approach with dedicated/specific
+service BPMN workflow. That means it is linked to ONAP source code
+and lifecycle.
+
+**A La Carte** method requires the Operations actor to build and send
+a lot of operations. To build those requests, Operator actor needs to
+define/collect by himself all VNF parameters/values.
+
+**Macro** method required the Operations actor to build and send only one
+request and, thanks to CDS Blueprint templates, ONAP will collect and assign
+all required parameters/values by itself.
diff --git a/docs/developer_info/instantiate/instantiation/index.rst b/docs/developer_info/instantiate/instantiation/index.rst
new file mode 100644
index 0000000000..455bdf070e
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/index.rst
@@ -0,0 +1,28 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+.. _doc_guide_user_ser_inst:
+
+
+Service Instantiation methods
+=============================
+
+
+Declare PNF instances:
+
+.. toctree::
+ :maxdepth: 2
+
+ Declare PNF instances <./pnf_instance/index.rst>
+
+Instantiate a Service:
+
+.. toctree::
+ :maxdepth: 2
+
+ using ONAP VID Portal with "A La Carte" method <./vid/index.rst>
+ using ONAP UUI Portal with "e2eServiceInstance" method <./uui/index.rst>
+ using ONAP NBI REST API (TM Forum) <./nbi/index.rst>
+ using ONAP SO REST API with "A La Carte" method <./so1/index.rst>
+ using ONAP SO REST API with "Macro" mode method <./so2/index.rst>
diff --git a/docs/developer_info/instantiate/instantiation/nbi/index.rst b/docs/developer_info/instantiate/instantiation/nbi/index.rst
new file mode 100644
index 0000000000..96bbc3a8dd
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/nbi/index.rst
@@ -0,0 +1,97 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+.. _doc_guide_user_ser_inst_nbi:
+
+
+Service Instantiation via ONAP NBI API (TM Forum)
+=================================================
+
+ONAP NBI allow you to use a TM Forum standardized API (serviceOrder API)
+
+Additional info in:
+
+.. toctree::
+ :maxdepth: 1
+ :titlesonly:
+
+ NBI Guide <../../../../../submodules/externalapi/nbi.git/docs/offeredapis/offeredapis.rst>
+
+
+ONAP NBI will convert that request to ONAP SO request.
+
+
+ServiceOrder management in NBI will support 2 modes:
+
+* E2E integration - NBI calls SO API to perform an End-To-end integration
+* Service-level only integration - NBI will trigger only SO request at
+ serviceInstance level (not at VNF, not at Vf-module level and nothing will
+ be created on cloud platform)
+
+ONAP SO prerequisite: SO must be able to find a BPMN to process service
+fulfillment (integrate VNF, VNF activation in SDNC, VF module)
+
+The choice of the mode is done by NBI depending on information retrieved
+in SDC. If the serviceSpecification is within a Category "E2E Service" ,
+NBI will use E2E SO API, if not only API at service instance level
+will be used.
+
+There is no difference or specific expectation in the service order API
+used by NBI user.
+
+
+Example of serviceOrder to instantiate (=add) a service based on model
+with id=0d463b0c-e559-4def-8d7b-df64cfbd3159
+
+
+::
+
+ curl -X POST \
+ http://nbi.api.simpledemo.onap.org:30274/nbi/api/v4/serviceOrder \
+ -H 'Accept: application/json' \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "externalId": "BSS_order_001",
+ "priority": "1",
+ "description": "this is a service order to instantiate a service",
+ "category": "Consumer",
+ "requestedStartDate": "",
+ "requestedCompletionDate": "",
+ "relatedParty": [
+ {
+ "id": "JohnDoe",
+ "role": "ONAPcustomer",
+ "name": "JohnDoe"
+ }
+ ],
+ "orderItem": [
+ {
+ "id": "1",
+ "action": "add",
+ "service": {
+ "name": "my_service_model_instance_01",
+ "serviceState": "active",
+ "serviceSpecification": {
+ "id": "0d463b0c-e559-4def-8d7b-df64cfbd3159"
+ }
+ }
+ }
+ ]
+ }'
+
+In the response, you will obtain the serviceOrderId value.
+
+Then you have the possibility to check about the serviceorder
+(here after the serviceOrderId=5d06309da0e46400017b1123).
+
+This will allow you to get the serviceOrder Status (completed, failed...)
+
+::
+
+ curl -X GET \
+ http://nbi.api.simpledemo.onap.org:30274/nbi/api/v4/serviceOrder/5d06309da0e46400017b1123 \
+ -H 'Accept: application/json' \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache'
diff --git a/docs/developer_info/instantiate/instantiation/pnf_instance/index.rst b/docs/developer_info/instantiate/instantiation/pnf_instance/index.rst
new file mode 100644
index 0000000000..7fbfdbe79f
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/pnf_instance/index.rst
@@ -0,0 +1,107 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+
+
+Declare PNF instances in ONAP
+=============================
+
+PNF instances can be declared in ONAP inventory (AAI) using REST API
+
+
+An example:
+
+::
+
+ curl -X PUT \
+ https://{{ONAP_LB_IP@}}:30233/aai/v16/network/pnfs/pnf/my_pnf_instance_001 \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Cache-Control: no-cache' \
+ -H 'Content-Type: application/json' \
+ -H 'Postman-Token: f5e2aae0-dc1c-4edb-b9e9-a93b05aee5e8' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 999' \
+ -H 'depth: all' \
+ -d '{
+ "pnf-name":" my_pnf_instance_001",
+ "equip-type":" router",
+ "nf-role":"primary",
+ "p-interfaces": {
+ "p-interface": [
+ {
+ "interface-name": "ae1",
+ "port-description": "Link aggregate for trunk between switches"
+ },
+ {
+ "interface-name": "xe-0/0/6",
+ "port-description": "to PNF_instance_002 trunk1"
+ },
+ {
+ "interface-name": "xe-0/0/2",
+ "port-description": "to PNF_instance_003 trunk1"
+ },
+ {
+ "interface-name": "xe-0/0/10",
+ "port-description": "to PNF_instance_004 trunk1"
+ },
+ {
+ "interface-name": "xe-0/0/0",
+ "port-description": "firewall trunk"
+ },
+ {
+ "interface-name": "xe-0/0/14",
+ "port-description": "to PNF_instance_005 trunk1"
+ }
+ ]
+ }
+ }' -k
+
+
+It is possible to declare the location where is deployed the PNF
+(called a "complex" in ONAP AAI)
+
+::
+
+ curl -X PUT \
+ https:// {{ONAP_LB_IP@}}:30233/aai/v11/cloud-infrastructure/complexes/complex/my_complex_name \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Cache-Control: no-cache' \
+ -H 'Content-Type: application/json' \
+ -H 'Postman-Token: 43523984-db01-449a-8a58-8888871110bc' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 999' \
+ -H 'depth: all' \
+ -d '{
+ "physical-location-type":"PoP",
+ "physical-location-id":"my_complex_name",
+ "complex-name":"Name of my Complex",
+ "city":"LANNION",
+ "postal-code":"22300",
+ "country":"FRANCE",
+ "street1":"Avenue Pierre Marzin",
+ "region":"Europe"
+ }' -k
+
+
+
+To indicate that a PNF instance is located in a complex, we create a relation
+
+::
+
+ curl -X PUT \
+ https:// {{ONAP_LB_IP@}}:30233/aai/v14/network/pnfs/pnf/my_pnf_instance_001/relationship-list/relationship \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Cache-Control: no-cache' \
+ -H 'Content-Type: application/json' \
+ -H 'Postman-Token: 15315304-17c5-4e64-aada-bb149f1af915' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 999' \
+ -H 'depth: all' \
+ -d '{
+ "related-to": "complex",
+ "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/my_complex_name"
+ }' -k
diff --git a/docs/developer_info/instantiate/instantiation/so1/index.rst b/docs/developer_info/instantiate/instantiation/so1/index.rst
new file mode 100644
index 0000000000..86f03bdd38
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/so1/index.rst
@@ -0,0 +1,366 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+.. _doc_guide_user_ser_inst_so1:
+
+
+A La Carte mode Service Instantiation via ONAP SO API
+=====================================================
+
+Using ONAP SO API in "A La Carte" mode, you need to send several requests,
+depending on the service model composition.
+
+For example, if your service model is composed of 2 VNF and a Network,
+you will have to build and send :
+
+* a request to SO to create the "service instance" object
+* a request to SO to create the VNF 1 instance object
+* a request to SDNC to declare VNF 1 instance parameters and values
+ (SDNC preload)
+* a request to SO to create the Vf-module 1 instance object
+* a request to SO to create the VNF 2 instance object
+* a request to SDNC to declare VNF 2 instance parameters and values
+ (SDNC preload)
+* a request to SO to create the Vf-module 2 instance object
+* a request to SO to create the Network instance object
+
+
+
+Example to request a service instance directly to ONAP SO
+
+
+TO BE COMPLETED
+
+
+
+In the response, you will obtain the serviceOrderId value.
+
+Then you have the possibility to check about the SO request
+(here after the requestId=e3ad8df6-ea0d-4384-be95-bcb7dd39bbde).
+
+This will allow you to get the serviceOrder Status (completed, failed...)
+
+::
+
+ curl -X GET \
+ http://so.api.simpledemo.onap.org:30277/onap/so/infra/orchestrationRequests/v6/e3ad8df6-ea0d-4384-be95-bcb7dd39bbde \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: get_aai_subscr' \
+ -H 'cache-control: no-cache'
+
+
+To instantiate a VNF, you need to build a complex request.
+All necessary parameters are available in the Tosca service template
+generated by SDC when you defined your service model.
+
+::
+
+ curl -X POST \
+ http://so.api.simpledemo.onap.org:30277/onap/so/infra/serviceInstances/v6/95762b50-0244-4723-8fde-35f911db9263/vnfs \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: get_aai_subscr' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "requestDetails": {
+ "requestInfo": {
+ "productFamilyId": "0d463b0c-e559-4def-8d7b-df64cfbd3159",
+ "instanceName": "my_service_vnf_instance_001",
+ "source": "VID",
+ "suppressRollback": false,
+ "requestorId": "test"
+ },
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelInvariantId": "4e66bb92-c597-439e-822d-75aaa69b13d4",
+ "modelVersionId": "3b6ba59c-287c-449e-a1da-2db49984a087",
+ "modelName": "my_service_VF",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "",
+ "modelCustomizationName": ""
+ },
+ "requestParameters": {
+ "userParams": [],
+ "aLaCarte": true,
+ "testApi": "VNF_API"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "my_cloud_site",
+ "tenantId": "5906b9b8fd9642df9ba1c9e290063439"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "test_LOB"
+ },
+ "platform": {
+ "platformName": "test_platform"
+ },
+ "relatedInstanceList": [{
+ "relatedInstance": {
+ "instanceId": "95762b50-0244-4723-8fde-35f911db9263",
+ "modelInfo": {
+ "modelType": "service",
+ "modelName": "my-service-model",
+ "modelInvariantId": "11265d8c-2cc2-40e5-95d8-57cad81c18da",
+ "modelVersion": "1.0",
+ "modelVersionId": "0d463b0c-e559-4def-8d7b-df64cfbd3159"
+ }
+ }
+ }]
+ }
+ }'
+
+To instantiate a VF module, you need to build two complex requests
+All necessary parameters are available in the Tosca service template
+generated by SDC when you defined your service model.
+
+1st request is called a "SDNC-preload" for a VNF object and is used
+to store in SDNC some VNF parameters values
+that will be needed for the instantiation
+
+::
+
+ curl -X POST \
+ http://sdnc.api.simpledemo.onap.org:30202/restconf/operations/VNF-API:preload-vnf-topology-operation \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: API client' \
+ -H 'X-TransactionId: 0a3f6713-ba96-4971-a6f8-c2da85a3176e' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "input": {
+ "request-information": {
+ "notification-url": "onap.org",
+ "order-number": "1",
+ "order-version": "1",
+ "request-action": "PreloadVNFRequest",
+ "request-id": "test"
+ },
+ "sdnc-request-header": {
+ "svc-action": "reserve",
+ "svc-notification-url": "http:\/\/onap.org:8080\/adapters\/rest\/SDNCNotify",
+ "svc-request-id": "test"
+ },
+ "vnf-topology-information": {
+ "vnf-assignments": {
+ "availability-zones": [],
+ "vnf-networks": [],
+ "vnf-vms": []
+ },
+ "vnf-parameters": [],
+ "vnf-topology-identifier": {
+ "generic-vnf-name": "my_service_vnf_instance_001",
+ "generic-vnf-type": "",
+ "service-type": "95762b50-0244-4723-8fde-35f911db9263",
+ "vnf-name": "my_service_vfmodule_001",
+ "vnf-type": ""
+ }
+ }
+ }
+ }'
+
+The 2nd request is to instantiate the VF module via ONAP SO
+(instance name must be identical in both requests)
+
+::
+
+ curl -X POST \
+ http://so.api.simpledemo.onap.org:30277/onap/so/infra/serviceInstances/v6/95762b50-0244-4723-8fde-35f911db9263/vnfs/vfModules \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: get_aai_subscr' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "requestDetails": {
+ "requestInfo": {
+ "instanceName": "my_vfmodule_001",
+ "source": "VID",
+ "suppressRollback": false,
+ "requestorId": "test"
+ },
+ "modelInfo": {
+ "modelType": "vfModule",
+ "modelInvariantId": "",
+ "modelVersionId": "",
+ "modelName": "",
+ "modelVersion": "1",
+ "modelCustomizationId": "",
+ "modelCustomizationName": ""
+ },
+ "requestParameters": {
+ "userParams": [],
+ "testApi": "VNF_API",
+ "usePreload": true
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "my_cloud_site",
+ "tenantId": "5906b9b8fd9642df9ba1c9e290063439"
+ },
+ "relatedInstanceList": [{
+ "relatedInstance": {
+ "instanceId": "95762b50-0244-4723-8fde-35f911db9263",
+ "modelInfo": {
+ "modelType": "service",
+ "modelName": "my-service-model",
+ "modelInvariantId": "11265d8c-2cc2-40e5-95d8-57cad81c18da",
+ "modelVersion": "1.0",
+ "modelVersionId": "0d463b0c-e559-4def-8d7b-df64cfbd3159"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "",
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelName": "my_service_model_VF",
+ "modelInvariantId": "4e66bb92-c597-439e-822d-75aaa69b13d4",
+ "modelVersion": "1.0",
+ "modelVersionId": "3b6ba59c-287c-449e-a1da-2db49984a087",
+ "modelCustomizationId": "",
+ "modelCustomizationName": ""
+ }
+ }
+ }]
+ }
+ }'
+
+
+
+To instantiate a Neutron Network, you need to build two complex request.
+All necessary parameters are available in the Tosca service template
+generated by SDC when you defined your service model.
+
+
+1st request is the "SDNC-preload" for a network object:
+
+::
+
+ curl -X POST \
+ http://sdnc.api.simpledemo.onap.org:30202/restconf/operations/VNF-API:preload-network-topology-operation \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: API client' \
+ -H 'X-TransactionId: 0a3f6713-ba96-4971-a6f8-c2da85a3176e' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "input": {
+ "request-information": {
+ "request-id": "postman001",
+ "notification-url": "http://so.onap.org",
+ "order-number": "postman001",
+ "request-sub-action": "SUPP",
+ "request-action": "PreloadNetworkRequest",
+ "source": "postman",
+ "order-version": "1.0"
+ },
+ "network-topology-information": {
+ "network-policy": [],
+ "route-table-reference": [],
+ "vpn-bindings": [],
+ "network-topology-identifier": {
+ "network-role": "integration_test_net",
+ "network-technology": "neutron",
+ "service-type": "my-service-2",
+ "network-name": "my_network_01",
+ "network-type": "Generic NeutronNet"
+ },
+ "provider-network-information": {
+ "is-external-network": "false",
+ "is-provider-network": "false",
+ "is-shared-network": "false"
+ },
+ "subnets": [
+ {
+ "subnet-name": "my_subnet_01",
+ "subnet-role": "OAM",
+ "start-address": "192.168.90.0",
+ "cidr-mask": "24",
+ "ip-version": "4",
+ "dhcp-enabled": "Y",
+ "dhcp-start-address": "",
+ "dhcp-end-address": "",
+ "gateway-address": "192.168.90.1",
+ "host-routes":[]
+ }
+ ]
+ },
+ "sdnc-request-header": {
+ "svc-action": "reserve",
+ "svc-notification-url": "http://so.onap.org",
+ "svc-request-id": "postman001"
+ }
+ }
+ }'
+
+
+2nd request is to instantiate the network via ONAP SO
+(instance name must be identical in both requests)
+
+
+::
+
+ curl -X POST \
+ http://so.api.simpledemo.onap.org:30277/onap/so/infra/serviceInstances/v6/95762b50-0244-4723-8fde-35f911db9263/networks \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: get_aai_subscr' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "requestDetails": {
+ "requestInfo": {
+ "instanceName": "my_network_01",
+ "source": "VID",
+ "suppressRollback": false,
+ "requestorId": "demo",
+ "productFamilyId": "b9ac88f7-0e1b-462d-84ac-74c3c533217c"
+ },
+ "modelInfo": {
+ "modelType": "network",
+ "modelInvariantId": "0070b65c-48cb-4985-b4df-7c67ca99cd95",
+ "modelVersionId": "4f738bed-e804-4765-8d22-07bb4d11f14b",
+ "modelName": "Generic NeutronNet",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "95534a95-dc8d-4ffb-89c7-091e2c49b55d",
+ "modelCustomizationName": "Generic NeutronNet 0"
+ },
+ "requestParameters": {
+ "userParams": [],
+ "aLaCarte": true,
+ "testApi": "VNF_API"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "my_cloud_site",
+ "tenantId": "5906b9b8fd9642df9ba1c9e290063439"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "Test_LOB"
+ },
+ "platform": {
+ "platformName": "Test_platform"
+ },
+ "relatedInstanceList": [{
+ "relatedInstance": {
+ "instanceId": "95762b50-0244-4723-8fde-35f911db9263",
+ "modelInfo": {
+ "modelType": "service",
+ "modelName": "my_service_model_name",
+ "modelInvariantId": "11265d8c-2cc2-40e5-95d8-57cad81c18da",
+ "modelVersion": "1.0",
+ "modelVersionId": "0d463b0c-e559-4def-8d7b-df64cfbd3159"
+ }
+ }
+ }]
+ }
+ }'
diff --git a/docs/developer_info/instantiate/instantiation/so2/index.rst b/docs/developer_info/instantiate/instantiation/so2/index.rst
new file mode 100644
index 0000000000..02a5f70d3c
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/so2/index.rst
@@ -0,0 +1,197 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+.. _doc_guide_user_ser_inst_so2:
+
+
+Macro mode Service Instantiation via ONAP SO API
+================================================
+
+Using Macro mode, you have to build and send only one request to ONAP SO
+
+In that request you need to indicate all object instances
+that you want to be instantiated.
+
+Reminder : ONAP SO in Macro mode will perform the VNF parameters/values
+assignment based on CDS Blueprint templates
+that are supposed to be defined during Design and Onboard steps.
+That means ONAP has all information
+to be able to get all necessary values by itself (there is no longer need
+for an Operator to provide "SDNC preload").
+
+Additional info in:
+
+.. toctree::
+ :maxdepth: 1
+ :titlesonly:
+
+ CDS Documentation <../../../../../submodules/ccsdk/cds.git/docs/index.rst>
+ CDS vDNS E2E Automation <https://wiki.onap.org/display/DW/vDNS+CDS+Dublin>
+
+
+Request Example :
+
+::
+
+ curl -X POST \
+ 'http://{{k8s}}:30277/onap/so/infra/serviceInstantiation/v7/serviceInstances' \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "requestDetails": {
+ "subscriberInfo": {
+ "globalSubscriberId": "Demonstration"
+ },
+ "requestInfo": {
+ "suppressRollback": false,
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "requestorId": "adt",
+ "instanceName": "{{cds-instance-name}}",
+ "source": "VID"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "fr1",
+ "tenantId": "6270eaa820934710960682c506115453"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "vFW",
+ "userParams": [
+ {
+ "Homing_Solution": "none"
+ },
+ {
+ "service": {
+ "instanceParams": [
+
+ ],
+ "instanceName": "{{cds-instance-name}}",
+ "resources": {
+ "vnfs": [
+ {
+ "modelInfo": {
+ "modelName": "{{vnf-modelinfo-modelname}}",
+ "modelVersionId": "{{vnf-modelinfo-modeluuid}}",
+ "modelInvariantUuid": "{{vnf-modelinfo-modelinvariantuuid}}",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "{{vnf-modelinfo-modelcustomizationuuid}}",
+ "modelInstanceName": "{{vnf-modelinfo-modelinstancename}}"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "fr1",
+ "tenantId": "6270eaa820934710960682c506115453"
+ },
+ "platform": {
+ "platformName": "test"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "someValue"
+ },
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "instanceName": "{{vnf-modelinfo-modelinstancename}}",
+ "instanceParams": [
+ {
+ "onap_private_net_id": "olc-private",
+ "onap_private_subnet_id": "olc-private",
+ "pub_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwj7uJMyKiP1ogEsZv5kKDFw9mFNhxI+woR3Tuv8vjfNnqdB1GfSnvTFyNbdpyNdR8BlljkiZ1SlwJLEkvPk0HpOoSVVek/QmBeGC7mxyRcpMB2cNQwjXGfsVrforddXOnOkj+zx1aNdVGMc52Js3pex8B/L00H68kOcwP26BI1o77Uh+AxjOkIEGs+wlWNUmXabLDCH8l8IJk9mCTruKEN9KNj4NRZcaNC+XOz42SyHV9RT3N6efp31FqKzo8Ko63QirvKEEBSOAf9VlJ7mFMrGIGH37AP3JJfFYEHDdOA3N64ZpJLa39y25EWwGZNlWpO/GW5bNjTME04dl4eRyd",
+ "image_name": "Ubuntu 14.04",
+ "flavor_name":"s1.cw.small-1"
+ }
+ ],
+ "vfModules": [
+ {
+ "modelInfo": {
+ "modelName": "{{vnf-vfmodule-0-modelinfo-modelname}}",
+ "modelVersionId": "{{vnf-vfmodule-0-modelinfo-modeluuid}}",
+ "modelInvariantUuid": "{{vnf-vfmodule-0-modelinfo-modelinvariantuuid}}",
+ "modelVersion": "1",
+ "modelCustomizationId": "{{vnf-vfmodule-0-modelinfo-modelcustomizationuuid}}"
+ },
+ "instanceName": "{{vnf-vfmodule-0-modelinfo-modelname}}",
+ "instanceParams": [
+ {
+ "sec_group": "olc-open",
+ "public_net_id": "olc-net"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "{{vnf-vfmodule-1-modelinfo-modelname}}",
+ "modelVersionId": "{{vnf-vfmodule-1-modelinfo-modeluuid}}",
+ "modelInvariantUuid": "{{vnf-vfmodule-1-modelinfo-modelinvariantuuid}}",
+ "modelVersion": "1",
+ "modelCustomizationId": "{{vnf-vfmodule-1-modelinfo-modelcustomizationuuid}}"
+ },
+ "instanceName": "{{vnf-vfmodule-1-modelinfo-modelname}}",
+ "instanceParams": [
+ {
+ "sec_group": "olc-open",
+ "public_net_id": "olc-net"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "{{vnf-vfmodule-2-modelinfo-modelname}}",
+ "modelVersionId": "{{vnf-vfmodule-2-modelinfo-modeluuid}}",
+ "modelInvariantUuid": "{{vnf-vfmodule-2-modelinfo-modelinvariantuuid}}",
+ "modelVersion": "1",
+ "modelCustomizationId": "{{vnf-vfmodule-2-modelinfo-modelcustomizationuuid}}"
+ },
+ "instanceName": "{{vnf-vfmodule-2-modelinfo-modelname}}",
+ "instanceParams": [
+ {
+ "sec_group": "olc-open",
+ "public_net_id": "olc-net"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "{{vnf-vfmodule-3-modelinfo-modelname}}",
+ "modelVersionId": "{{vnf-vfmodule-3-modelinfo-modeluuid}}",
+ "modelInvariantUuid": "{{vnf-vfmodule-3-modelinfo-modelinvariantuuid}}",
+ "modelVersion": "1",
+ "modelCustomizationId": "{{vnf-vfmodule-3-modelinfo-modelcustomizationuuid}}"
+ },
+ "instanceName": "{{vnf-vfmodule-3-modelinfo-modelname}}",
+ "instanceParams": [
+ {
+ "sec_group": "olc-open",
+ "public_net_id": "olc-net"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "modelInfo": {
+ "modelVersion": "1.0",
+ "modelVersionId": "{{service-uuid}}",
+ "modelInvariantId": "{{service-invariantUUID}}",
+ "modelName": "{{service-name}}",
+ "modelType": "service"
+ }
+ }
+ }
+ ],
+ "aLaCarte": false
+ },
+ "project": {
+ "projectName": "Project-Demonstration"
+ },
+ "owningEntity": {
+ "owningEntityId": "24ef5425-bec4-4fa3-ab03-c0ecf4eaac96",
+ "owningEntityName": "OE-Demonstration"
+ },
+ "modelInfo": {
+ "modelVersion": "1.0",
+ "modelVersionId": "{{service-uuid}}",
+ "modelInvariantId": "{{service-invariantUUID}}",
+ "modelName": "{{service-name}}",
+ "modelType": "service"
+ }
+ }
+ }'
diff --git a/docs/developer_info/instantiate/instantiation/uui/index.rst b/docs/developer_info/instantiate/instantiation/uui/index.rst
new file mode 100644
index 0000000000..fa57be2717
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/uui/index.rst
@@ -0,0 +1,14 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+
+e2eServiceInstance mode via ONAP UUI Portal
+===========================================
+
+
+.. toctree::
+ :maxdepth: 1
+ :titlesonly:
+
+ ../../../../../submodules/usecase-ui.git/docs/platform/installation/user-guide/index.rst
diff --git a/docs/developer_info/instantiate/instantiation/vid/index.rst b/docs/developer_info/instantiate/instantiation/vid/index.rst
new file mode 100644
index 0000000000..307ceb9819
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/vid/index.rst
@@ -0,0 +1,13 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+
+A La Carte mode Service Instantiation via ONAP VID Portal
+=========================================================
+
+.. toctree::
+ :maxdepth: 1
+ :titlesonly:
+
+ ../../../../../submodules/vid.git/docs/humaninterfaces.rst
diff --git a/docs/developer_info/instantiate/pre_instantiation/index.rst b/docs/developer_info/instantiate/pre_instantiation/index.rst
new file mode 100644
index 0000000000..ca9af13d7d
--- /dev/null
+++ b/docs/developer_info/instantiate/pre_instantiation/index.rst
@@ -0,0 +1,225 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+.. _doc_guide_user_pre_ser-inst:
+
+
+Pre Service instantiation Operations
+====================================
+
+Several operations need to be performed after Service model distribution,
+but before instantiating a service.
+
+Those operations are only available via REST API requests.
+
+Various tools can be used to send REST API requests.
+
+Here after are examples using "curl" command line tool that you can use in
+a Unix Terminal.
+
+
+Declare owningEntity, lineOfBusiness, Platform and Project
+----------------------------------------------------------
+
+At one point during Service Instantiation, the user need to select values for
+those 4 parameters
+
+* Owning Entity
+* Line Of Business
+* Platform
+* Project
+
+
+Those parameters and values must be pre-declared in ONAP VID component
+using REST API
+
+Those informations will be available to all service instantiation
+(you only need to declare them once in ONAP)
+
+
+Example for "Owning Entity" named "Test"
+
+::
+
+ curl -X POST \
+ http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/owningEntity \
+ -H 'Accept-Encoding: gzip, deflate' \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "options": ["Test"]
+ }'
+
+Example for "platform" named "Test_Platform"
+
+::
+
+ curl -X POST \
+ http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/platform \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "options": [""Test_Platform"]
+ }'
+
+Example for "line of business" named "Test_LOB"
+
+::
+
+ curl -X POST \
+ http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/lineOfBusiness \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "options": ["Test_LOB"]
+ }'
+
+Example for "project" named "Test_project"
+
+::
+
+ curl -X POST \
+ http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/project \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "options": ["Test_project"]
+ }'
+
+
+
+
+Declare a customer
+------------------
+
+Each time you have a new customer, you will need to perform those operations
+
+This operation is using ONAP AAI REST API
+
+Any service instance need to be linked to a customer
+
+in the query path, you put the customer_name
+
+in the query body you put the customer name again
+
+Here after an example to declare a customer named "my_customer_name"
+
+
+::
+
+ curl -X PUT \
+ https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "global-customer-id": "my_customer_name",
+ "subscriber-name": "my_customer_name",
+ "subscriber-type": "INFRA"
+ }' -k
+
+
+check customers in ONAP AAI (you should see if everything ok in the response)
+
+::
+
+ curl -X GET \
+ https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
+ -H 'cache-control: no-cache' -k
+
+
+Associate Service Model to Customer
+-----------------------------------
+
+
+This operation is using ONAP AAI REST API
+
+in the query path, you put the customer_name and the service model name
+
+in the query body you put the service model UUID
+
+::
+
+ curl -X PUT \
+ https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name/service-subscriptions/service-subscription/my_service_model_name \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'Postman-Token: d4bc4991-a518-4d75-8a87-674ba44bf13a' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "service-id": "11265d8c-2cc2-40e5-95d8-57cad81c18da"
+ }' -k
+
+
+
+
+Associate Cloud Site to Customer
+--------------------------------
+
+in the query path, you put the customer_name and the service model name
+
+in the query body you put the cloud owner name, the cloud site name,
+the tenant id and the tenant name
+
+
+::
+
+ curl -X PUT \
+ https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name/service-subscriptions/service-subscription/my_service_model_name/relationship-list/relationship \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'Postman-Token: 11ea9a9e-0dc8-4d20-8a78-c75cd6928916' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "related-to": "tenant",
+ "related-link": "/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/my_cloud_owner_name/my_cloud_site_name/tenants/tenant/234a9a2dc4b643be9812915b214cdbbb",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "my_cloud_owner_name"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "my_cloud_site_name"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "234a9a2dc4b643be9812915b214cdbbb"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "my_tenant_name"
+ }
+ ]
+ }' -k
+
+
+check (you should see if everything ok in the response)
+
+::
+
+ curl -X GET \
+ 'https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name/service-subscriptions?depth=all' \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
+ -H 'cache-control: no-cache' -k
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
index 554c794e3e..15572f2b39 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
@@ -216,7 +216,7 @@ public class InstanceManagement {
try {
recipeLookupResult = getCustomWorkflowUri(workflowUuid);
- } catch (IOException e) {
+ } catch (Exception e) {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
@@ -243,7 +243,7 @@ public class InstanceManagement {
return recipeLookupResult;
}
- private RecipeLookupResult getCustomWorkflowUri(String workflowUuid) throws IOException {
+ private RecipeLookupResult getCustomWorkflowUri(String workflowUuid) {
String recipeUri = null;
Workflow workflow = catalogDbClient.findWorkflowByArtifactUUID(workflowUuid);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
index 7bd7f95286..3c4c90cc37 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
@@ -91,7 +91,7 @@ public class TasksHandler {
@QueryParam("originalRequestDate") String originalRequestDate,
@QueryParam("originalRequestorId") String originalRequestorId, @PathParam("version") String version)
throws ApiException {
- Response responseBack = null;
+
String apiVersion = version.substring(1);
// Prepare the query string to /task interface
@@ -159,60 +159,49 @@ public class TasksHandler {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.build();
+ throw new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo)
+ .build();
-
- ValidateException validateException =
- new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
- HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
- .errorInfo(errorLoggerInfo).build();
-
- throw validateException;
} catch (IOException e) {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError)
.build();
- BPMNFailureException bpmnFailureException =
- new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
- HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).build();
- throw bpmnFailureException;
+ throw new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY), HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES).cause(e).errorInfo(errorLoggerInfo).build();
}
TasksGetResponse trr = new TasksGetResponse();
List<TaskList> taskList = new ArrayList<>();
ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
int bpelStatus = respHandler.getStatus();
- if (bpelStatus == HttpStatus.SC_NO_CONTENT || bpelStatus == HttpStatus.SC_ACCEPTED) {
- String respBody = respHandler.getResponseBody();
- if (respBody != null) {
- JSONArray data = new JSONArray(respBody);
+ String respBody = respHandler.getResponseBody();
+ if ((bpelStatus == HttpStatus.SC_NO_CONTENT || bpelStatus == HttpStatus.SC_ACCEPTED) && (null != respBody)) {
- for (int i = 0; i < data.length(); i++) {
- JSONObject taskEntry = data.getJSONObject(i);
- String id = taskEntry.getString("id");
- if (taskId != null && !taskId.equals(id)) {
- continue;
- }
- // Get variables info for each task ID
- TaskList taskListEntry = null;
- taskListEntry = getTaskInfo(id);
-
- taskList.add(taskListEntry);
+ JSONArray data = new JSONArray(respBody);
+ for (int i = 0; i < data.length(); i++) {
+ JSONObject taskEntry = data.getJSONObject(i);
+ String id = taskEntry.getString("id");
+ if (taskId != null && !taskId.equals(id)) {
+ continue;
}
- trr.setTaskList(taskList);
+ // Get variables info for each task ID
+ TaskList taskListEntry = null;
+ taskListEntry = getTaskInfo(id);
+
+ taskList.add(taskListEntry);
+
}
+ trr.setTaskList(taskList);
} else {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError)
.build();
-
-
- BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(bpelStatus),
- bpelStatus, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
-
- throw bpmnFailureException;
+ throw new BPMNFailureException.Builder(String.valueOf(bpelStatus), bpelStatus,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
}
String jsonResponse = null;
@@ -223,14 +212,10 @@ public class TasksHandler {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.build();
+ throw new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo)
+ .build();
-
- ValidateException validateException =
- new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
- HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
- .errorInfo(errorLoggerInfo).build();
-
- throw validateException;
}
return builder.buildResponse(HttpStatus.SC_ACCEPTED, "", jsonResponse, apiVersion);
@@ -250,10 +235,8 @@ public class TasksHandler {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError)
.build();
- BPMNFailureException validateException =
- new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
- HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).build();
- throw validateException;
+ throw new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY), HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES).cause(e).errorInfo(errorLoggerInfo).build();
}
ResponseHandler respHandler = new ResponseHandler(getResponse, requestClient.getType());
int bpelStatus = respHandler.getStatus();
@@ -264,14 +247,10 @@ public class TasksHandler {
} else {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
ErrorCode.AvailabilityError).build();
+ throw new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
+ HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).errorInfo(errorLoggerInfo)
+ .build();
-
-
- BPMNFailureException bpmnFailureException =
- new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
- HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).build();
-
- throw bpmnFailureException;
}
} else {
@@ -279,20 +258,15 @@ public class TasksHandler {
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError)
.build();
-
-
- BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(bpelStatus),
- bpelStatus, ErrorNumbers.SVC_NO_SERVER_RESOURCES).build();
-
-
- throw bpmnFailureException;
+ throw new BPMNFailureException.Builder(String.valueOf(bpelStatus), bpelStatus,
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES).errorInfo(errorLoggerInfo).build();
}
return taskList;
}
- private TaskList buildTaskList(String taskId, String respBody) throws JSONException {
+ private TaskList buildTaskList(String taskId, String respBody) {
TaskList taskList = new TaskList();
JSONObject variables = new JSONObject(respBody);
@@ -317,7 +291,7 @@ public class TasksHandler {
return taskList;
}
- private String getOptVariableValue(JSONObject variables, String name) throws JSONException {
+ private String getOptVariableValue(JSONObject variables, String name) {
String variableEntry = variables.optString(name);
String value = "";
if (!variableEntry.isEmpty()) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
index b5b548a266..e11732ddc4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
@@ -23,7 +23,7 @@ package org.onap.so.apihandlerinfra.infra.rest.handler;
import java.io.IOException;
import java.net.URL;
import java.sql.Timestamp;
-import java.util.HashMap;
+import java.util.Map;
import java.util.Optional;
import javax.ws.rs.container.ContainerRequestContext;
import org.apache.http.HttpStatus;
@@ -63,7 +63,7 @@ public abstract class AbstractRestHandler {
private static final Logger logger = LoggerFactory.getLogger(AbstractRestHandler.class);
- public static final String conflictFailMessage = "Error: Locked instance - This %s (%s) "
+ public static final String CONFLICT_FAIL_MESSAGE = "Error: Locked instance - This %s (%s) "
+ "already has a request being worked with a status of %s (RequestId - %s). The existing request must finish or be cleaned up before proceeding.";
@@ -95,22 +95,19 @@ public abstract class AbstractRestHandler {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
- ValidateException validateException =
- new ValidateException.Builder("Request Id " + requestId + " is not a valid UUID",
- HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER)
- .errorInfo(errorLoggerInfo).build();
-
- throw validateException;
+ throw new ValidateException.Builder("Request Id " + requestId + " is not a valid UUID",
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo)
+ .build();
}
}
- public InfraActiveRequests duplicateCheck(Actions action, HashMap<String, String> instanceIdMap, long startTime,
+ public InfraActiveRequests duplicateCheck(Actions action, Map<String, String> instanceIdMap, long startTime,
MsoRequest msoRequest, String instanceName, String requestScope, InfraActiveRequests currentActiveReq)
throws ApiException {
return duplicateCheck(action, instanceIdMap, startTime, instanceName, requestScope, currentActiveReq);
}
- public InfraActiveRequests duplicateCheck(Actions action, HashMap<String, String> instanceIdMap, long startTime,
+ public InfraActiveRequests duplicateCheck(Actions action, Map<String, String> instanceIdMap, long startTime,
String instanceName, String requestScope, InfraActiveRequests currentActiveReq) throws ApiException {
InfraActiveRequests dup = null;
try {
@@ -134,19 +131,19 @@ public abstract class AbstractRestHandler {
public void updateStatus(InfraActiveRequests aq, Status status, String errorMessage)
throws RequestDbFailureException {
- if (aq != null) {
- if ((status == Status.FAILED) || (status == Status.COMPLETE)) {
- aq.setStatusMessage(errorMessage);
- aq.setProgress(100L);
- aq.setRequestStatus(status.toString());
- Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
- aq.setEndTime(endTimeStamp);
- try {
- infraActiveRequestsClient.updateInfraActiveRequests(aq);
- } catch (Exception e) {
- logger.error("Error updating status", e);
- }
+ if ((aq != null) && ((status == Status.FAILED) || (status == Status.COMPLETE))) {
+
+ aq.setStatusMessage(errorMessage);
+ aq.setProgress(100L);
+ aq.setRequestStatus(status.toString());
+ Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
+ aq.setEndTime(endTimeStamp);
+ try {
+ infraActiveRequestsClient.updateInfraActiveRequests(aq);
+ } catch (Exception e) {
+ logger.error("Error updating status", e);
}
+
}
}
@@ -178,15 +175,15 @@ public abstract class AbstractRestHandler {
selfLinkUrl = Optional.of(new URL(aUrl.getProtocol(), aUrl.getHost(), aUrl.getPort(), selfLinkPath));
} catch (Exception e) {
selfLinkUrl = Optional.empty(); // ignore
- logger.info(e.getMessage());
+ logger.error(e.getMessage());
}
return selfLinkUrl;
}
/**
- * @param vfmoduleInstanceId
+ * @param instanceId
* @param requestId
- * @param response
+ * @param requestContext
*/
public ServiceInstancesResponse createResponse(String instanceId, String requestId,
ContainerRequestContext requestContext) {
@@ -202,13 +199,13 @@ public abstract class AbstractRestHandler {
return response;
}
- public void checkDuplicateRequest(HashMap<String, String> instanceIdMap, ModelType modelType, String instanceName,
+ public void checkDuplicateRequest(Map<String, String> instanceIdMap, ModelType modelType, String instanceName,
String requestId) throws RequestConflictedException {
InfraActiveRequests conflictedRequest =
infraActiveRequestsClient.checkInstanceNameDuplicate(instanceIdMap, instanceName, modelType.toString());
if (conflictedRequest != null && !conflictedRequest.getRequestId().equals(requestId)) {
- throw new RequestConflictedException(String.format(conflictFailMessage, modelType.toString(), instanceName,
- conflictedRequest.getRequestStatus(), conflictedRequest.getRequestId()));
+ throw new RequestConflictedException(String.format(CONFLICT_FAIL_MESSAGE, modelType.toString(),
+ instanceName, conflictedRequest.getRequestStatus(), conflictedRequest.getRequestId()));
}
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
index 47f8c6b50e..5a8e2e2f6c 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
@@ -33,7 +33,7 @@ public interface InfraActiveRequestsRepositoryCustom {
public InfraActiveRequests getRequestFromInfraActive(String requestId);
- public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName,
+ public InfraActiveRequests checkInstanceNameDuplicate(Map<String, String> instanceIdMap, String instanceName,
String requestScope);
public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive(Map<String, List<String>> orchestrationMap);
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
index d8c7c8f971..13ca33c2cf 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
@@ -152,7 +152,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
* java.lang.String, java.lang.String)
*/
@Override
- public InfraActiveRequests checkInstanceNameDuplicate(final HashMap<String, String> instanceIdMap,
+ public InfraActiveRequests checkInstanceNameDuplicate(final Map<String, String> instanceIdMap,
final String instanceName, final String requestScope) {
final List<Predicate> predicates = new LinkedList<>();
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
index 4d16d9c272..9be92ad93a 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
@@ -217,7 +217,7 @@ public class RequestsDbClient {
return restTemplate.exchange(uri, HttpMethod.GET, entity, InfraActiveRequests.class).getBody();
}
- public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName,
+ public InfraActiveRequests checkInstanceNameDuplicate(Map<String, String> instanceIdMap, String instanceName,
String requestScope) {
HttpHeaders headers = getHttpHeaders();
URI uri = getUri(checkInstanceNameDuplicate);
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java
index 548bc25815..169d2353ec 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java
@@ -20,28 +20,28 @@
package org.onap.so.db.request.data.controller;
-import java.util.HashMap;
+import java.util.Map;
public class InstanceNameDuplicateCheckRequest {
- private HashMap<String, String> instanceIdMap;
+ private Map<String, String> instanceIdMap;
private String instanceName;
private String requestScope;
public InstanceNameDuplicateCheckRequest() {}
- public InstanceNameDuplicateCheckRequest(HashMap<String, String> instanceIdMap, String instanceName,
+ public InstanceNameDuplicateCheckRequest(Map<String, String> instanceIdMap, String instanceName,
String requestScope) {
this.instanceIdMap = instanceIdMap;
this.instanceName = instanceName;
this.requestScope = requestScope;
}
- public HashMap<String, String> getInstanceIdMap() {
+ public Map<String, String> getInstanceIdMap() {
return instanceIdMap;
}
- public void setInstanceIdMap(HashMap<String, String> instanceIdMap) {
+ public void setInstanceIdMap(Map<String, String> instanceIdMap) {
this.instanceIdMap = instanceIdMap;
}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java
index 32c05ebca8..a1abb05f07 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java
@@ -1,6 +1,5 @@
package org.onap.svnfm.simulator.config;
-import java.net.InetAddress;
import java.util.Arrays;
import org.onap.svnfm.simulator.constants.Constant;
import org.springframework.beans.factory.annotation.Autowired;
@@ -23,6 +22,9 @@ public class ApplicationConfig implements ApplicationRunner {
@Value("${server.dns.name:so-vnfm-simulator.onap}")
private String serverDnsName;
+ @Value("${server.request.grant.auth:oauth}")
+ private String grantAuth;
+
@Autowired
private Environment environment;
@@ -37,6 +39,10 @@ public class ApplicationConfig implements ApplicationRunner {
return baseUrl;
}
+ public String getGrantAuth() {
+ return grantAuth;
+ }
+
@Bean
public CacheManager cacheManager() {
final Cache inlineResponse201 = new ConcurrentMapCache(Constant.IN_LINE_RESPONSE_201_CACHE);
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java
index d3ff66aed0..2140b57488 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java
@@ -26,7 +26,6 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
import org.onap.svnfm.simulator.constants.Constant;
import org.onap.svnfm.simulator.repository.VnfmCacheRepository;
@@ -101,13 +100,12 @@ public class SvnfmController {
* @throws InterruptedException
*/
@PostMapping(value = "/vnf_instances/{vnfInstanceId}/instantiate")
- public ResponseEntity<Void> instantiateVnf(@PathVariable("vnfInstanceId") final String vnfId,
- @RequestBody final InstantiateVnfRequest instantiateVNFRequest) {
- LOGGER.info("Start instantiateVNFRequest {} ", instantiateVNFRequest);
+ public ResponseEntity<Void> instantiateVnf(@PathVariable("vnfInstanceId") final String vnfId) {
+ LOGGER.info("Start instantiateVNFRequest for vnf id {} ", vnfId);
final HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
- headers.add(HttpHeaders.LOCATION, svnfmService.instantiateVnf(vnfId, instantiateVNFRequest));
+ headers.add(HttpHeaders.LOCATION, svnfmService.instantiateVnf(vnfId));
return new ResponseEntity<>(headers, HttpStatus.ACCEPTED);
}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java
index eed62780c0..6e9478bdeb 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java
@@ -8,10 +8,17 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.StandardCharsets;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.KeyManagerFactory;
import javax.ws.rs.core.MediaType;
import org.apache.commons.codec.binary.Base64;
import org.modelmapper.ModelMapper;
@@ -44,12 +51,16 @@ import org.onap.svnfm.simulator.repository.VnfOperationRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
public abstract class OperationProgressor implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(OperationProgressor.class);
private static final String CERTIFICATE_TO_TRUST = "so-vnfm-adapter.crt.pem";
+ private Resource keyStoreResource = new ClassPathResource("so-vnfm-simulator.p12");
+ private String keyStorePassword = "7Em3&j4.19xYiMelhD5?xbQ.";
+
protected final VnfOperation operation;
protected final SvnfmService svnfmService;
private final VnfOperationRepository vnfOperationRepository;
@@ -73,12 +84,14 @@ public abstract class OperationProgressor implements Runnable {
String callBackUrl = subscriptionService.getSubscriptions().iterator().next().getCallbackUri();
callBackUrl = callBackUrl.substring(0, callBackUrl.indexOf("/lcn/"));
apiClient.setBasePath(callBackUrl);
+ apiClient.setKeyManagers(getKeyManagers());
apiClient.setSslCaCert(getCertificateToTrust());
notificationClient = new DefaultApi(apiClient);
final org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiClient grantApiClient =
new org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiClient();
grantApiClient.setBasePath(callBackUrl);
+ grantApiClient.setKeyManagers(getKeyManagers());
grantApiClient.setSslCaCert(getCertificateToTrust());
grantClient = new org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.api.DefaultApi(grantApiClient);
}
@@ -92,6 +105,22 @@ public abstract class OperationProgressor implements Runnable {
}
}
+ private KeyManager[] getKeyManagers() {
+ KeyStore keystore;
+ try {
+ keystore = KeyStore.getInstance("pkcs12");
+ keystore.load(keyStoreResource.getInputStream(), keyStorePassword.toCharArray());
+ KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509");
+ keyManagerFactory.init(keystore, keyStorePassword.toCharArray());
+ return keyManagerFactory.getKeyManagers();
+ } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException
+ | UnrecoverableKeyException exception) {
+ LOGGER.error("Error reading certificate, https calls using two way TLS to VNFM adapter will fail",
+ exception);
+ return new KeyManager[0];
+ }
+ }
+
@Override
public void run() {
try {
@@ -247,8 +276,10 @@ public abstract class OperationProgressor implements Runnable {
final SubscriptionsAuthenticationParamsOauth2ClientCredentials subscriptionAuthentication =
subscriptionService.getSubscriptions().iterator().next().getAuthentication()
.getParamsOauth2ClientCredentials();
- final String authHeader =
- "Bearer " + getToken(notificationClient.getApiClient(), subscriptionAuthentication);
+
+ final String authHeader = applicationConfig.getGrantAuth().equals("oauth")
+ ? "Bearer " + getToken(notificationClient.getApiClient(), subscriptionAuthentication)
+ : null;
final ApiResponse<InlineResponse201> response = grantClient.grantsPostWithHttpInfo(grantRequest,
MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, authHeader);
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java
index 21bb00dba7..95043d35ed 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java
@@ -32,7 +32,6 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201.InstantiationStateEnum;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201VimConnectionInfo;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
import org.onap.svnfm.simulator.config.ApplicationConfig;
import org.onap.svnfm.simulator.constants.Constant;
@@ -60,36 +59,31 @@ import org.springframework.stereotype.Service;
@Service
public class SvnfmService {
- @Autowired
- VnfmRepository vnfmRepository;
-
- @Autowired
- VnfOperationRepository vnfOperationRepository;
-
- @Autowired
+ private VnfmRepository vnfmRepository;
+ private VnfOperationRepository vnfOperationRepository;
private VnfmHelper vnfmHelper;
-
- @Autowired
- ApplicationConfig applicationConfig;
-
- @Autowired
- CacheManager cacheManager;
-
- @Autowired
- Vnfds vnfds;
-
- @Autowired
- SubscriptionService subscriptionService;
+ private ApplicationConfig applicationConfig;
+ private CacheManager cacheManager;
+ private Vnfds vnfds;
+ private SubscriptionService subscriptionService;
private final ExecutorService executor = Executors.newCachedThreadPool();
private static final Logger LOGGER = LoggerFactory.getLogger(SvnfmService.class);
- /**
- *
- * @param createVNFRequest
- * @return inlineResponse201
- */
+ @Autowired
+ public SvnfmService(VnfmRepository vnfmRepository, VnfOperationRepository vnfOperationRepository,
+ VnfmHelper vnfmHelper, ApplicationConfig applicationConfig, CacheManager cacheManager, Vnfds vnfds,
+ SubscriptionService subscriptionService) {
+ this.vnfmRepository = vnfmRepository;
+ this.vnfOperationRepository = vnfOperationRepository;
+ this.vnfmHelper = vnfmHelper;
+ this.applicationConfig = applicationConfig;
+ this.cacheManager = cacheManager;
+ this.vnfds = vnfds;
+ this.subscriptionService = subscriptionService;
+ }
+
public InlineResponse201 createVnf(final CreateVnfRequest createVNFRequest, final String id) {
InlineResponse201 inlineResponse201 = null;
try {
@@ -106,24 +100,16 @@ public class SvnfmService {
}
@CachePut(value = Constant.IN_LINE_RESPONSE_201_CACHE, key = "#id")
- public InlineResponse201 updateVnf(final InstantiationStateEnum instantiationState,
+ public void updateVnf(final InstantiationStateEnum instantiationState,
final InlineResponse201InstantiatedVnfInfo instantiatedVnfInfo, final String id,
final List<InlineResponse201VimConnectionInfo> vimConnectionInfo) {
final InlineResponse201 vnf = getVnf(id);
vnf.setInstantiatedVnfInfo(instantiatedVnfInfo);
vnf.setInstantiationState(instantiationState);
vnf.setVimConnectionInfo(vimConnectionInfo);
- return vnf;
}
- /**
- *
- * @param vnfId
- * @param instantiateVNFRequest
- * @param operationId
- * @throws InterruptedException
- */
- public String instantiateVnf(final String vnfId, final InstantiateVnfRequest instantiateVNFRequest) {
+ public String instantiateVnf(final String vnfId) {
final VnfOperation vnfOperation = buildVnfOperation(InlineResponse200.OperationEnum.INSTANTIATE, vnfId);
vnfOperationRepository.save(vnfOperation);
executor.submit(new InstantiateOperationProgressor(vnfOperation, this, vnfOperationRepository,
@@ -131,13 +117,7 @@ public class SvnfmService {
return vnfOperation.getId();
}
- /**
- * vnfOperationRepository
- *
- * @param vnfId
- * @param instantiateOperationId
- */
- public VnfOperation buildVnfOperation(final InlineResponse200.OperationEnum operation, final String vnfId) {
+ private VnfOperation buildVnfOperation(final InlineResponse200.OperationEnum operation, final String vnfId) {
final VnfOperation vnfOperation = new VnfOperation();
vnfOperation.setId(UUID.randomUUID().toString());
vnfOperation.setOperation(operation);
@@ -146,11 +126,6 @@ public class SvnfmService {
return vnfOperation;
}
- /**
- *
- * @param operationId
- * @throws InterruptedException
- */
public InlineResponse200 getOperationStatus(final String operationId) {
LOGGER.info("Getting operation status with id: {}", operationId);
final Thread instantiationNotification = new Thread(new VnfInstantiationNotification());
@@ -165,14 +140,13 @@ public class SvnfmService {
return null;
}
- /**
- *
- * @param vnfId
- * @return inlineResponse201
- */
public InlineResponse201 getVnf(final String vnfId) {
final Cache ca = cacheManager.getCache(Constant.IN_LINE_RESPONSE_201_CACHE);
+ if (ca == null)
+ return null;
final SimpleValueWrapper wrapper = (SimpleValueWrapper) ca.get(vnfId);
+ if (wrapper == null)
+ return null;
final InlineResponse201 inlineResponse201 = (InlineResponse201) wrapper.get();
if (inlineResponse201 != null) {
LOGGER.info("Cache Read Successful");
@@ -181,10 +155,6 @@ public class SvnfmService {
return null;
}
- /**
- * @param vnfId
- * @return
- */
public String terminateVnf(final String vnfId) {
final VnfOperation vnfOperation = buildVnfOperation(InlineResponse200.OperationEnum.TERMINATE, vnfId);
vnfOperationRepository.save(vnfOperation);