from hashlib import sha256
from http import HTTPStatus
from time import time
-from validation import user_new_schema, user_edit_schema, project_new_schema, project_edit_schema
-from validation import vim_account_new_schema, vim_account_edit_schema, sdn_new_schema, sdn_edit_schema
-from validation import wim_account_new_schema, wim_account_edit_schema, roles_new_schema, roles_edit_schema
-from validation import validate_input
-from validation import ValidationError
-from validation import is_valid_uuid # To check that User/Project Names don't look like UUIDs
-from base_topic import BaseTopic, EngineException
+from osm_nbi.validation import user_new_schema, user_edit_schema, project_new_schema, project_edit_schema, \
+ vim_account_new_schema, vim_account_edit_schema, sdn_new_schema, sdn_edit_schema, \
+ wim_account_new_schema, wim_account_edit_schema, roles_new_schema, roles_edit_schema, \
+ validate_input, ValidationError, is_valid_uuid # To check that User/Project Names don't look like UUIDs
+from osm_nbi.base_topic import BaseTopic, EngineException
+from osm_nbi.authconn import AuthconnNotFoundException, AuthconnConflictException
from osm_common.dbbase import deep_update_rfc7396
-from authconn import AuthconnNotFoundException, AuthconnConflictException
-# from authconn_keystone import AuthconnKeystone
__author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
plugins with the definition of the methods to be implemented.
"""
-__author__ = "Eduardo Sousa <esousa@whitestack.com>"
+__author__ = "Eduardo Sousa <esousa@whitestack.com>, " \
+ "Pedro de la Cruz Ramos <pdelacruzramos@altran.com>"
__date__ = "$27-jul-2018 23:59:59$"
from http import HTTPStatus
-from base_topic import BaseTopic
+from osm_nbi.base_topic import BaseTopic
class AuthException(Exception):
:return: returns a list of users.
"""
- def get_user(self, id, fail=True):
- filt = {BaseTopic.id_field("users", id): id}
+ def get_user(self, _id, fail=True):
+ """
+ Get one user
+ :param _id: id or name
+ :param fail: True to raise exception on not found. False to return None on not found
+ :return: dictionary with the user information
+ """
+ filt = {BaseTopic.id_field("users", _id): _id}
users = self.get_user_list(filt)
if not users:
if fail:
"""
raise AuthconnNotImplementedException("Should have implemented this")
- def get_role(self, id, fail=True):
- filt = {BaseTopic.id_field("roles", id): id}
+ def get_role(self, _id, fail=True):
+ """
+ Get one role
+ :param _id: id or name
+ :param fail: True to raise exception on not found. False to return None on not found
+ :return: dictionary with the role information
+ """
+ filt = {BaseTopic.id_field("roles", _id): _id}
roles = self.get_role_list(filt)
if not roles:
if fail:
"""
raise AuthconnNotImplementedException("Should have implemented this")
- def get_project(self, id, fail=True):
- filt = {BaseTopic.id_field("projects", id): id}
+ def get_project(self, _id, fail=True):
+ """
+ Get one project
+ :param _id: id or name
+ :param fail: True to raise exception on not found. False to return None on not found
+ :return: dictionary with the project information
+ """
+ filt = {BaseTopic.id_field("projects", _id): _id}
projs = self.get_project_list(filt)
if not projs:
if fail:
OSM Internal Authentication Backend and leverages the RBAC model
"""
-__author__ = "Pedro de la Cruz Ramos <pdelacruzramos@altran.com>"
+__author__ = "Pedro de la Cruz Ramos <pdelacruzramos@altran.com>, " \
+ "Alfonso Tierno <alfonso.tiernosepulveda@telefoncia.com"
__date__ = "$06-jun-2019 11:16:08$"
-from authconn import Authconn, AuthException # , AuthconnOperationException
+from osm_nbi.authconn import Authconn, AuthException # , AuthconnOperationException
from osm_common.dbbase import DbException
-from base_topic import BaseTopic
+from osm_nbi.base_topic import BaseTopic
import logging
import re
"""
-__author__ = "Eduardo Sousa <esousa@whitestack.com>"
+__author__ = "Eduardo Sousa <esousa@whitestack.com>, " \
+ "Pedro de la Cruz Ramos <pdelacruzramos@altran.com>"
__date__ = "$27-jul-2018 23:59:59$"
-from authconn import Authconn, AuthException, AuthconnOperationException, AuthconnNotFoundException, \
+from osm_nbi.authconn import Authconn, AuthException, AuthconnOperationException, AuthconnNotFoundException, \
AuthconnConflictException
import logging
from keystoneauth1.exceptions.http import Conflict
from keystoneclient.v3 import client
from http import HTTPStatus
-from validation import is_valid_uuid
+from osm_nbi.validation import is_valid_uuid
class AuthconnKeystone(Authconn):
from http import HTTPStatus
from time import time
from osm_common.dbbase import deep_update_rfc7396
-from validation import validate_input, ValidationError, is_valid_uuid
+from osm_nbi.validation import validate_input, ValidationError, is_valid_uuid
__author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
def __init__(self, message, http_code=HTTPStatus.BAD_REQUEST):
self.http_code = http_code
- Exception.__init__(self, message)
+ super(Exception, self).__init__(message)
def get_iterable(input_var):
from hashlib import md5
from osm_common.dbbase import DbException, deep_update_rfc7396
from http import HTTPStatus
-from validation import ValidationError, pdu_new_schema, pdu_edit_schema
-from base_topic import BaseTopic, EngineException, get_iterable
+from osm_nbi.validation import ValidationError, pdu_new_schema, pdu_edit_schema
+from osm_nbi.base_topic import BaseTopic, EngineException, get_iterable
from osm_im.vnfd import vnfd as vnfd_im
from osm_im.nsd import nsd as nsd_im
from osm_im.nst import nst as nst_im
from osm_common.msgbase import MsgException
from http import HTTPStatus
-from authconn_keystone import AuthconnKeystone
-from authconn_internal import AuthconnInternal
-from base_topic import EngineException, versiontuple
-from admin_topics import VimAccountTopic, WimAccountTopic, SdnTopic
-from admin_topics import UserTopicAuth, ProjectTopicAuth, RoleTopicAuth
-from descriptor_topics import VnfdTopic, NsdTopic, PduTopic, NstTopic
-from instance_topics import NsrTopic, VnfrTopic, NsLcmOpTopic, NsiTopic, NsiLcmOpTopic
-from pmjobs_topics import PmJobsTopic
+from osm_nbi.authconn_keystone import AuthconnKeystone
+from osm_nbi.authconn_internal import AuthconnInternal
+from osm_nbi.base_topic import EngineException, versiontuple
+from osm_nbi.admin_topics import VimAccountTopic, WimAccountTopic, SdnTopic
+from osm_nbi.admin_topics import UserTopicAuth, ProjectTopicAuth, RoleTopicAuth
+from osm_nbi.descriptor_topics import VnfdTopic, NsdTopic, PduTopic, NstTopic
+from osm_nbi.instance_topics import NsrTopic, VnfrTopic, NsLcmOpTopic, NsiTopic, NsiLcmOpTopic
+from osm_nbi.pmjobs_topics import PmJobsTopic
from base64 import b64encode
from os import urandom, path
from threading import Lock
from http import HTTPStatus
from time import time
from copy import copy, deepcopy
-from validation import validate_input, ValidationError, ns_instantiate, ns_action, ns_scale, nsi_instantiate
-from base_topic import BaseTopic, EngineException, get_iterable
+from osm_nbi.validation import validate_input, ValidationError, ns_instantiate, ns_action, ns_scale, nsi_instantiate
+from osm_nbi.base_topic import BaseTopic, EngineException, get_iterable
# from descriptor_topics import DescriptorTopic
from yaml import safe_dump
from osm_common.dbbase import DbException
import asyncio
import aiohttp
-from base_topic import EngineException
+from osm_nbi.base_topic import EngineException
__author__ = "Vijay R S <vijay.r@tataelxsi.co.in>"
from osm_common import dbmongo, dbmemory, msglocal, msgkafka
from osm_common.dbbase import DbException
from osm_common.msgbase import MsgException
-from engine import EngineException
+from osm_nbi.engine import EngineException
__author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
jsonschema
PyYAML==3.*
python-keystoneclient
+requests
git+https://osm.etsi.org/gerrit/osm/common.git#egg=osm-common
git+https://osm.etsi.org/gerrit/osm/IM.git#egg=osm-im