Ejemplo n.º 1
0
 def _items(self, request, tenant_id, is_detail):
     """ Returns a list of portprofiles. """
     portprofiles = self._plugin.get_all_portprofiles(tenant_id)
     builder = pprofiles_view.get_view_builder(request)
     result = [builder.build(portprofile, is_detail)['portprofile']
               for portprofile in portprofiles]
     return dict(portprofiles=result)
Ejemplo n.º 2
0
 def _items(self, request, tenant_id, is_detail):
     """ Returns a list of portprofiles. """
     portprofiles = self._plugin.get_all_portprofiles(tenant_id)
     builder = pprofiles_view.get_view_builder(request)
     result = [
         builder.build(portprofile, is_detail)['portprofile']
         for portprofile in portprofiles
     ]
     return dict(portprofiles=result)
Ejemplo n.º 3
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))
Ejemplo n.º 4
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))
Ejemplo n.º 5
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)
Ejemplo n.º 6
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)
Ejemplo n.º 7
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)
Ejemplo n.º 8
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)
Ejemplo n.º 9
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))
Ejemplo n.º 10
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))
Ejemplo n.º 11
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))
Ejemplo n.º 12
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))