Search in sources :

Example 1 with HeatStatus

use of org.onap.so.openstack.beans.HeatStatus in project so by onap.

the class MsoHeatUtils method stackStatusToVduStatus.

private VduStatus stackStatusToVduStatus(StackInfo stackInfo) {
    VduStatus vduStatus = new VduStatus();
    // Map the status fields to more generic VduStatus.
    // There are lots of HeatStatus values, so this is a bit long...
    HeatStatus heatStatus = stackInfo.getStatus();
    String statusMessage = stackInfo.getStatusMessage();
    if (heatStatus == HeatStatus.INIT || heatStatus == HeatStatus.BUILDING) {
        vduStatus.setState(VduStateType.INSTANTIATING);
        vduStatus.setLastAction((new PluginAction("create", IN_PROGRESS, statusMessage)));
    } else if (heatStatus == HeatStatus.NOTFOUND) {
        vduStatus.setState(VduStateType.NOTFOUND);
    } else if (heatStatus == HeatStatus.CREATED) {
        vduStatus.setState(VduStateType.INSTANTIATED);
        vduStatus.setLastAction((new PluginAction("create", "complete", statusMessage)));
    } else if (heatStatus == HeatStatus.UPDATED) {
        vduStatus.setState(VduStateType.INSTANTIATED);
        vduStatus.setLastAction((new PluginAction("update", "complete", statusMessage)));
    } else if (heatStatus == HeatStatus.UPDATING) {
        vduStatus.setState(VduStateType.UPDATING);
        vduStatus.setLastAction((new PluginAction("update", IN_PROGRESS, statusMessage)));
    } else if (heatStatus == HeatStatus.DELETING) {
        vduStatus.setState(VduStateType.DELETING);
        vduStatus.setLastAction((new PluginAction("delete", IN_PROGRESS, statusMessage)));
    } else if (heatStatus == HeatStatus.FAILED) {
        vduStatus.setState(VduStateType.FAILED);
        vduStatus.setErrorMessage(stackInfo.getStatusMessage());
    } else {
        vduStatus.setState(VduStateType.UNKNOWN);
    }
    return vduStatus;
}
Also used : VduStatus(org.onap.so.adapters.vdu.VduStatus) PluginAction(org.onap.so.adapters.vdu.PluginAction) HeatStatus(org.onap.so.openstack.beans.HeatStatus)

Example 2 with HeatStatus

use of org.onap.so.openstack.beans.HeatStatus in project so by onap.

the class MsoMulticloudUtils method stackStatusToVduStatus.

private VduStatus stackStatusToVduStatus(StackInfo stackInfo) {
    VduStatus vduStatus = new VduStatus();
    // Map the status fields to more generic VduStatus.
    // There are lots of HeatStatus values, so this is a bit long...
    HeatStatus heatStatus = stackInfo.getStatus();
    String statusMessage = stackInfo.getStatusMessage();
    logger.debug("HeatStatus = {} msg = {}", heatStatus, statusMessage);
    if (logger.isDebugEnabled()) {
        logger.debug(String.format("Stack Status: %s", heatStatus.toString()));
        logger.debug(String.format("Stack Status Message: %s", statusMessage));
    }
    if (heatStatus == HeatStatus.INIT || heatStatus == HeatStatus.BUILDING) {
        vduStatus.setState(VduStateType.INSTANTIATING);
        vduStatus.setLastAction((new PluginAction("create", "in_progress", statusMessage)));
    } else if (heatStatus == HeatStatus.NOTFOUND) {
        vduStatus.setState(VduStateType.NOTFOUND);
    } else if (heatStatus == HeatStatus.CREATED) {
        vduStatus.setState(VduStateType.INSTANTIATED);
        vduStatus.setLastAction((new PluginAction("create", "complete", statusMessage)));
    } else if (heatStatus == HeatStatus.UPDATED) {
        vduStatus.setState(VduStateType.INSTANTIATED);
        vduStatus.setLastAction((new PluginAction("update", "complete", statusMessage)));
    } else if (heatStatus == HeatStatus.UPDATING) {
        vduStatus.setState(VduStateType.UPDATING);
        vduStatus.setLastAction((new PluginAction("update", "in_progress", statusMessage)));
    } else if (heatStatus == HeatStatus.DELETING) {
        vduStatus.setState(VduStateType.DELETING);
        vduStatus.setLastAction((new PluginAction("delete", "in_progress", statusMessage)));
    } else if (heatStatus == HeatStatus.FAILED) {
        vduStatus.setState(VduStateType.FAILED);
        vduStatus.setErrorMessage(stackInfo.getStatusMessage());
    } else {
        vduStatus.setState(VduStateType.UNKNOWN);
    }
    return vduStatus;
}
Also used : VduStatus(org.onap.so.adapters.vdu.VduStatus) PluginAction(org.onap.so.adapters.vdu.PluginAction) HeatStatus(org.onap.so.openstack.beans.HeatStatus)

Aggregations

PluginAction (org.onap.so.adapters.vdu.PluginAction)2 VduStatus (org.onap.so.adapters.vdu.VduStatus)2 HeatStatus (org.onap.so.openstack.beans.HeatStatus)2