Scott Baker | 352d473 | 2014-08-14 16:10:59 -0700 | [diff] [blame^] | 1 | from neutron.api.v2 import attributes |
| 2 | |
| 3 | FORWARD_PORTS = 'nat:forward_ports' |
| 4 | |
| 5 | EXTENDED_ATTRIBUTES_2_0 = { |
| 6 | 'ports': { |
| 7 | FORWARD_PORTS: {'allow_post': True, 'allow_put': True, |
| 8 | 'default': attributes.ATTR_NOT_SPECIFIED, |
| 9 | 'is_visible': True}, |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | |
| 14 | class Nat(object): |
| 15 | """Extension class supporting OpenCloud NAT networking |
| 16 | |
| 17 | This class is used by Quantum's extension framework to make |
| 18 | metadata about the OpenCloud Port extension available to |
| 19 | clients. No new resources are defined by this extension. Instead, |
| 20 | the existing Port resource's request and response messages are |
| 21 | extended with attributes in the OpenCloud namespace. |
| 22 | """ |
| 23 | |
| 24 | @classmethod |
| 25 | def get_name(cls): |
| 26 | return "OpenCloud NAT Networking Extension" |
| 27 | |
| 28 | @classmethod |
| 29 | def get_alias(cls): |
| 30 | return "nat" |
| 31 | |
| 32 | @classmethod |
| 33 | def get_description(cls): |
| 34 | return "Add TCP/UDP port forwarding through NAT to Quantum Port objects" |
| 35 | |
| 36 | @classmethod |
| 37 | def get_namespace(cls): |
| 38 | # return "http://docs.openstack.org/ext/provider/api/v1.0" |
| 39 | # Nothing there right now |
| 40 | return "http://www.vicci.org/ext/opencloud/nat/api/v0.1" |
| 41 | |
| 42 | @classmethod |
| 43 | def get_updated(cls): |
| 44 | return "2013-09-12T10:00:00-00:00" |
| 45 | |
| 46 | def get_extended_resources(self, version): |
| 47 | if version == "2.0": |
| 48 | return EXTENDED_ATTRIBUTES_2_0 |
| 49 | else: |
| 50 | return {} |