diff options
36 files changed, 1392 insertions, 174 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/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/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 e4c95f6290..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 @@ -48,6 +48,7 @@ import org.onap.sdc.tosca.parser.api.IEntityDetails; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; import org.onap.sdc.tosca.parser.elements.queries.EntityQuery; import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery; +import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery.TopologyTemplateQueryBuilder; import org.onap.sdc.tosca.parser.enums.SdcTypes; import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; import org.onap.sdc.toscaparser.api.*; @@ -629,7 +630,7 @@ public class ToscaResourceInstaller { protected void processNetworks(ToscaResourceStructure toscaResourceStruct, Service service) throws ArtifactInstallerException { - List<IEntityDetails> vlEntityList = getEntityDetails(toscaResourceStruct, SdcTypes.VL, SdcTypes.SERVICE); + List<IEntityDetails> vlEntityList = getEntityDetails(toscaResourceStruct, SdcTypes.VL, SdcTypes.SERVICE, false); if (vlEntityList != null) { for (IEntityDetails vlEntity : vlEntityList) { @@ -1116,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); } } @@ -1432,10 +1433,10 @@ public class ToscaResourceInstaller { return configCustomizationResource; } - protected ConfigurationResource createFabricConfiguration(NodeTemplate nodeTemplate, + protected ConfigurationResource createFabricConfiguration(IEntityDetails fabricEntity, ToscaResourceStructure toscaResourceStructure) { - Metadata fabricMetadata = nodeTemplate.getMetaData(); + Metadata fabricMetadata = fabricEntity.getMetadata(); ConfigurationResource configResource = new ConfigurationResource(); @@ -1444,7 +1445,7 @@ public class ToscaResourceInstaller { configResource.setModelUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); configResource.setModelVersion(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); configResource.setDescription(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); - configResource.setToscaNodeType(nodeTemplate.getType()); + configResource.setToscaNodeType(fabricEntity.getToscaType()); return configResource; } @@ -1475,7 +1476,6 @@ public class ToscaResourceInstaller { if (vnfcCustomization == null) vnfcCustomization = vnfcCustomizationRepo.findOneByModelCustomizationUUID(customizationUUID); - // vnfcCustomization = new VnfcCustomization(); return vnfcCustomization; } @@ -1979,16 +1979,16 @@ public class ToscaResourceInstaller { } // Extract CVFC lists - List<NodeTemplate> cvfcList = - toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfTemplate, SdcTypes.CVFC); + List<IEntityDetails> cvnfcEntityList = + getEntityDetails(toscaResourceStructure, SdcTypes.CVFC, SdcTypes.VF, false); - for (NodeTemplate cvfcTemplate : cvfcList) { + for (IEntityDetails cvfcEntity : cvnfcEntityList) { boolean cvnfcVfModuleNameMatch = false; for (NodeTemplate node : groupMembers) { vfModuleMemberName = node.getName(); - if (vfModuleMemberName.equalsIgnoreCase(cvfcTemplate.getName())) { + if (vfModuleMemberName.equalsIgnoreCase(cvfcEntity.getName())) { cvnfcVfModuleNameMatch = true; break; } @@ -1997,16 +1997,18 @@ public class ToscaResourceInstaller { if (vfModuleMemberName != null && cvnfcVfModuleNameMatch) { // Extract associated VFC - Should always be just one - List<NodeTemplate> vfcList = - toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(cvfcTemplate, SdcTypes.VFC); + List<IEntityDetails> vfcEntityList = getEntityDetails(toscaResourceStructure, SdcTypes.VFC, + TopologyTemplateQuery.newBuilder(SdcTypes.CVFC).customizationUUID( + cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)), + false); - for (NodeTemplate vfcTemplate : vfcList) { + for (IEntityDetails vfcEntity : vfcEntityList) { VnfcCustomization vnfcCustomization = new VnfcCustomization(); VnfcCustomization existingVnfcCustomization = null; existingVnfcCustomization = findExistingVfc(existingVnfcSet, - vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); if (existingVnfcCustomization == null) { vnfcCustomization = new VnfcCustomization(); @@ -2015,23 +2017,24 @@ public class ToscaResourceInstaller { } // Only Add Abstract VNFC's to our DB, ignore all others - if (existingVnfcCustomization == null && vfcTemplate.getMetaData() + if (existingVnfcCustomization == null && vfcEntity.getMetadata() .getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY).equalsIgnoreCase("Abstract")) { + vnfcCustomization.setModelCustomizationUUID( - vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); - vnfcCustomization.setModelInstanceName(vfcTemplate.getName()); + vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + vnfcCustomization.setModelInstanceName(vfcEntity.getName()); vnfcCustomization.setModelInvariantUUID( - vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); vnfcCustomization - .setModelName(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + .setModelName(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); vnfcCustomization - .setModelUUID(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + .setModelUUID(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); vnfcCustomization.setModelVersion( - testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); - vnfcCustomization.setDescription(testNull( - vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); - vnfcCustomization.setToscaNodeType(testNull(vfcTemplate.getType())); + testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + vnfcCustomization.setDescription( + testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + vnfcCustomization.setToscaNodeType(testNull(vfcEntity.getToscaType())); vnfcCustomizations.add(vnfcCustomization); existingVnfcSet.add(vnfcCustomization); @@ -2043,20 +2046,20 @@ public class ToscaResourceInstaller { if (vnfcCustomization.getModelCustomizationUUID() != null) { CvnfcCustomization cvnfcCustomization = new CvnfcCustomization(); cvnfcCustomization.setModelCustomizationUUID( - cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); - cvnfcCustomization.setModelInstanceName(cvfcTemplate.getName()); + cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + cvnfcCustomization.setModelInstanceName(cvfcEntity.getName()); cvnfcCustomization.setModelInvariantUUID( - cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); cvnfcCustomization - .setModelName(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + .setModelName(cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); cvnfcCustomization - .setModelUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + .setModelUUID(cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); cvnfcCustomization.setModelVersion( - testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + testNull(cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); cvnfcCustomization.setDescription(testNull( - cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); - cvnfcCustomization.setToscaNodeType(testNull(cvfcTemplate.getType())); + cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + cvnfcCustomization.setToscaNodeType(testNull(cvfcEntity.getToscaType())); if (existingVnfcCustomization != null) { cvnfcCustomization.setVnfcCustomization(existingVnfcCustomization); @@ -2064,38 +2067,35 @@ public class ToscaResourceInstaller { cvnfcCustomization.setVnfcCustomization(vnfcCustomization); } - cvnfcCustomization.setNfcFunction(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_function")); - cvnfcCustomization.setNfcNamingCode(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_naming_code")); - cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization); - + cvnfcCustomization.setNfcFunction(getLeafPropertyValue(cvfcEntity, "nfc_function")); + cvnfcCustomization.setNfcNamingCode(getLeafPropertyValue(cvfcEntity, "nfc_naming_code")); + cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization); // ***************************************************************************************************************************************** // * Extract Fabric Configuration // ***************************************************************************************************************************************** - List<NodeTemplate> fabricConfigList = toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplateBySdcType(vfTemplate, SdcTypes.CONFIGURATION); + List<IEntityDetails> fabricEntityList = + getEntityDetails(toscaResourceStructure, SdcTypes.CONFIGURATION, SdcTypes.VF, false); - for (NodeTemplate fabricTemplate : fabricConfigList) { + for (IEntityDetails fabricEntity : fabricEntityList) { ConfigurationResource fabricConfig = null; ConfigurationResource existingConfig = findExistingConfiguration(existingCvnfcConfigurationCustom, - fabricTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + fabricEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); if (existingConfig == null) { - fabricConfig = createFabricConfiguration(fabricTemplate, toscaResourceStructure); + fabricConfig = createFabricConfiguration(fabricEntity, toscaResourceStructure); } else { fabricConfig = existingConfig; } CvnfcConfigurationCustomization cvnfcConfigurationCustomization = - createCvnfcConfigurationCustomization(fabricTemplate, toscaResourceStructure, + createCvnfcConfigurationCustomization(fabricEntity, toscaResourceStructure, vnfResource, vfModuleCustomization, cvnfcCustomization, fabricConfig, vfTemplate, vfModuleMemberName); @@ -2119,12 +2119,12 @@ public class ToscaResourceInstaller { return vfModuleCustomization; } - protected CvnfcConfigurationCustomization createCvnfcConfigurationCustomization(NodeTemplate fabricTemplate, + protected CvnfcConfigurationCustomization createCvnfcConfigurationCustomization(IEntityDetails fabricEntity, ToscaResourceStructure toscaResourceStruct, VnfResourceCustomization vnfResource, VfModuleCustomization vfModuleCustomization, CvnfcCustomization cvnfcCustomization, ConfigurationResource configResource, NodeTemplate vfTemplate, String vfModuleMemberName) { - Metadata fabricMetadata = fabricTemplate.getMetaData(); + Metadata fabricMetadata = fabricEntity.getMetadata(); CvnfcConfigurationCustomization cvnfcConfigurationCustomization = new CvnfcConfigurationCustomization(); @@ -2134,34 +2134,31 @@ public class ToscaResourceInstaller { cvnfcConfigurationCustomization .setModelCustomizationUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); - cvnfcConfigurationCustomization.setModelInstanceName(fabricTemplate.getName()); + cvnfcConfigurationCustomization.setModelInstanceName(fabricEntity.getName()); - List<Policy> policyList = toscaResourceStruct.getSdcCsarHelper() - .getPoliciesOfOriginOfNodeTemplateByToscaPolicyType(vfTemplate, "org.openecomp.policies.External"); + List<IEntityDetails> policyList = + getEntityDetails(toscaResourceStruct, "org.openecomp.policies.External", SdcTypes.VF, true); if (policyList != null) { - for (Policy policy : policyList) { + for (IEntityDetails policyEntity : policyList) { - for (String policyCvfcTarget : policy.getTargets()) { + for (String policyCvfcTarget : policyEntity.getTargets()) { if (policyCvfcTarget.equalsIgnoreCase(vfModuleMemberName)) { - Map<String, Object> propMap = policy.getPolicyProperties(); + String policyType = getLeafPropertyValue(policyEntity, "type"); - if (propMap.get("type").toString().equalsIgnoreCase("Fabric Policy")) { - cvnfcConfigurationCustomization.setPolicyName(propMap.get("name").toString()); + if (policyType != null && policyType.equalsIgnoreCase("Fabric Policy")) { + cvnfcConfigurationCustomization.setPolicyName(getLeafPropertyValue(policyEntity, "name")); } } } } } - cvnfcConfigurationCustomization.setConfigurationFunction( - toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "function")); - cvnfcConfigurationCustomization.setConfigurationRole( - toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "role")); - cvnfcConfigurationCustomization.setConfigurationType( - toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "type")); + cvnfcConfigurationCustomization.setConfigurationFunction(getLeafPropertyValue(fabricEntity, "function")); + cvnfcConfigurationCustomization.setConfigurationRole(getLeafPropertyValue(fabricEntity, "role")); + cvnfcConfigurationCustomization.setConfigurationType(getLeafPropertyValue(fabricEntity, "type")); return cvnfcConfigurationCustomization; } @@ -2680,24 +2677,36 @@ public class ToscaResourceInstaller { } protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct, SdcTypes entityType, - SdcTypes topologyTemplate) { + SdcTypes topologyTemplate, boolean nestedSearch) { EntityQuery entityQuery = EntityQuery.newBuilder(entityType).build(); TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(topologyTemplate).build(); List<IEntityDetails> entityDetails = - toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, false); + toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, nestedSearch); return entityDetails; } protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct, String entityType, - SdcTypes topologyTemplate) { + SdcTypes topologyTemplate, boolean nestedSearch) { EntityQuery entityQuery = EntityQuery.newBuilder(entityType).build(); TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(topologyTemplate).build(); List<IEntityDetails> entityDetails = - toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, true); + toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, nestedSearch); + + return entityDetails; + + } + + protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct, SdcTypes entityType, + TopologyTemplateQueryBuilder topologyTemplateBuilder, boolean nestedSearch) { + + EntityQuery entityQuery = EntityQuery.newBuilder(entityType).build(); + TopologyTemplateQuery topologyTemplateQuery = topologyTemplateBuilder.build(); + List<IEntityDetails> entityDetails = + toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, nestedSearch); return entityDetails; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java index dc2b3be073..5c0406cc9e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java @@ -24,6 +24,7 @@ package org.onap.so.bpmn.common.util; import java.io.IOException; +import java.io.InputStream; import java.security.GeneralSecurityException; import java.util.Properties; import org.onap.so.utils.CryptoUtils; @@ -40,7 +41,10 @@ public class CryptoHandler implements ICryptoHandler { public String getMsoAaiPassword() { Properties keyProp = new Properties(); try { - keyProp.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("urn.properties")); + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + InputStream rs = cl.getResourceAsStream("urn.properties"); + keyProp.load(rs); + rs.close(); return CryptoUtils.decrypt((String) keyProp.get(PROPERTY_KEY), MSO_KEY); } catch (GeneralSecurityException | IOException e) { logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); 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/MSOCommonBPMN/src/test/resources/__files/aai/bulkprocess/test-request.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/bulkprocess/test-request.json deleted file mode 100644 index f5ffe38285..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/bulkprocess/test-request.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "transactions" : [ { - "put" : [ { - "uri" : "/network/generic-vnfs/generic-vnf/test1/relationship-list/relationship", - "body" : { - "related-link" : "/cloud-infrastructure/pservers/pserver/test2" - } - }, { - "uri" : "/network/generic-vnfs/generic-vnf/test3/relationship-list/relationship", - "body" : { - "related-link" : "/cloud-infrastructure/pservers/pserver/test4" - } - } ] - }, { - "put" : [ { - "uri" : "/network/generic-vnfs/generic-vnf/test5/relationship-list/relationship", - "body" : { - "related-link" : "/cloud-infrastructure/pservers/pserver/test6" - } - } ] - } ] -}
\ No newline at end of file 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/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..1abe1ccc73 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 @@ -434,7 +434,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/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java index 1370bb3fa3..3f9715bdef 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java +++ b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java @@ -116,17 +116,23 @@ public class AAISingleTransactionClient } @Override - public void put(String uri, Object body) { + protected void put(String uri, Object body) { request.getOperations().add(new OperationBodyRequest().withAction("put").withUri(uri).withBody(body)); } @Override - public void delete(String uri, Object body) { - request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(body)); + protected void delete(String uri) { + request.getOperations() + .add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(new Object())); } @Override - public void patch(String uri, Object body) { + protected void delete(String uri, Object obj) { + request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(obj)); + } + + @Override + protected void patch(String uri, Object body) { request.getOperations().add(new OperationBodyRequest().withAction("patch").withUri(uri).withBody(body)); } diff --git a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java index 11e458a3da..e621566e5a 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java +++ b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java @@ -169,18 +169,22 @@ public class AAITransactionalClient } @Override - public void put(String uri, Object body) { + protected void put(String uri, Object body) { currentTransaction.getPut().add(new OperationBody().withUri(uri).withBody(body)); } @Override - public void delete(String uri, Object body) { - currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(body)); + protected void delete(String uri) { + currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(null)); + } + @Override + protected void delete(String uri, Object obj) { + currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(obj)); } @Override - public void patch(String uri, Object body) { + protected void patch(String uri, Object body) { currentTransaction.getPatch().add(new OperationBody().withUri(uri).withBody(body)); } diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java index 72b01c268e..a4f9496d17 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java @@ -40,6 +40,7 @@ public class GraphInventoryCommonObjectMapperProvider extends CommonObjectMapper mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); mapper.enable(MapperFeature.USE_ANNOTATIONS); mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); AnnotationIntrospector aiJaxb = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()); diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java index 5fc8726427..45ac1f741d 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java @@ -33,8 +33,7 @@ import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri, EdgeLabel extends GraphInventoryEdgeLabel> - implements TransactionBuilder { +public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri, EdgeLabel extends GraphInventoryEdgeLabel> { protected static Logger logger = LoggerFactory.getLogger(GraphInventoryTransactionClient.class); @@ -181,7 +180,7 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv Map<String, Object> result = this.get(new GenericType<Map<String, Object>>() {}, (Uri) uri.clone()) .orElseThrow(() -> new NotFoundException(uri.build() + " does not exist in " + this.getGraphDBName())); String resourceVersion = (String) result.get("resource-version"); - this.delete(uri.resourceVersion(resourceVersion).build().toString(), ""); + this.delete(uri.resourceVersion(resourceVersion).build().toString()); incrementActionAmount(); return (Self) this; } @@ -192,6 +191,14 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv protected abstract String getGraphDBName(); + protected abstract void put(String uri, Object body); + + protected abstract void delete(String uri); + + protected abstract void delete(String uri, Object obj); + + protected abstract void patch(String uri, Object body); + /** * @param obj - can be any object which will marshal into a valid A&AI payload * @param uri diff --git a/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java index 1c49c11382..b07d893adb 100644 --- a/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java +++ b/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java @@ -24,6 +24,7 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.Matchers.greaterThan; import static org.junit.Assert.assertThat; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; @@ -32,12 +33,14 @@ import static org.mockito.Mockito.verify; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; import java.util.Optional; +import javax.ws.rs.core.GenericType; import org.json.JSONException; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.InjectMocks; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import org.onap.aai.domain.yang.Pserver; @@ -46,7 +49,6 @@ import org.onap.so.client.aai.entities.singletransaction.SingleTransactionReques import org.onap.so.client.aai.entities.singletransaction.SingleTransactionResponse; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl; import org.onap.so.client.graphinventory.GraphInventoryPatchConverter; import org.skyscreamer.jsonassert.JSONAssert; import com.fasterxml.jackson.core.JsonParseException; @@ -60,11 +62,13 @@ public class AAISingleTransactionClientTest { private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/singletransaction/"; AAIResourceUri uriA = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "pserver-hostname"); AAIResourceUri uriB = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, "my-complex"); + AAIResourceUri uriC = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, "my-complex2"); ObjectMapper mapper; public AAIClient client = new AAIClient(); + @Spy public AAIResourcesClient aaiClient = new AAIResourcesClient(); @Before @@ -82,9 +86,11 @@ public class AAISingleTransactionClientTest { pserver2.setFqdn("patched-fqdn"); Complex complex = new Complex(); complex.setCity("my-city"); - AAISingleTransactionClient singleTransaction = - aaiClient.beginSingleTransaction().create(uriA, pserver).update(uriA, pserver2).create(uriB, complex); - + Map<String, Object> map = new HashMap<>(); + map.put("resource-version", "1234"); + doReturn(Optional.of(map)).when(aaiClient).get(any(GenericType.class), eq(uriC)); + AAISingleTransactionClient singleTransaction = aaiClient.beginSingleTransaction().create(uriA, pserver) + .update(uriA, pserver2).create(uriB, complex).delete(uriC); SingleTransactionRequest actual = singleTransaction.getRequest(); diff --git a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java index adbdbb419f..305cdf59cc 100644 --- a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java +++ b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java @@ -22,6 +22,7 @@ package org.onap.so.client.aai; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; @@ -31,19 +32,19 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; +import javax.ws.rs.core.GenericType; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.InjectMocks; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import org.onap.aai.domain.yang.Relationship; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl; import org.onap.so.client.graphinventory.GraphInventoryPatchConverter; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.type.TypeReference; @@ -61,11 +62,13 @@ public class AAITransactionalClientTest { AAIResourceUri uriD = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test4"); AAIResourceUri uriE = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test5"); AAIResourceUri uriF = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test6"); + AAIResourceUri uriG = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test7"); ObjectMapper mapper; public AAIClient client = new AAIClient(); + @Spy public AAIResourcesClient aaiClient = new AAIResourcesClient(); @Before @@ -95,9 +98,12 @@ public class AAITransactionalClientTest { List<AAIResourceUri> uris = new ArrayList<AAIResourceUri>(); uris.add(uriB); + Map<String, Object> map = new HashMap<>(); + map.put("resource-version", "1234"); + doReturn(Optional.of(map)).when(aaiClient).get(any(GenericType.class), eq(uriG)); AAIResourceUri uriAClone = uriA.clone(); AAITransactionalClient transactions = aaiClient.beginTransaction().connect(uriA, uris).connect(uriC, uriD) - .beginNewTransaction().connect(uriE, uriF); + .beginNewTransaction().connect(uriE, uriF).beginNewTransaction().delete(uriG); String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions()); Map<String, Object> actual = diff --git a/common/src/test/resources/__files/aai/bulkprocess/test-request.json b/common/src/test/resources/__files/aai/bulkprocess/test-request.json index f5ffe38285..5a2953c632 100644 --- a/common/src/test/resources/__files/aai/bulkprocess/test-request.json +++ b/common/src/test/resources/__files/aai/bulkprocess/test-request.json @@ -18,5 +18,9 @@ "related-link" : "/cloud-infrastructure/pservers/pserver/test6" } } ] - } ] + }, { + "delete" : [ { + "uri" : "/network/generic-vnfs/generic-vnf/test7?resource-version=1234" + } ] + }] }
\ No newline at end of file diff --git a/common/src/test/resources/__files/aai/singletransaction/sample-request.json b/common/src/test/resources/__files/aai/singletransaction/sample-request.json index f0761a07b6..69024dca83 100644 --- a/common/src/test/resources/__files/aai/singletransaction/sample-request.json +++ b/common/src/test/resources/__files/aai/singletransaction/sample-request.json @@ -21,6 +21,12 @@ "body": { "city": "my-city" } + }, + { + "action": "delete", + "uri": "/cloud-infrastructure/complexes/complex/my-complex2?resource-version=1234", + "body" : { + } } ] }
\ No newline at end of file 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 |