| from neutronv2.common import send |
| from neutronv2.arg_converter import get_by_name_or_uuid_multiple |
| |
| try: |
| from urllib.parse import urlencode |
| except ImportError: |
| from urllib import urlencode |
| |
| |
| @get_by_name_or_uuid_multiple([('port', 'port_id')]) |
| @send('get') |
| def port_get_details(port_id, **kwargs): |
| url = '/ports/{}?{}'.format(port_id, urlencode(kwargs)) |
| return url, {} |
| |
| |
| @get_by_name_or_uuid_multiple([('port', 'port_id')]) |
| @send('put') |
| def port_update(port_id, **kwargs): |
| url = '/ports/{}'.format(port_id) |
| json = { |
| 'port': kwargs, |
| } |
| return url, {'json': json} |
| |
| |
| @get_by_name_or_uuid_multiple([('port', 'port_id')]) |
| @send('delete') |
| def port_delete(port_id, **kwargs): |
| url = '/port/{}'.format(port_id) |
| return url, {} |
| |
| |
| @send('post') |
| def port_create(**kwargs): |
| url = '/ports' |
| json = { |
| 'port': kwargs, |
| } |
| return url, {'json': json} |