class UnassignVnf {

    public void deleteInstanceGroups(BuildingBlockExecution execution) {
        try {
            GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
            List<InstanceGroup> instanceGroups = vnf.getInstanceGroups();
            for (InstanceGroup instanceGroup : instanceGroups) {
                if (ModelInfoInstanceGroup.TYPE_VNFC
                        .equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
                    aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup);
                }
            }
        } catch (Exception ex) {
            logger.error("Exception occurred in UnassignVnf deleteInstanceGroups", ex);
            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
        }
    }

}