Search in sources :

Example 1 with ConfigDeployRequestPnf

use of org.onap.so.client.cds.beans.ConfigDeployRequestPnf in project so by onap.

the class PrepareConfigDeployDelegate method getRequestObject.

@Override
protected String getRequestObject(DelegateExecution delegateExecution) {
    ConfigDeployPropertiesForPnf configDeployProperties = new ConfigDeployPropertiesForPnf();
    configDeployProperties.setServiceInstanceId((String) delegateExecution.getVariable(SERVICE_INSTANCE_ID));
    /**
     * PNF Name matches the name in AAI, i.e., correlationID as in customized workflow.
     */
    configDeployProperties.setPnfName((String) delegateExecution.getVariable(PNF_CORRELATION_ID));
    /**
     * PNF id match AAI entry, i.e, PNF UUID.
     */
    configDeployProperties.setPnfId((String) delegateExecution.getVariable(PNF_UUID));
    configDeployProperties.setPnfCustomizationUuid((String) delegateExecution.getVariable(PRC_CUSTOMIZATION_UUID));
    configDeployProperties.setServiceModelUuid((String) delegateExecution.getVariable(MODEL_UUID));
    setIpAddress(configDeployProperties, delegateExecution);
    ConfigDeployRequestPnf configDeployRequest = new ConfigDeployRequestPnf();
    configDeployRequest.setConfigDeployPropertiesForPnf(configDeployProperties);
    /**
     * Resolution key is the same as PNF name.
     */
    configDeployRequest.setResolutionKey((String) delegateExecution.getVariable(PNF_CORRELATION_ID));
    return configDeployRequest.toString();
}
Also used : ConfigDeployRequestPnf(org.onap.so.client.cds.beans.ConfigDeployRequestPnf) ConfigDeployPropertiesForPnf(org.onap.so.client.cds.beans.ConfigDeployPropertiesForPnf)

Example 2 with ConfigDeployRequestPnf

use of org.onap.so.client.cds.beans.ConfigDeployRequestPnf in project so by onap.

the class PrepareConfigDeployDelegateTest method checkRequestJson.

private void checkRequestJson(String requestObject) {
    try {
        ObjectMapper mapper = new ObjectMapper();
        JsonNode tree = mapper.readTree(requestObject);
        ConfigDeployRequestPnf configDeployRequestPnf = mapper.treeToValue(tree.at("/config-deploy-request"), ConfigDeployRequestPnf.class);
        assertThat(configDeployRequestPnf.getResolutionKey()).matches(TEST_PNF_CORRELATION_ID);
        ConfigDeployPropertiesForPnf properties = configDeployRequestPnf.getConfigDeployPropertiesForPnf();
        assertThat(properties.getServiceInstanceId()).matches(TEST_SERVICE_INSTANCE_ID);
        assertThat(properties.getPnfName()).matches(TEST_PNF_CORRELATION_ID);
        assertThat(properties.getPnfId()).matches(TEST_PNF_UUID);
        assertThat(properties.getPnfCustomizationUuid()).matches(TEST_PNF_RESOURCE_CUSTOMIZATION_UUID);
        assertThat(properties.getServiceModelUuid()).matches(TEST_MODEL_UUID);
        assertThat(properties.getPnfIpV4Address()).matches(TEST_IPV4_ADDRESS);
        assertThat(properties.getPnfIpV6Address()).matches(TEST_IPV6_ADDRESS);
    } catch (IOException e) {
        e.printStackTrace();
        fail("Check request body is json message" + e.getMessage());
    }
}
Also used : ConfigDeployRequestPnf(org.onap.so.client.cds.beans.ConfigDeployRequestPnf) ConfigDeployPropertiesForPnf(org.onap.so.client.cds.beans.ConfigDeployPropertiesForPnf) JsonNode(com.fasterxml.jackson.databind.JsonNode) IOException(java.io.IOException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ConfigDeployPropertiesForPnf (org.onap.so.client.cds.beans.ConfigDeployPropertiesForPnf)2 ConfigDeployRequestPnf (org.onap.so.client.cds.beans.ConfigDeployRequestPnf)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 IOException (java.io.IOException)1