use of org.onap.so.client.cds.beans.AbstractCDSPropertiesBean in project so by onap.
the class GenericPnfCDSProcessingDE method prepare.
@Override
public void prepare(ControllerContext<DelegateExecution> context) {
DelegateExecution delegateExecution = context.getExecution();
try {
AbstractCDSPropertiesBean abstractCDSPropertiesBean = generatePayloadForCds.buildCdsPropertiesBean(delegateExecution);
delegateExecution.setVariable(EXECUTION_OBJECT, abstractCDSPropertiesBean);
} catch (Exception ex) {
logger.error("An exception occurred when creating payload for CDS request", ex);
exceptionBuilder.buildAndThrowWorkflowException(delegateExecution, 7000, ex);
}
}
use of org.onap.so.client.cds.beans.AbstractCDSPropertiesBean in project so by onap.
the class GenericPnfCDSControllerRunnableBB method prepare.
@Override
public void prepare(ControllerContext<BuildingBlockExecution> controllerContext) {
BuildingBlockExecution buildingBlockExecution = controllerContext.getExecution();
final AbstractCDSPropertiesBean abstractCDSPropertiesBean = prepareAndSetCdsPropertyBean(buildingBlockExecution);
buildingBlockExecution.setVariable(EXECUTION_OBJECT, abstractCDSPropertiesBean);
}
use of org.onap.so.client.cds.beans.AbstractCDSPropertiesBean in project so by onap.
the class GeneratePayloadForCdsTest method testBuildCdsPropertiesBeanDownloadPnf.
@Test
public void testBuildCdsPropertiesBeanDownloadPnf() throws Exception {
// given
final String downloadPayload = "{\"downloadNeSw-request\":{\"resolution-key\":\"PNFDemo\",\"downloadNeSw-properties\":{\"service-instance-id\":\"test_service_id\",\"service-model-uuid\":\"6bc0b04d-1873-4721-b53d-6615225b2a28\",\"pnf-id\":\"5df8b6de-2083-11e7-93ae-92361f002671\",\"pnf-name\":\"PNFDemo\",\"pnf-customization-uuid\":\"9acb3a83-8a52-412c-9a45-901764938144\",\"target-software-version\":\"demo-sw-ver2.0.0\"}}}";
DelegateExecution execution = prepareDelegateExecutionObj(PayloadConstants.PNF_SCOPE, DOWNLOAD_ACTION);
doReturn(Optional.of(downloadPayload)).when(pnfCDSRequestProvider).buildRequestPayload(DOWNLOAD_ACTION);
doReturn(TEST_PNF_RESOURCE_BLUEPRINT_NAME).when(pnfCDSRequestProvider).getBlueprintName();
doReturn(TEST_PNF_RESOURCE_BLUEPRINT_VERSION).when(pnfCDSRequestProvider).getBlueprintVersion();
// when
AbstractCDSPropertiesBean propertyBean = configurePayloadForCds.buildCdsPropertiesBean(execution);
// verify
assertNotNull(propertyBean);
String payload = propertyBean.getRequestObject();
assertThat(downloadPayload.equals(payload));
assertThat(propertyBean.getRequestId().equals(MSO_REQUEST_ID));
assertThat(propertyBean.getOriginatorId().equals("SO"));
assertNotNull(propertyBean.getSubRequestId());
assertThat(propertyBean.getActionName().equals(DOWNLOAD_ACTION));
assertThat(propertyBean.getMode().equalsIgnoreCase("async"));
assertThat(propertyBean.getBlueprintName().equalsIgnoreCase(TEST_PNF_RESOURCE_BLUEPRINT_NAME));
assertThat(propertyBean.getBlueprintVersion().equalsIgnoreCase(TEST_PNF_RESOURCE_BLUEPRINT_VERSION));
}
use of org.onap.so.client.cds.beans.AbstractCDSPropertiesBean in project so by onap.
the class GeneratePayloadForCdsTest method testBuildCdsPropertiesBeanAssignVnf.
@Test
public void testBuildCdsPropertiesBeanAssignVnf() throws Exception {
// given
final String assignPayload = "{\"configAssign-request\":{\"resolution-key\":\"vnf-name-1\",\"configAssign-properties\":{\"service-instance-id\":\"serviceInst_configTest\",\"service-model-uuid\":\"b45b5780-e5dd-11e9-81b4-2a2ae2dbcce4\",\"vnf-id\":\"vnfId_configVnfTest1\",\"vnf-name\":\"vnf-name-1\",\"vnf-customization-uuid\":\"23ce9ac4-e5dd-11e9-81b4-2a2ae2dbcce4\",\"acl-cloud-region\":\"acl-cloud-region\",\"public_net_id\":\"public-net-id\"}}}";
setScopeAndAction(VNF_SCOPE, ASSIGN_ACTION);
doReturn(Optional.of(assignPayload)).when(vnfCDSRequestProvider).buildRequestPayload(ASSIGN_ACTION);
// when
AbstractCDSPropertiesBean propertyBean = configurePayloadForCds.buildCdsPropertiesBean(buildingBlockExecution);
// verify
assertNotNull(propertyBean);
String payload = propertyBean.getRequestObject();
assertThat(assignPayload.equals(payload));
assertThat(propertyBean.getRequestId().equals(MSO_REQUEST_ID));
assertThat(propertyBean.getOriginatorId().equals("SO"));
assertNotNull(propertyBean.getSubRequestId());
assertThat(propertyBean.getActionName().equals(ASSIGN_ACTION));
assertThat(propertyBean.getMode().equalsIgnoreCase("sync"));
}
use of org.onap.so.client.cds.beans.AbstractCDSPropertiesBean in project so by onap.
the class GenericCDSProcessingBBTest method prepareCDSBean.
private AbstractCDSPropertiesBean prepareCDSBean() {
AbstractCDSPropertiesBean cdsBean = new AbstractCDSPropertiesBean();
cdsBean.setBlueprintName(BLUEPRINT_NAME);
cdsBean.setBlueprintVersion(BLUEPRINT_VERSION);
cdsBean.setRequestId(TEST_MSO_REQUEST_ID);
cdsBean.setRequestObject("requestObject");
return cdsBean;
}
Aggregations