def get(self, ws_id, parent_id):
     """Get a list of all Services
     Returns a list of all services available in this resource"""
     if get_parent(request) is Category.project:
         service = servicesimpl.get_services(ws_id, parent_id)
         return prepare_response(service)
     if get_parent(request) is Category.catalogue:
         service = catalogue_servicesimpl.get_all_in_catalogue(ws_id, parent_id, False)
         return prepare_response(service)
     return prepare_response("not yet implemented")
    def delete(self, ws_id, parent_id, service_id):
        """Delete the Service

        Deletes the service from the Project or Catalogue"""
        if get_parent(request) is Category.project:
            service = servicesimpl.delete_service(parent_id, service_id)
            return prepare_response(service)
        if get_parent(request) is Category.catalogue:
            service = catalogue_servicesimpl.delete_service_catalogue(ws_id, parent_id, service_id, False)
            return prepare_response(service)
        return prepare_response("not yet implemented")
    def get(self, ws_id, parent_id, service_id):
        """Return a specific Service

        Returns the referenced service from the Project or catalogue"""
        if get_parent(request) is Category.project:
            service = servicesimpl.get_service(ws_id, parent_id, service_id)
            return prepare_response(service)
        if get_parent(request) is Category.catalogue:
            service = catalogue_servicesimpl.get_in_catalogue(ws_id, parent_id, service_id, False)
            return prepare_response(service)
        return prepare_response("not yet implemented")
    def get(self, ws_id, parent_id):
        """List all functions

        Lists all available functions in the given project or catalogue."""
        if get_parent(request) is Category.project:
            functions = functionsimpl.get_functions(ws_id, parent_id)
            return prepare_response(functions)
        if get_parent(request) is Category.catalogue:
            functions = catalogue_servicesimpl.get_all_in_catalogue(ws_id, parent_id, True)
            return prepare_response(functions)
        return prepare_response("not yet implemented")
 def get(self, ws_id, parent_id):
     """Get a list of all Services
     Returns a list of all services available in this resource"""
     if get_parent(request) is Category.project:
         service = servicesimpl.get_services(ws_id, parent_id)
         return prepare_response(service)
     if get_parent(request) is Category.catalogue:
         service = catalogue_servicesimpl.get_all_in_catalogue(
             ws_id, parent_id, False)
         return prepare_response(service)
     return prepare_response("not yet implemented")
示例#6
0
    def get(self, ws_id, parent_id):
        """List all functions

        Lists all available functions in the given project or catalogue."""
        if get_parent(request) is Category.project:
            functions = functionsimpl.get_functions(ws_id, parent_id)
            return prepare_response(functions)
        if get_parent(request) is Category.catalogue:
            functions = catalogue_servicesimpl.get_all_in_catalogue(
                ws_id, parent_id, True)
            return prepare_response(functions)
        return prepare_response("not yet implemented")
    def delete(self, ws_id, parent_id, vnf_id):
        """Deletes a  function

        Deletes a function in the project or catalogue by its id"""
        if get_parent(request) is Category.project:
            deleted = functionsimpl.delete_function(ws_id, parent_id, vnf_id)
            return prepare_response(deleted)
        if get_parent(request) is Category.catalogue:
            deleted = catalogue_servicesimpl.delete_service_catalogue(ws_id, parent_id, vnf_id, True)
            return prepare_response(deleted)
        # TODO implement for catalog and platform
        return prepare_response("not yet implemented")
    def get(self, ws_id, parent_id, service_id):
        """Return a specific Service

        Returns the referenced service from the Project or catalogue"""
        if get_parent(request) is Category.project:
            service = servicesimpl.get_service(ws_id, parent_id, service_id)
            return prepare_response(service)
        if get_parent(request) is Category.catalogue:
            service = catalogue_servicesimpl.get_in_catalogue(
                ws_id, parent_id, service_id, False)
            return prepare_response(service)
        return prepare_response("not yet implemented")
    def delete(self, ws_id, parent_id, service_id):
        """Delete the Service

        Deletes the service from the Project or Catalogue"""
        if get_parent(request) is Category.project:
            service = servicesimpl.delete_service(parent_id, service_id)
            return prepare_response(service)
        if get_parent(request) is Category.catalogue:
            service = catalogue_servicesimpl.delete_service_catalogue(
                ws_id, parent_id, service_id, False)
            return prepare_response(service)
        return prepare_response("not yet implemented")
示例#10
0
    def delete(self, ws_id, parent_id, vnf_id):
        """Deletes a  function

        Deletes a function in the project or catalogue by its id"""
        if get_parent(request) is Category.project:
            deleted = functionsimpl.delete_function(ws_id, parent_id, vnf_id)
            return prepare_response(deleted)
        if get_parent(request) is Category.catalogue:
            deleted = catalogue_servicesimpl.delete_service_catalogue(
                ws_id, parent_id, vnf_id, True)
            return prepare_response(deleted)
        # TODO implement for catalog and platform
        return prepare_response("not yet implemented")
    def put(self, ws_id, parent_id, vnf_id):
        """Updates a function

        Updates a function in the project or catalogue by its id"""
        if get_parent(request) is Category.project:
            vnf_data = get_json(request)
            vnf_data = functionsimpl.update_function(ws_id, parent_id, vnf_id, vnf_data)
            return prepare_response(vnf_data)
        if get_parent(request) is Category.catalogue:
            vnf_data = get_json(request)
            vnf_data = catalogue_servicesimpl.update_service_catalogue(ws_id, parent_id, vnf_id, vnf_data, True)
            return prepare_response(vnf_data)
        return prepare_response("update vnf in project with id " + parent_id)
    def get(self, ws_id, parent_id, vnf_id):
        """Get a specific function

        Gets a specific function information by its id"""
        if get_parent(request) is Category.project:
            functions = functionsimpl.get_function_project(ws_id, parent_id, vnf_id)
            return prepare_response(functions)
            # TODO implement for catalog and platform
        if get_parent(request) is Category.catalogue:
            functions = catalogue_servicesimpl.get_in_catalogue(ws_id, parent_id, vnf_id, True)
            return prepare_response(functions)
        # TODO implement for catalog and platform
        return prepare_response("not yet implemented")
示例#13
0
    def put(self, ws_id, parent_id, vnf_id):
        """Updates a function

        Updates a function in the project or catalogue by its id"""
        if get_parent(request) is Category.project:
            vnf_data = get_json(request)
            vnf_data = functionsimpl.update_function(ws_id, parent_id, vnf_id,
                                                     vnf_data)
            return prepare_response(vnf_data)
        if get_parent(request) is Category.catalogue:
            vnf_data = get_json(request)
            vnf_data = catalogue_servicesimpl.update_service_catalogue(
                ws_id, parent_id, vnf_id, vnf_data, True)
            return prepare_response(vnf_data)
        return prepare_response("update vnf in project with id " + parent_id)
示例#14
0
    def get(self, ws_id, parent_id, vnf_id):
        """Get a specific function

        Gets a specific function information by its id"""
        if get_parent(request) is Category.project:
            functions = functionsimpl.get_function_project(
                ws_id, parent_id, vnf_id)
            return prepare_response(functions)
            # TODO implement for catalog and platform
        if get_parent(request) is Category.catalogue:
            functions = catalogue_servicesimpl.get_in_catalogue(
                ws_id, parent_id, vnf_id, True)
            return prepare_response(functions)
        # TODO implement for catalog and platform
        return prepare_response("not yet implemented")
    def post(self, ws_id, parent_id):
        """Creates a new function

        Creates a new function in the project or catalogue"""
        if get_parent(request) is Category.project:
            vnf_data = get_json(request)
            vnf_data = functionsimpl.create_function(ws_id, parent_id, vnf_data)
            return prepare_response(vnf_data, 201)
        if get_parent(request) is Category.catalogue:
            vnf_data = get_json(request)
            vnf_data = catalogue_servicesimpl.create_in_catalogue(parent_id, vnf_data['id'],
                                                                  True)
            return prepare_response(vnf_data, 201)
        # TODO implement for catalog and platform
        return prepare_response("not implemented yet")
 def put(self, ws_id, platform_id):
     """Update platform
     
     Updates a service platform by its id"""
     return prepare_response(
         platformsimpl.update_platform(ws_id, platform_id,
                                       get_json(request)))
    def put(self, ws_id, project_id, service_id):
        """Update the service

        Updates the referenced service in the project or in the catalogue or platform"""
        service = servicesimpl.update_service(ws_id, project_id, service_id,
                                              get_json(request))
        return prepare_response(service)
 def get(self, ws_id):
     """
     Returns a list of all schemas configured for this server
     :param ws_id:
     :return:
     """
     return prepare_response(descriptorutil.get_schemas())
    def post(self, ws_id):
        """Creates a new project

        Creates a new project in the given workspace"""
        projectData = get_json(request)
        pj = projectsimpl.create_project(ws_id, projectData)
        return prepare_response(pj, 201)
    def get(self, ws_id, catalogue_id, vnf_id):
        """Get a specific function

        Gets a specific function information by its id"""

        functions = catalogue_servicesimpl.get_in_catalogue(ws_id, catalogue_id, vnf_id, True)
        return prepare_response(functions)
示例#21
0
    def delete(self, ws_id, catalogue_id, service_id):
        """Delete the Service

        Deletes the service from the Project or Catalogue"""

        service = catalogue_servicesimpl.delete_service_catalogue(ws_id, catalogue_id, service_id, False)
        return prepare_response(service)
    def get(self, ws_id, catalogue_id):
        """List all functions

        Lists all available functions in the given project or catalogue."""

        functions = catalogue_servicesimpl.get_all_in_catalogue(ws_id, catalogue_id, True)
        return prepare_response(functions)
    def get(self, ws_id):
        """
        List private Catalogue services

        Lists all services in the Private workspace wide catalogue
        """
        return prepare_response(get_private_nsfs_list(ws_id, False))
    def post(self):
        """Create workspace

        Creates a new workspace"""
        workspace_data = get_json(request)
        workspace = workspaceimpl.create_workspace(session['user_data']['login'], workspace_data)
        return prepare_response(workspace, 201)
    def post(self, ws_id, project_id):
        """Create a new Service

        Creates a new Service in this project or
        publishes it in the catalogue or platform"""
        service = servicesimpl.create_service(ws_id, project_id, get_json(request))
        return prepare_response(service, 201)
    def put(self, ws_id, project_id, vnf_id):
        """Updates a function

        Updates a function in the project or catalogue by its id"""
        vnf_data = get_json(request)
        vnf_data = functionsimpl.update_function(ws_id, project_id, vnf_id, vnf_data)
        return prepare_response(vnf_data)
    def post(self, ws_id, project_id):
        """Creates a new function

        Creates a new function in the project or catalogue"""
        vnf_data = get_json(request)
        vnf_data = functionsimpl.create_function(ws_id, project_id, vnf_data)
        return prepare_response(vnf_data, 201)
示例#28
0
    def put(self, ws_id, catalogue_id):
        """Updates a specific catalogue

        Updates a specific catalogue by its id"""
        return prepare_response(
            cataloguesimpl.update_catalogue(ws_id, catalogue_id,
                                            get_json(request)))
    def post(self, ws_id, parent_id):
        """Create a new Service

        Creates a new Service in this project or
        publishes it in the catalogue or platform"""
        if get_parent(request) is Category.project:
            service = servicesimpl.create_service(ws_id, parent_id, get_json(request))
            return prepare_response(service, 201)
        elif get_parent(request) is Category.platform:
            result = platform_connector.create_service_on_platform(ws_id, parent_id, get_json(request))
            return prepare_response(result, 201)
        if get_parent(request) is Category.catalogue:
            vnf_data = get_json(request)
            service = catalogue_servicesimpl.create_in_catalogue(parent_id, vnf_data['id'], False)
            return prepare_response(service)
        return prepare_response("not yet implemented")
    def post(self):
        """Create workspace

        Creates a new workspace"""
        workspace_data = get_json(request)
        workspace = workspaceimpl.create_workspace(session['user_data']['login'], workspace_data)
        return prepare_response(workspace, 201)
    def get(self, ws_id, project_id, vendor, name, version):
        """Retrieves a virtual network function by vendor name version

        Finds a specific virtual network with given vendor / name / version"""
        function = nsfslookupimpl.find_vnf(session["user_data"], ws_id,
                                           project_id, vendor, name, version)
        return prepare_response(function)
    def get(self):
        """List workspaces

        Gets all available workspaces"""
        workspaces = workspaceimpl.get_workspaces(
            session['user_data']['login'])
        return prepare_response(workspaces)
示例#33
0
    def get(self, ws_id, catalogue_id, service_id):
        """Return a specific Service

        Returns the referenced service from the Project or catalogue"""

        service = catalogue_servicesimpl.get_in_catalogue(ws_id, catalogue_id, service_id, False)
        return prepare_response(service)
 def get(self, ws_id):
     """
     Returns a list of all schemas configured for this server
     :param ws_id:
     :return:
     """
     return prepare_response(descriptorutil.get_schemas())
示例#35
0
def handle_unauthorized(msg: str):
    args = {"scope": "user:email repo delete_repo",
            "client_id": get_config()['authentication']['ClientID']}
    session["requested_endpoint"] = request.endpoint
    return prepare_response({
        'authorizationUrl': 'https://github.com/login/oauth/authorize/?{}'.format(urllib.parse.urlencode(args)),
        "message": msg}, 401)
    def delete(self, ws_id, catalogue_id, vnf_id):
        """Deletes a  function

        Deletes a function in the project or catalogue by its id"""

        deleted = catalogue_servicesimpl.delete_service_catalogue(ws_id, catalogue_id, vnf_id, True)
        return prepare_response(deleted)
    def get(self, ws_id):
        """
        List private Catalogue functions

        Lists all functions in the Private workspace wide catalogue
        """
        return prepare_response(get_private_nsfs_list(ws_id, True))
示例#38
0
    def post(self, ws_id, parent_id):
        """Creates a new function

        Creates a new function in the project or catalogue"""
        if get_parent(request) is Category.project:
            vnf_data = get_json(request)
            vnf_data = functionsimpl.create_function(ws_id, parent_id,
                                                     vnf_data)
            return prepare_response(vnf_data, 201)
        if get_parent(request) is Category.catalogue:
            vnf_data = get_json(request)
            vnf_data = catalogue_servicesimpl.create_in_catalogue(
                parent_id, vnf_data['id'], True)
            return prepare_response(vnf_data, 201)
        # TODO implement for catalog and platform
        return prepare_response("not implemented yet")
 def put(self, ws_id):
     """Update workspace
     
     Updates a specific workspace by its id"""
     workspace_data = get_json(request)
     workspace = workspaceimpl.update_workspace(workspace_data, ws_id)
     return prepare_response(workspace)
示例#40
0
    def get(self, ws_id, catalogue_id):
        """List all functions

        Lists all available functions in the given project or catalogue."""

        functions = catalogue_servicesimpl.get_all_in_catalogue(
            ws_id, catalogue_id, True)
        return prepare_response(functions)
    def put(self, ws_id, parent_id, service_id):
        """Update the service

        Updates the referenced service in the project or in the catalogue or platform"""
        if get_parent(request) is Category.project:
            service = servicesimpl.update_service(ws_id, parent_id, service_id, get_json(request))
            return prepare_response(service)
        elif get_parent(request) is Category.catalogue:
            function_data = get_json(request)
            service = catalogue_servicesimpl.update_service_catalogue(ws_id, parent_id, service_id, function_data,
                                                                      False)
            return prepare_response(service)
        elif get_parent(request) is Category.platform:
            # platform only has one upload method
            result = platform_connector.create_service_on_platform(ws_id, parent_id, get_json(request))
            return prepare_response(result)
        return prepare_response("not yet implemented")
    def get(self, ws_id, project_id, vendor, name, version):
        """Retrieves a network service by vendor name version

        Finds a specific network service with given vendor / name / version"""
        service = nsfslookupimpl.find_network_service(session["user_data"],
                                                      ws_id, project_id,
                                                      vendor, name, version)
        return prepare_response(service)
 def post(self, ws_id, platform_id):
     """
     Upload a service package
     
     Packages and uploads a network service to the platform
     """
     result = platform_connector.create_service_on_platform(ws_id, platform_id, get_json(request))
     return prepare_response(result, 201)
示例#44
0
    def get(self, ws_id, catalogue_id, vnf_id):
        """Get a specific function

        Gets a specific function information by its id"""

        functions = catalogue_servicesimpl.get_in_catalogue(
            ws_id, catalogue_id, vnf_id, True)
        return prepare_response(functions)
    def put(self, ws_id, catalogue_id, vnf_id):
        """Updates a function

        Updates a function in the project or catalogue by its id"""

        vnf_data = get_json(request)
        vnf_data = catalogue_servicesimpl.update_service_catalogue(ws_id, catalogue_id, vnf_id, vnf_data, True)
        return prepare_response(vnf_data)
    def post(self, ws_id, project_id):
        """Create a new Service

        Creates a new Service in this project or
        publishes it in the catalogue or platform"""
        service = servicesimpl.create_service(ws_id, project_id,
                                              get_json(request))
        return prepare_response(service, 201)
示例#47
0
    def delete(self, ws_id, catalogue_id, vnf_id):
        """Deletes a  function

        Deletes a function in the project or catalogue by its id"""

        deleted = catalogue_servicesimpl.delete_service_catalogue(
            ws_id, catalogue_id, vnf_id, True)
        return prepare_response(deleted)
示例#48
0
    def post(self, ws_id, catalogue_id):
        """Create a new Service

        Publishes a new Service in the catalogue"""

        vnf_data = get_json(request)
        service = catalogue_servicesimpl.create_in_catalogue(catalogue_id, vnf_data['id'], False)
        return prepare_response(service)
示例#49
0
 def get():
     """
     Logout
     
     Logs out the current user
     
     :return: "Logged out"
     """
     return prepare_response(logout())
示例#50
0
    def put(self, ws_id, catalogue_id, service_id):
        """Update the service

        Updates the referenced service in the catalogue"""

        function_data = get_json(request)
        service = catalogue_servicesimpl.update_service_catalogue(ws_id, catalogue_id, service_id, function_data,
                                                                  False)
        return prepare_response(service)
    def post(self, ws_id, catalogue_id):
        """Creates a new function

        Creates a new function in the project or catalogue"""

        vnf_data = get_json(request)
        vnf_data = catalogue_servicesimpl.create_in_catalogue(catalogue_id, vnf_data['id'],
                                                              True)
        return prepare_response(vnf_data, 201)
 def post(self, ws_id, platform_id):
     """
     Upload a service package
     
     Packages and uploads a network service to the platform
     """
     result = platform_connector.create_service_on_platform(
         ws_id, platform_id, get_json(request))
     return prepare_response(result, 201)
示例#53
0
def handle_unauthorized(msg: str):
    args = {"scope": "user read:org repo delete_repo", "client_id": get_config()["authentication"]["ClientID"]}
    session["requested_endpoint"] = request.endpoint
    return prepare_response(
        {
            "authorizationUrl": "https://github.com/login/oauth/authorize/?{}".format(urllib.parse.urlencode(args)),
            "message": msg,
        },
        401,
    )
示例#54
0
    def get(self, ws_id):
        """
        List Schemas
        
        Returns a list of all schemas configured for this server

        :param ws_id: The workspace ID
        :return: A list of schemas
        """
        return prepare_response(get_config()["schemas"])
 def get(ws_id, project_id, vnf_id):
     """
     List VNF Images
     
     Shows a list of all image files in the VNF Folder
     :param ws_id: The workspace ID
     :param project_id: The Project ID
     :param vnf_id: The VNF ID
     :return: A List of file names
     """
     return prepare_response(functionsimpl.get_image_files(ws_id, project_id, vnf_id))
示例#56
0
    def get(self, ws_id, schema_id):
        """
        Get schema
        
        Returns the requested schema from the schema_master at schema_index from this workspace

        :param ws_id: The workspace ID
        :param schema_id: Either "ns" or "vnf"
        :return: The requested schema
        """
        schema_index = workspaceimpl.get_workspace(ws_id)['schema_index']
        return prepare_response(descriptorutil.get_schema(schema_index, schema_id))