Browse Source

Merge "Fix resource schemas and releated `get_sorts` test cases" into stable/stein

tags/14.1.0
Zuul 2 weeks ago
parent
commit
193cf6d67e
3 changed files with 23 additions and 10 deletions
  1. +13
    -7
      neutron/extensions/securitygroup.py
  2. +7
    -0
      neutron/extensions/segment.py
  3. +3
    -3
      neutron/tests/unit/extensions/test_network_segment_range.py

+ 13
- 7
neutron/extensions/securitygroup.py View File

@@ -221,13 +221,16 @@ RESOURCE_ATTRIBUTE_MAP = {
'validate': {'type:uuid': None},
'is_visible': True,
'is_filter': True,
'is_sort_key': True,
'primary_key': True},
'name': {'allow_post': True, 'allow_put': True,
'is_visible': True, 'default': '', 'is_filter': True,
'is_sort_key': True,
'validate': {
'type:name_not_default': db_const.NAME_FIELD_SIZE}},
'tenant_id': {'allow_post': True, 'allow_put': False,
'required_by_policy': True,
'is_sort_key': True,
'validate': {
'type:string': db_const.PROJECT_ID_FIELD_SIZE},
'is_visible': True, 'is_filter': True},
@@ -239,39 +242,42 @@ RESOURCE_ATTRIBUTE_MAP = {
'validate': {'type:uuid': None},
'is_visible': True,
'is_filter': True,
'is_sort_key': True,
'primary_key': True},
'security_group_id': {'allow_post': True, 'allow_put': False,
'is_visible': True, 'required_by_policy': True,
'is_filter': True},
'is_sort_key': True, 'is_filter': True},
'remote_group_id': {'allow_post': True, 'allow_put': False,
'default': None, 'is_visible': True,
'is_filter': True},
'is_sort_key': True, 'is_filter': True},
'direction': {'allow_post': True, 'allow_put': False,
'is_visible': True, 'is_filter': True,
'is_sort_key': True,
'validate': {'type:values': ['ingress', 'egress']}},
'protocol': {'allow_post': True, 'allow_put': False,
'is_visible': True, 'default': None,
'is_filter': True,
'is_sort_key': True, 'is_filter': True,
'convert_to': convert_protocol},
'port_range_min': {'allow_post': True, 'allow_put': False,
'convert_to': convert_validate_port_value,
'default': None, 'is_visible': True,
'is_filter': True},
'is_sort_key': True, 'is_filter': True},
'port_range_max': {'allow_post': True, 'allow_put': False,
'convert_to': convert_validate_port_value,
'default': None, 'is_visible': True,
'is_filter': True},
'is_sort_key': True, 'is_filter': True},
'ethertype': {'allow_post': True, 'allow_put': False,
'is_visible': True, 'default': 'IPv4',
'is_filter': True,
'is_filter': True, 'is_sort_key': True,
'convert_to': convert_ethertype_to_case_insensitive,
'validate': {'type:values': sg_supported_ethertypes}},
'remote_ip_prefix': {'allow_post': True, 'allow_put': False,
'default': None, 'is_visible': True,
'is_filter': True,
'is_sort_key': True, 'is_filter': True,
'convert_to': convert_ip_prefix_to_cidr},
'tenant_id': {'allow_post': True, 'allow_put': False,
'required_by_policy': True,
'is_sort_key': True,
'validate': {
'type:string': db_const.PROJECT_ID_FIELD_SIZE},
'is_visible': True, 'is_filter': True},

+ 7
- 0
neutron/extensions/segment.py View File

@@ -45,17 +45,20 @@ RESOURCE_ATTRIBUTE_MAP = {
'allow_put': False,
'validate': {'type:uuid': None},
'is_filter': True,
'is_sort_key': True,
'is_visible': True,
'primary_key': True},
'tenant_id': {'allow_post': True,
'allow_put': False,
'validate': {'type:string':
db_const.PROJECT_ID_FIELD_SIZE},
'is_sort_key': True,
'is_visible': False},
'network_id': {'allow_post': True,
'allow_put': False,
'validate': {'type:uuid': None},
'is_filter': True,
'is_sort_key': True,
'is_visible': True},
PHYSICAL_NETWORK: {'allow_post': True,
'allow_put': False,
@@ -63,23 +66,27 @@ RESOURCE_ATTRIBUTE_MAP = {
'validate': {'type:string':
providernet.PHYSICAL_NETWORK_MAX_LEN},
'is_filter': True,
'is_sort_key': True,
'is_visible': True},
NETWORK_TYPE: {'allow_post': True,
'allow_put': False,
'validate': {'type:string':
providernet.NETWORK_TYPE_MAX_LEN},
'is_filter': True,
'is_sort_key': True,
'is_visible': True},
SEGMENTATION_ID: {'allow_post': True,
'allow_put': False,
'default': constants.ATTR_NOT_SPECIFIED,
'convert_to': converters.convert_to_int,
'is_sort_key': True,
'is_visible': True},
'name': {'allow_post': True,
'allow_put': True,
'default': constants.ATTR_NOT_SPECIFIED,
'validate': {'type:string_or_none': NAME_LEN},
'is_filter': True,
'is_sort_key': True,
'is_visible': True}
},
subnet_def.COLLECTION_NAME: {

+ 3
- 3
neutron/tests/unit/extensions/test_network_segment_range.py View File

@@ -313,7 +313,7 @@ class TestNetworkSegmentRange(NetworkSegmentRangeTestBase):
name='foo-range2', physical_network='phys_net2')
self._test_list_with_sort('network-segment-range',
(range2, range1),
[('physical_network', 'desc')])
[('name', 'desc')])

def test_list_network_segment_ranges_with_pagination(self):
range1 = self._test_create_network_segment_range(
@@ -325,7 +325,7 @@ class TestNetworkSegmentRange(NetworkSegmentRangeTestBase):
self._test_list_with_pagination(
'network-segment-range',
(range1, range2, range3),
('physical_network', 'asc'), 2, 2)
('name', 'asc'), 2, 2)

def test_list_network_segment_ranges_with_pagination_reverse(self):
range1 = self._test_create_network_segment_range(
@@ -337,7 +337,7 @@ class TestNetworkSegmentRange(NetworkSegmentRangeTestBase):
self._test_list_with_pagination_reverse(
'network-segment-range',
(range1, range2, range3),
('physical_network', 'asc'), 2, 2)
('name', 'asc'), 2, 2)

def test_delete_network_segment_range(self):
network_segment_range = self._test_create_network_segment_range()

Loading…
Cancel
Save