Search in sources :

Example 1 with CommonHeader

use of org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader in project so by onap.

the class AbstractCDSProcessingBBUtils method prepareExecutionServiceInput.

private ExecutionServiceInput prepareExecutionServiceInput(AbstractCDSPropertiesBean executionObject) {
    String payload = executionObject.getRequestObject();
    CommonHeader commonHeader = CommonHeader.newBuilder().setOriginatorId(executionObject.getOriginatorId()).setRequestId(executionObject.getRequestId()).setSubRequestId(executionObject.getSubRequestId()).build();
    ActionIdentifiers actionIdentifiers = ActionIdentifiers.newBuilder().setBlueprintName(executionObject.getBlueprintName()).setBlueprintVersion(executionObject.getBlueprintVersion()).setActionName(executionObject.getActionName()).setMode(executionObject.getMode()).build();
    Builder struct = Struct.newBuilder();
    try {
        JsonFormat.parser().merge(payload, struct);
    } catch (InvalidProtocolBufferException e) {
        logger.error("Failed to parse received message. blueprint({}:{}) for action({}). {}", executionObject.getBlueprintVersion(), executionObject.getBlueprintName(), executionObject.getActionName(), e);
    }
    return ExecutionServiceInput.newBuilder().setCommonHeader(commonHeader).setActionIdentifiers(actionIdentifiers).setPayload(struct.build()).build();
}
Also used : CommonHeader(org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader) ExceptionBuilder(org.onap.so.client.exception.ExceptionBuilder) Builder(com.google.protobuf.Struct.Builder) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) ActionIdentifiers(org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers)

Example 2 with CommonHeader

use of org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader in project so by onap.

the class CreateVcpeResCustServiceSimplifiedTest method checkConfigDeploy.

private void checkConfigDeploy(ExecutionServiceInput executionServiceInput, String msoRequestId) {
    logger.info("Checking the configDeploy request");
    ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
    /**
     * the fields of actionIdentifiers should match the one in the
     * response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
     */
    assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_configuration_restconf");
    assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0");
    assertThat(actionIdentifiers.getActionName()).isEqualTo("config-deploy");
    assertThat(actionIdentifiers.getMode()).isEqualTo("async");
    CommonHeader commonHeader = executionServiceInput.getCommonHeader();
    assertThat(commonHeader.getOriginatorId()).isEqualTo("SO");
    assertThat(commonHeader.getRequestId()).isEqualTo(msoRequestId);
    Struct payload = executionServiceInput.getPayload();
    Struct requeststruct = payload.getFieldsOrThrow("config-deploy-request").getStructValue();
    assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo");
    Struct propertiesStruct = requeststruct.getFieldsOrThrow("config-deploy-properties").getStructValue();
    assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo");
    assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()).isEqualTo("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
    assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()).isEqualTo("68dc9a92-214c-11e7-93ae-92361f002680");
    /**
     * IP addresses match the OAM ip addresses from AAI.
     */
    assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv4-address").getStringValue()).isEqualTo("1.1.1.1");
    assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv6-address").getStringValue()).isEqualTo("::/128");
}
Also used : CommonHeader(org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader) ActionIdentifiers(org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers) Struct(com.google.protobuf.Struct)

Example 3 with CommonHeader

use of org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader in project so by onap.

the class GenericPnfSWUPDownloadTest method checkWithActionName.

private void checkWithActionName(ExecutionServiceInput executionServiceInput, String action, String msoRequestId) {
    logger.info("Checking the " + action + " request");
    ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
    /**
     * the fields of actionIdentifiers should match the one in the
     * response/GenericPnfSoftwareUpgradeTest_catalogdb.json.
     */
    Assertions.assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_pnf_software_upgrade_restconf");
    Assertions.assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0");
    Assertions.assertThat(actionIdentifiers.getActionName()).isEqualTo(action);
    Assertions.assertThat(actionIdentifiers.getMode()).isEqualTo("async");
    CommonHeader commonHeader = executionServiceInput.getCommonHeader();
    Assertions.assertThat(commonHeader.getOriginatorId()).isEqualTo("SO");
    Assertions.assertThat(commonHeader.getRequestId()).isEqualTo(msoRequestId);
    Struct payload = executionServiceInput.getPayload();
    Struct requeststruct = payload.getFieldsOrThrow(action + "-request").getStructValue();
    Assertions.assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo");
    Struct propertiesStruct = requeststruct.getFieldsOrThrow(action + "-properties").getStructValue();
    Assertions.assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo");
    Assertions.assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()).isEqualTo("32daaac6-5017-4e1e-96c8-6a27dfbe1421");
    Assertions.assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()).isEqualTo("38dc9a92-214c-11e7-93ae-92361f002680");
    Assertions.assertThat(propertiesStruct.getFieldsOrThrow("target-software-version").getStringValue()).isEqualTo("demo-sw-ver2.0.0");
}
Also used : CommonHeader(org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader) ActionIdentifiers(org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers) Struct(com.google.protobuf.Struct)

Example 4 with CommonHeader

use of org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader in project so by onap.

the class PnfHealthCheckTest method checkWithActionName.

private void checkWithActionName(ExecutionServiceInput executionServiceInput, String action) {
    logger.info("Checking the " + action + " request");
    ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
    /**
     * the fields of actionIdentifiers should match the one in the response/PnfHealthCheck_catalogdb.json.
     */
    assertEquals("test_pnf_health_check_restconf", actionIdentifiers.getBlueprintName());
    assertEquals("1.0.0", actionIdentifiers.getBlueprintVersion());
    assertEquals(action, actionIdentifiers.getActionName());
    assertEquals("async", actionIdentifiers.getMode());
    CommonHeader commonHeader = executionServiceInput.getCommonHeader();
    assertEquals("SO", commonHeader.getOriginatorId());
    Struct payload = executionServiceInput.getPayload();
    Struct requeststruct = payload.getFieldsOrThrow(action + "-request").getStructValue();
    assertEquals("PNFDemo", requeststruct.getFieldsOrThrow("resolution-key").getStringValue());
    Struct propertiesStruct = requeststruct.getFieldsOrThrow(action + "-properties").getStructValue();
    assertEquals("PNFDemo", propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue());
    assertEquals("32daaac6-5017-4e1e-96c8-6a27dfbe1421", propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue());
    assertEquals("38dc9a92-214c-11e7-93ae-92361f002680", propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue());
}
Also used : CommonHeader(org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader) ActionIdentifiers(org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers) Struct(com.google.protobuf.Struct)

Example 5 with CommonHeader

use of org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader in project so by onap.

the class ControllerExecutionBBTestIT method checkConfigAssign.

private void checkConfigAssign(ExecutionServiceInput executionServiceInput) {
    logger.info("Checking the configAssign request");
    ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
    /**
     * the fields of actionIdentifiers should match the one in the
     * response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
     */
    assertThat(actionIdentifiers.getBlueprintName()).isEqualTo(TEST_PNF_RESOURCE_BLUEPRINT_NAME);
    assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo(TEST_PNF_RESOURCE_BLUEPRINT_VERSION);
    assertThat(actionIdentifiers.getActionName()).isEqualTo(TEST_CDS_ACTION);
    assertThat(actionIdentifiers.getMode()).isEqualTo("sync");
    CommonHeader commonHeader = executionServiceInput.getCommonHeader();
    assertThat(commonHeader.getOriginatorId()).isEqualTo("SO");
    assertThat(commonHeader.getRequestId()).isEqualTo(TEST_MSO_REQUEST_ID);
    Struct payload = executionServiceInput.getPayload();
    Struct requeststruct = payload.getFieldsOrThrow("config-assign-request").getStructValue();
    assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo(TEST_PNF_CORRELATION_ID);
    Struct propertiesStruct = requeststruct.getFieldsOrThrow("config-assign-properties").getStructValue();
    assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo(TEST_PNF_CORRELATION_ID);
    assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()).isEqualTo(TEST_MODEL_UUID);
    assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()).isEqualTo(TEST_PNF_RESOURCE_CUSTOMIZATION_UUID);
}
Also used : CommonHeader(org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader) ActionIdentifiers(org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers) Struct(com.google.protobuf.Struct)

Aggregations

ActionIdentifiers (org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers)9 CommonHeader (org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader)9 Struct (com.google.protobuf.Struct)8 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 Builder (com.google.protobuf.Struct.Builder)1 ExceptionBuilder (org.onap.so.client.exception.ExceptionBuilder)1