コード例 #1
0
    def args2body(self, parsed_args):
        body = {
            self.resource: {
                'nsd_id': parsed_args.nsd_id,
                'vdus': dict(),
                'files': dict()
            }
        }
        if parsed_args.vdus:
            try:
                for key_value in parsed_args.vdus:
                    kwargs = key_value.split(',')
            except ValueError:
                msg = (_('invalid argument for --kwargs %s') %
                       parsed_args.kwargs)
                raise exceptions.vnfsvcCLIError(msg)
            if kwargs:
                body[self.resource]['vdus'] = kwargs

        if parsed_args.files:
            try:
                for key_value in parsed_args.files:
                    kwargs = key_value.split(',')
            except ValueError:
                msg = (_('invalid argument for --kwargs %s') %
                       parsed_args.kwargs)
                raise exceptions.vnfsvcCLIError(msg)
            if kwargs:
                body[self.resource]['files'] = kwargs

        vnfsvcV20.update_dict(parsed_args, body[self.resource], ['tenant-id'])
        return body
コード例 #2
0
    def args2body(self, parsed_args):
        body = {
            self.resource: {
                'name': parsed_args.name,
                'quality_of_service': parsed_args.qos,
                'attributes': dict()
            }
        }

        if parsed_args.networks:
            try:
                kwargs = dict(
                    key_value.split('=', 1)
                    for key_value in parsed_args.networks)
            except ValueError:
                msg = (_('invalid argument for --kwargs %s') %
                       parsed_args.kwargs)
                raise exceptions.vnfsvcCLIError(msg)
            if kwargs:
                body[self.resource]['attributes']['networks'] = kwargs

        if parsed_args.router:
            body[self.resource]['attributes']['router'] = parsed_args.router

        if parsed_args.subnets:
            try:
                kwargs = dict(
                    key_value.split('=', 1)
                    for key_value in parsed_args.subnets)
            except ValueError:
                msg = (_('invalid argument for --kwargs %s') %
                       parsed_args.kwargs)
                raise exceptions.vnfsvcCLIError(msg)
            if kwargs:
                body[self.resource]['attributes']['subnets'] = kwargs

        vnfsvcV20.update_dict(parsed_args, body[self.resource], ['tenant_id'])
        return body
コード例 #3
0
    def args2body(self, parsed_args):
        body = {
            self.resource: {
                'name': parsed_args.name,
                'quality_of_service' : parsed_args.qos,
                'attributes': dict()
            }
        }

        if parsed_args.networks:
            try:
                kwargs = dict(key_value.split('=', 1)
                              for key_value in parsed_args.networks)
            except ValueError:
                msg = (_('invalid argument for --kwargs %s') %
                       parsed_args.kwargs)
                raise exceptions.vnfsvcCLIError(msg)
            if kwargs:
                body[self.resource]['attributes']['networks'] = kwargs


        if parsed_args.router:
            body[self.resource]['attributes']['router'] = parsed_args.router
      
        if parsed_args.subnets:
            try:
                kwargs = dict(key_value.split('=', 1)
                              for key_value in parsed_args.subnets)
            except ValueError:
                msg = (_('invalid argument for --kwargs %s') %
                       parsed_args.kwargs)
                raise exceptions.vnfsvcCLIError(msg)
            if kwargs:
                body[self.resource]['attributes']['subnets'] = kwargs


        vnfsvcV20.update_dict(parsed_args, body[self.resource], ['tenant_id'])
        return body