Search in sources :

Example 6 with CommonHeader

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

the class ControllerExecutionDETestIT method verifyRequestContentForAction.

private void verifyRequestContentForAction(ExecutionServiceInput executionServiceInput) {
    logger.info("Checking the " + this.action + " request");
    ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
    assertThat(actionIdentifiers.getBlueprintName()).isEqualTo(TEST_PNF_RESOURCE_BLUEPRINT_NAME);
    assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo(TEST_PNF_RESOURCE_BLUEPRINT_VERSION);
    assertThat(actionIdentifiers.getActionName()).isEqualTo(this.action);
    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(this.action + "-request").getStructValue();
    assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo(TEST_PNF_CORRELATION_ID);
    Struct propertiesStruct = requeststruct.getFieldsOrThrow(this.action + "-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);
    if (action.equalsIgnoreCase(DEPLOY_ACTION)) {
        assertThat(actionIdentifiers.getMode()).isEqualTo("async");
        assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv4-address").getStringValue()).isEqualTo("1.1.1.1");
        assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv6-address").getStringValue()).isEqualTo("::/128");
    } else if (!action.equalsIgnoreCase(ASSIGN_ACTION)) {
        assertThat(actionIdentifiers.getMode()).isEqualTo("sync");
        assertThat(propertiesStruct.getFieldsOrThrow("target-software-version").getStringValue()).isEqualTo(TEST_SOFTWARE_VERSION);
    } else {
        assertThat(actionIdentifiers.getMode()).isEqualTo("sync");
    }
}
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 7 with CommonHeader

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

the class CreateVcpeResCustServiceSimplifiedTest method checkConfigAssign.

private void checkConfigAssign(ExecutionServiceInput executionServiceInput, String msoRequestId) {
    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_configuration_restconf");
    assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0");
    assertThat(actionIdentifiers.getActionName()).isEqualTo("config-assign");
    assertThat(actionIdentifiers.getMode()).isEqualTo("sync");
    CommonHeader commonHeader = executionServiceInput.getCommonHeader();
    assertThat(commonHeader.getOriginatorId()).isEqualTo("SO");
    assertThat(commonHeader.getRequestId()).isEqualTo(msoRequestId);
    Struct payload = executionServiceInput.getPayload();
    Struct requeststruct = payload.getFieldsOrThrow("config-assign-request").getStructValue();
    assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo");
    Struct propertiesStruct = requeststruct.getFieldsOrThrow("config-assign-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");
}
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 8 with CommonHeader

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

the class GenericPnfSoftwareUpgradeTest 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/GenericPnfSoftwareUpgrade_catalogdb.json.
     */
    assertEquals("test_pnf_software_upgrade_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());
    assertEquals("demo-sw-ver2.0.0", propertiesStruct.getFieldsOrThrow("target-software-version").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 9 with CommonHeader

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

the class ServiceLevelUpgradeTest method checkWithActionName.

private void checkWithActionName(final ExecutionServiceInput executionServiceInput, final String action, final String pnfName) {
    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_software_upgrade_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(pnfName, requeststruct.getFieldsOrThrow("resolution-key").getStringValue());
    Struct propertiesStruct = requeststruct.getFieldsOrThrow(action + "-properties").getStructValue();
    assertEquals(pnfName, propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue());
    assertEquals("d88da85c-d9e8-4f73-b837-3a72a431622b", 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)

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