Example #1
0
 def delete(self, request, tenant_id, id):
     """ Destroys the portprofile with the given id """
     try:
         self._plugin.delete_portprofile(tenant_id, id)
         return exc.HTTPOk()
     except exception.PortProfileNotFound as exp:
         return faults.Fault(faults.PortprofileNotFound(exp))
Example #2
0
 def delete(self, request, tenant_id, id):
     """ Destroys the qos with the given id """
     try:
         self._plugin.delete_qos(tenant_id, id)
         return exc.HTTPOk()
     except exception.QosNotFound as exp:
         return faults.Fault(faults.QosNotFound(exp))
Example #3
0
 def delete(self, request, tenant_id, id):
     """Destroys the credential with the given id."""
     try:
         self._plugin.delete_credential(tenant_id, id)
         return exc.HTTPOk()
     except exception.CredentialNotFound as exp:
         return faults.Fault(faults.CredentialNotFound(exp))
Example #4
0
    def update(self, request, tenant_id, id):
        """ Updates the name for the credential with the given id """
        try:
            req_params = \
                self._parse_request_params(request,
                                           self._credential_ops_param_list)
        except exc.HTTPError as exp:
            return faults.Fault(exp)
        try:
            credential = self._plugin.\
            rename_credential(tenant_id,
                        id, req_params['credential_name'])

            builder = credential_view.get_view_builder(request)
            result = builder.build(credential, True)
            return dict(credentials=result)
        except exception.CredentialNotFound as exp:
            return faults.Fault(faults.CredentialNotFound(exp))
Example #5
0
    def update(self, request, tenant_id, id):
        """ Updates the name for the qos with the given id """
        try:
            req_params = \
                self._parse_request_params(request,
                                           self._qos_ops_param_list)
        except exc.HTTPError as exp:
            return faults.Fault(exp)
        try:
            qos = self._plugin.\
            rename_qos(tenant_id,
                        id, req_params['qos_name'])

            builder = qos_view.get_view_builder(request)
            result = builder.build(qos, True)
            return dict(qoss=result)
        except exception.QosNotFound as exp:
            return faults.Fault(faults.QosNotFound(exp))
Example #6
0
    def update(self, request, tenant_id, id):
        """ Updates the name for the portprofile with the given id """
        try:
            req_params = \
                self._parse_request_params(request,
                                           self._portprofile_ops_param_list)
        except exc.HTTPError as exp:
            return faults.Fault(exp)
        try:
            portprofile = self._plugin.\
            rename_portprofile(tenant_id,
                        id, req_params['portprofile_name'])

            builder = pprofiles_view.get_view_builder(request)
            result = builder.build(portprofile, True)
            return dict(portprofiles=result)
        except exception.PortProfileNotFound as exp:
            return faults.Fault(faults.PortprofileNotFound(exp))
Example #7
0
    def update(self, request, tenant_id, id):
        """Updates the name for the credential with the given id."""
        try:
            body = self._deserialize(request.body, request.get_content_type())
            req_body = self._prepare_request_body(
                body, self._credential_ops_param_list)
            req_params = req_body[self._resource_name]
        except exc.HTTPError as exp:
            return faults.Fault(exp)
        try:
            credential = self._plugin.rename_credential(
                tenant_id, id, req_params['credential_name'])

            builder = credential_view.get_view_builder(request)
            result = builder.build(credential, True)
            return dict(credentials=result)
        except exception.CredentialNotFound as exp:
            return faults.Fault(faults.CredentialNotFound(exp))
Example #8
0
    def update(self, request, tenant_id, id):
        """ Updates the name for the qos with the given id """
        try:
            body = self._deserialize(request.body, request.get_content_type())
            req_body = self._prepare_request_body(body,
                                                  self._qos_ops_param_list)
            req_params = req_body[self._resource_name]
        except exc.HTTPError as exp:
            return faults.Fault(exp)
        try:
            qos = self._plugin.rename_qos(tenant_id, id,
                                          req_params['qos_name'])

            builder = qos_view.get_view_builder(request)
            result = builder.build(qos, True)
            return dict(qoss=result)
        except exception.QosNotFound as exp:
            return faults.Fault(faults.QosNotFound(exp))
Example #9
0
 def associate_port(self, request, tenant_id, id):
     content_type = request.best_match_content_type()
     try:
         req_params = \
             self._parse_request_params(request,
                                        self._schedule_host_ops_param_list)
     except exc.HTTPError as exp:
         return faults.Fault(exp)
     instance_id = req_params['instance_id']
     instance_desc = req_params['instance_desc']
     try:
         vif = self._plugin. \
         associate_port(tenant_id, instance_id, instance_desc)
         builder = enginetenant_view.get_view_builder(request)
         result = builder.build_vif(vif)
         return result
     except qexception.PortNotFound as exp:
         return faults.Fault(faults.PortNotFound(exp))
Example #10
0
 def show(self, request, tenant_id, id):
     """ Returns qos details for the given qos id """
     try:
         qos = self._plugin.get_qos_details(tenant_id, id)
         builder = qos_view.get_view_builder(request)
         #build response with details
         result = builder.build(qos, True)
         return dict(qoss=result)
     except exception.QosNotFound as exp:
         return faults.Fault(faults.QosNotFound(exp))
Example #11
0
 def show(self, request, tenant_id, id):
     """Returns credential details for the given credential id."""
     try:
         credential = self._plugin.get_credential_details(tenant_id, id)
         builder = credential_view.get_view_builder(request)
         #build response with details
         result = builder.build(credential, True)
         return dict(credentials=result)
     except exception.CredentialNotFound as exp:
         return faults.Fault(faults.CredentialNotFound(exp))
Example #12
0
 def show(self, request, tenant_id, id):
     """ Returns portprofile details for the given portprofile id """
     try:
         portprofile = self._plugin.get_portprofile_details(tenant_id, id)
         builder = pprofiles_view.get_view_builder(request)
         #build response with details
         result = builder.build(portprofile, True)
         return dict(portprofiles=result)
     except exception.PortProfileNotFound as exp:
         return faults.Fault(faults.PortprofileNotFound(exp))
Example #13
0
    def associate_portprofile(self, request, tenant_id, id):
        """ associate a portprofile to the port """
        content_type = request.best_match_content_type()

        try:
            req_params = \
                self._parse_request_params(request,
                                           self._assignprofile_ops_param_list)
        except exc.HTTPError as exp:
            return faults.Fault(exp)
        net_id = req_params['network-id'].strip()
        port_id = req_params['port-id'].strip()
        try:
            self._plugin.associate_portprofile(tenant_id, net_id, port_id, id)
            return exc.HTTPOk()
        except exception.PortProfileNotFound as exp:
            return faults.Fault(faults.PortprofileNotFound(exp))
        except qexception.PortNotFound as exp:
            return faults.Fault(faults.PortNotFound(exp))
Example #14
0
    def update(self, request, tenant_id, id):
        """ Updates the name for the portprofile with the given id """
        try:
            body = self._deserialize(request.body, request.get_content_type())
            req_body = \
                self._prepare_request_body(body,
                                           self._portprofile_ops_param_list)
            req_params = req_body[self._resource_name]
        except exc.HTTPError as exp:
            return faults.Fault(exp)
        try:
            portprofile = \
                self._plugin.rename_portprofile(tenant_id, id,
                                                req_params['portprofile_name'])

            builder = pprofiles_view.get_view_builder(request)
            result = builder.build(portprofile, True)
            return dict(portprofiles=result)
        except exception.PortProfileNotFound as exp:
            return faults.Fault(faults.PortprofileNotFound(exp))
Example #15
0
    def associate_port(self, request, tenant_id, id):
        content_type = request.best_match_content_type()
        try:
            body = self._deserialize(request.body, content_type)
            req_body = self._prepare_request_body(
                body, self._schedule_host_ops_param_list)
            req_params = req_body[self._resource_name]

        except exc.HTTPError as exp:
            return faults.Fault(exp)
        instance_id = req_params['instance_id']
        instance_desc = req_params['instance_desc']
        try:
            vif = self._plugin.associate_port(tenant_id, instance_id,
                                              instance_desc)
            builder = novatenant_view.get_view_builder(request)
            result = builder.build_vif(vif)
            return result
        except qexception.PortNotFound as exp:
            return faults.Fault(faults.PortNotFound(exp))
Example #16
0
 def disassociate_portprofile(self, request, tenant_id, id):
     """ Disassociate a portprofile from a port """
     content_type = request.best_match_content_type()
     try:
         body = self._deserialize(request.body, content_type)
         req_body = \
             self._prepare_request_body(body,
                                        self._assignprofile_ops_param_list)
         req_params = req_body[self._resource_name]
     except exc.HTTPError as exp:
         return faults.Fault(exp)
     net_id = req_params['network-id'].strip()
     port_id = req_params['port-id'].strip()
     try:
         self._plugin.disassociate_portprofile(tenant_id, net_id, port_id,
                                               id)
         return exc.HTTPOk()
     except exception.PortProfileNotFound as exp:
         return faults.Fault(faults.PortprofileNotFound(exp))
     except qexception.PortNotFound as exp:
         return faults.Fault(faults.PortNotFound(exp))
Example #17
0
 def create(self, request, tenant_id):
     """ Creates a new qos for a given tenant """
     #look for qos name in request
     try:
         body = self._deserialize(request.body, request.get_content_type())
         req_body = self._prepare_request_body(body,
                                               self._qos_ops_param_list)
         req_params = req_body[self._resource_name]
     except exc.HTTPError as exp:
         return faults.Fault(exp)
     qos = self._plugin.create_qos(tenant_id, req_params['qos_name'],
                                   req_params['qos_desc'])
     builder = qos_view.get_view_builder(request)
     result = builder.build(qos)
     return dict(qoss=result)
Example #18
0
 def create(self, request, tenant_id):
     """ Creates a new credential for a given tenant """
     try:
         req_params = \
             self._parse_request_params(request,
                                        self._credential_ops_param_list)
     except exc.HTTPError as exp:
         return faults.Fault(exp)
     credential = self._plugin.\
                    create_credential(tenant_id,
                                       req_params['credential_name'],
                                       req_params['user_name'],
                                       req_params['password'])
     builder = credential_view.get_view_builder(request)
     result = builder.build(credential)
     return dict(credentials=result)
Example #19
0
 def create(self, request, tenant_id):
     """ Creates a new portprofile for a given tenant """
     #look for portprofile name in request
     try:
         req_params = \
             self._parse_request_params(request,
                                        self._portprofile_ops_param_list)
     except exc.HTTPError as exp:
         return faults.Fault(exp)
     portprofile = self._plugin.\
                    create_portprofile(tenant_id,
                                       req_params['portprofile_name'],
                                       req_params['qos_name'])
     builder = pprofiles_view.get_view_builder(request)
     result = builder.build(portprofile)
     return dict(portprofiles=result)
Example #20
0
    def create(self, request, tenant_id):
        """ Creates a new credential for a given tenant """
        try:
            body = self._deserialize(request.body, request.get_content_type())
            req_body = self._prepare_request_body(
                body, self._credential_ops_param_list)
            req_params = req_body[self._resource_name]

        except exc.HTTPError as exp:
            return faults.Fault(exp)
        credential = self._plugin.create_credential(
            tenant_id, req_params['credential_name'], req_params['user_name'],
            req_params['password'])
        builder = credential_view.get_view_builder(request)
        result = builder.build(credential)
        return dict(credentials=result)
Example #21
0
 def create(self, request, tenant_id):
     """ Creates a new qos for a given tenant """
     #look for qos name in request
     try:
         req_params = \
             self._parse_request_params(request,
                                        self._qos_ops_param_list)
     except exc.HTTPError as exp:
         return faults.Fault(exp)
     qos = self._plugin.\
                    create_qos(tenant_id,
                                       req_params['qos_name'],
                                       req_params['qos_desc'])
     builder = qos_view.get_view_builder(request)
     result = builder.build(qos)
     return dict(qoss=result)
Example #22
0
 def create(self, request, tenant_id):
     """ Creates a new multiport for a given tenant """
     try:
         req_params = \
             self._parse_request_params(request,
                                        self._multiport_ops_param_list)
     except exc.HTTPError as exp:
         return faults.Fault(exp)
     multiports = self._plugin.\
                    create_multiport(tenant_id,
                                       req_params['net_id_list'],
                                       req_params['status'],
                                       req_params['ports_desc'])
     builder = port_view.get_view_builder(request)
     result = [builder.build(port)['port'] for port in multiports]
     return dict(ports=result)
Example #23
0
    def create(self, request, tenant_id):
        """ Creates a new multiport for a given tenant """
        try:
            body = self._deserialize(request.body, request.get_content_type())
            req_body = self._prepare_request_body(
                body, self._multiport_ops_param_list)
            req_params = req_body[self._resource_name]

        except exc.HTTPError as exp:
            return faults.Fault(exp)
        multiports = self._plugin.create_multiport(tenant_id,
                                                   req_params['net_id_list'],
                                                   req_params['status'],
                                                   req_params['ports_desc'])
        builder = port_view.get_view_builder(request, self.version)
        result = [builder.build(port)['port'] for port in multiports]
        return dict(ports=result)
Example #24
0
 def create(self, request, tenant_id):
     """ Creates a new portprofile for a given tenant """
     #look for portprofile name in request
     try:
         body = self._deserialize(request.body, request.get_content_type())
         req_body = \
             self._prepare_request_body(body,
                                        self._portprofile_ops_param_list)
         req_params = req_body[self._resource_name]
     except exc.HTTPError as exp:
         return faults.Fault(exp)
     portprofile = \
         self._plugin.create_portprofile(tenant_id,
                                         req_params['portprofile_name'],
                                         req_params['qos_name'])
     builder = pprofiles_view.get_view_builder(request)
     result = builder.build(portprofile)
     return dict(portprofiles=result)