Fix deprecation warnings
There are a fresh crop of deprecation warnings as things continue to be shifted to neutron_lib; this addresses them. Change-Id: Ia4a34e57ff4327345a612162f3e12b9b197cefe9
This commit is contained in:
parent
b1b2b2af1c
commit
482bdc304e
|
@ -13,7 +13,7 @@
|
|||
# under the License.
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as excp
|
||||
|
||||
from neutron_fwaas._i18n import _
|
||||
|
@ -40,10 +40,12 @@ EXTENDED_ATTRIBUTES_2_0 = {
|
|||
'firewalls': {
|
||||
'port_id': {'allow_post': True, 'allow_put': True,
|
||||
'validate': {'type:uuid': None},
|
||||
'is_visible': True, 'default': attr.ATTR_NOT_SPECIFIED},
|
||||
'is_visible': True,
|
||||
'default': constants.ATTR_NOT_SPECIFIED},
|
||||
'direction': {'allow_post': True, 'allow_put': True,
|
||||
'validate': {'type:values': csr_firewall_direction},
|
||||
'is_visible': True, 'default': attr.ATTR_NOT_SPECIFIED},
|
||||
'is_visible': True,
|
||||
'default': constants.ATTR_NOT_SPECIFIED},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ from neutron.api.v2 import attributes as attr
|
|||
from neutron.api.v2 import resource_helper
|
||||
from neutron.plugins.common import constants as p_const
|
||||
from neutron.services import service_base
|
||||
from neutron_lib.api import converters
|
||||
from neutron_lib.api import validators
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as nexception
|
||||
|
@ -259,7 +260,8 @@ RESOURCE_ATTRIBUTE_MAP = {
|
|||
'validate': {'type:uuid_or_none': None},
|
||||
'is_visible': True},
|
||||
'shared': {'allow_post': True, 'allow_put': True,
|
||||
'default': False, 'convert_to': attr.convert_to_boolean,
|
||||
'default': False,
|
||||
'convert_to': converters.convert_to_boolean,
|
||||
'is_visible': True, 'required_by_policy': True,
|
||||
'enforce_policy': True},
|
||||
'protocol': {'allow_post': True, 'allow_put': True,
|
||||
|
@ -267,7 +269,7 @@ RESOURCE_ATTRIBUTE_MAP = {
|
|||
'convert_to': convert_protocol,
|
||||
'validate': {'type:values': fw_valid_protocol_values}},
|
||||
'ip_version': {'allow_post': True, 'allow_put': True,
|
||||
'default': 4, 'convert_to': attr.convert_to_int,
|
||||
'default': 4, 'convert_to': converters.convert_to_int,
|
||||
'validate': {'type:values': [4, 6]},
|
||||
'is_visible': True},
|
||||
'source_ip_address': {'allow_post': True, 'allow_put': True,
|
||||
|
@ -292,8 +294,8 @@ RESOURCE_ATTRIBUTE_MAP = {
|
|||
'validate': {'type:values': fw_valid_action_values},
|
||||
'is_visible': True, 'default': 'deny'},
|
||||
'enabled': {'allow_post': True, 'allow_put': True,
|
||||
'default': True, 'convert_to': attr.convert_to_boolean,
|
||||
'is_visible': True},
|
||||
'default': True, 'is_visible': True,
|
||||
'convert_to': converters.convert_to_boolean},
|
||||
},
|
||||
'firewall_policies': {
|
||||
'id': {'allow_post': False, 'allow_put': False,
|
||||
|
@ -311,16 +313,16 @@ RESOURCE_ATTRIBUTE_MAP = {
|
|||
attr.DESCRIPTION_MAX_LEN},
|
||||
'is_visible': True, 'default': ''},
|
||||
'shared': {'allow_post': True, 'allow_put': True,
|
||||
'default': False, 'convert_to': attr.convert_to_boolean,
|
||||
'is_visible': True, 'required_by_policy': True,
|
||||
'enforce_policy': True},
|
||||
'default': False, 'enforce_policy': True,
|
||||
'convert_to': converters.convert_to_boolean,
|
||||
'is_visible': True, 'required_by_policy': True},
|
||||
'firewall_rules': {'allow_post': True, 'allow_put': True,
|
||||
'validate': {'type:uuid_list': None},
|
||||
'convert_to': attr.convert_none_to_empty_list,
|
||||
'convert_to': converters.convert_none_to_empty_list,
|
||||
'default': None, 'is_visible': True},
|
||||
'audited': {'allow_post': True, 'allow_put': True,
|
||||
'default': False, 'convert_to': attr.convert_to_boolean,
|
||||
'is_visible': True},
|
||||
'default': False, 'is_visible': True,
|
||||
'convert_to': converters.convert_to_boolean},
|
||||
},
|
||||
'firewalls': {
|
||||
'id': {'allow_post': False, 'allow_put': False,
|
||||
|
@ -338,15 +340,14 @@ RESOURCE_ATTRIBUTE_MAP = {
|
|||
attr.DESCRIPTION_MAX_LEN},
|
||||
'is_visible': True, 'default': ''},
|
||||
'admin_state_up': {'allow_post': True, 'allow_put': True,
|
||||
'default': True,
|
||||
'convert_to': attr.convert_to_boolean,
|
||||
'is_visible': True},
|
||||
'default': True, 'is_visible': True,
|
||||
'convert_to': converters.convert_to_boolean},
|
||||
'status': {'allow_post': False, 'allow_put': False,
|
||||
'is_visible': True},
|
||||
'shared': {'allow_post': True, 'allow_put': True,
|
||||
'default': False, 'convert_to': attr.convert_to_boolean,
|
||||
'is_visible': False, 'required_by_policy': True,
|
||||
'enforce_policy': True},
|
||||
'default': False, 'enforce_policy': True,
|
||||
'convert_to': converters.convert_to_boolean,
|
||||
'is_visible': False, 'required_by_policy': True},
|
||||
'firewall_policy_id': {'allow_post': True, 'allow_put': True,
|
||||
'validate': {'type:uuid_or_none': None},
|
||||
'is_visible': True},
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# under the License.
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as nexception
|
||||
|
||||
from neutron_fwaas._i18n import _
|
||||
|
@ -29,7 +29,7 @@ EXTENDED_ATTRIBUTES_2_0 = {
|
|||
'firewalls': {
|
||||
'router_ids': {'allow_post': True, 'allow_put': True,
|
||||
'validate': {'type:uuid_list': None},
|
||||
'is_visible': True, 'default': attr.ATTR_NOT_SPECIFIED},
|
||||
'is_visible': True, 'default': constants.ATTR_NOT_SPECIFIED},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron import context as neutron_context
|
||||
from neutron import manager
|
||||
from neutron.plugins.common import constants as n_const
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
|
@ -205,7 +205,7 @@ class FirewallPlugin(
|
|||
# pop router_id as this goes in the router association db
|
||||
# and not firewall db
|
||||
router_ids = firewall['firewall'].pop('router_ids', None)
|
||||
if router_ids == attr.ATTR_NOT_SPECIFIED:
|
||||
if router_ids == constants.ATTR_NOT_SPECIFIED:
|
||||
# old semantics router-ids keyword not specified pick up
|
||||
# all routers on tenant.
|
||||
l3_plugin = manager.NeutronManager.get_service_plugins().get(
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
# under the License.
|
||||
#
|
||||
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron import context as neutron_context
|
||||
from neutron import manager
|
||||
|
@ -245,7 +244,7 @@ class CSRFirewallPlugin(ref_fw_plugin.FirewallPlugin,
|
|||
port_id = firewall['firewall'].pop('port_id', None)
|
||||
direction = firewall['firewall'].pop('direction', None)
|
||||
|
||||
if port_id == attr.ATTR_NOT_SPECIFIED:
|
||||
if port_id == l3_const.ATTR_NOT_SPECIFIED:
|
||||
LOG.debug("create_firewall() called")
|
||||
port_id = None
|
||||
router_id = None
|
||||
|
@ -255,7 +254,7 @@ class CSRFirewallPlugin(ref_fw_plugin.FirewallPlugin,
|
|||
router_id = self._validate_fw_port_and_get_router_id(context,
|
||||
firewall['firewall']['tenant_id'], port_id)
|
||||
|
||||
if direction == attr.ATTR_NOT_SPECIFIED:
|
||||
if direction == l3_const.ATTR_NOT_SPECIFIED:
|
||||
direction = None
|
||||
|
||||
firewall['firewall']['status'] = const.PENDING_CREATE
|
||||
|
|
Loading…
Reference in New Issue