1 # Copyright (c) 2013 OpenStack Foundation.
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
16 from neutron._i18n import _
17 from neutron.api import extensions
18 from neutron.api.v2 import attributes as attr
19 from neutron.common import exceptions as nexception
22 class ExternalNetworkInUse(nexception.InUse):
23 message = _("External network %(net_id)s cannot be updated to be made "
24 "non-external, since it has existing gateway ports")
27 # For backward compatibility the 'router' prefix is kept.
28 EXTERNAL = 'router:external'
29 EXTENDED_ATTRIBUTES_2_0 = {
30 'networks': {EXTERNAL: {'allow_post': True,
34 'convert_to': attr.convert_to_boolean,
35 'enforce_policy': True,
36 'required_by_policy': True}}}
39 class External_net(extensions.ExtensionDescriptor):
43 return "Neutron external network"
50 def get_description(cls):
51 return _("Adds external network attribute to network resource.")
55 return "2013-01-14T10:00:00-00:00"
57 def get_extended_resources(self, version):
59 return EXTENDED_ATTRIBUTES_2_0