use of org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers in project so by onap.
the class CDSProcessingHandler method process.
CountDownLatch process(ExecutionServiceInput request, ManagedChannel channel) {
ActionIdentifiers header = request.getActionIdentifiers();
log.info("Processing blueprint({}:{}) for action({})", header.getBlueprintVersion(), header.getBlueprintName(), header.getActionName());
final CountDownLatch finishLatch = new CountDownLatch(1);
final BluePrintProcessingServiceStub asyncStub = BluePrintProcessingServiceGrpc.newStub(channel);
final StreamObserver<ExecutionServiceOutput> responseObserver = new StreamObserver<ExecutionServiceOutput>() {
@Override
public void onNext(ExecutionServiceOutput output) {
listener.onMessage(output);
}
@Override
public void onError(Throwable t) {
listener.onError(t);
finishLatch.countDown();
}
@Override
public void onCompleted() {
log.info("Completed blueprint({}:{}) for action({})", header.getBlueprintVersion(), header.getBlueprintName(), header.getBlueprintVersion());
finishLatch.countDown();
}
};
final StreamObserver<ExecutionServiceInput> requestObserver = asyncStub.process(responseObserver);
try {
// Send our message to CDS backend for processing
requestObserver.onNext(request);
// Mark the end of requests
requestObserver.onCompleted();
} catch (RuntimeException e) {
requestObserver.onError(e);
}
return finishLatch;
}
use of org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers 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();
}
use of org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers 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");
}
use of org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers 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");
}
use of org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers 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());
}
Aggregations