context.session.delete(gw_db)
LOG.debug(_("Network gateway '%s' was destroyed."), id)
- def get_network_gateways(self, context, filters=None, fields=None):
+ def get_network_gateways(self, context, filters=None, fields=None,
+ sorts=None, limit=None, marker=None,
+ page_reverse=False):
+ marker_obj = self._get_marker_obj(
+ context, 'network_gateway', limit, marker)
return self._get_collection(context, NetworkGateway,
self._make_network_gateway_dict,
- filters=filters, fields=fields)
+ filters=filters, fields=fields,
+ sorts=sorts, limit=limit,
+ marker_obj=marker_obj,
+ page_reverse=page_reverse)
def connect_network(self, context, network_gateway_id,
network_mapping_info):
fields, include_nsx_id)
def get_gateway_devices(self, context, filters=None, fields=None,
- include_nsx_id=False):
+ sorts=None, limit=None, marker=None,
+ page_reverse=False, include_nsx_id=False):
+ marker_obj = self._get_marker_obj(
+ context, 'gateway_device', limit, marker)
query = self._get_collection_query(context,
NetworkGatewayDevice,
- filters=filters)
+ filters=filters,
+ fields=fields,
+ sorts=sorts,
+ limit=limit,
+ marker_obj=marker_obj,
+ page_reverse=page_reverse)
return [self._make_gateway_device_dict(row, fields, include_nsx_id)
for row in query]
except exc.NoResultFound:
raise qos.QueueNotFound(id=queue_id)
- def get_qos_queues(self, context, filters=None, fields=None):
+ def get_qos_queues(self, context, filters=None, fields=None, sorts=None,
+ limit=None, marker=None, page_reverse=False):
+ marker_obj = self._get_marker_obj(context, 'qos_queue', limit, marker)
return self._get_collection(context, QoSQueue,
self._make_qos_queue_dict,
- filters=filters, fields=fields)
+ filters=filters, fields=fields,
+ sorts=sorts, limit=limit,
+ marker_obj=marker_obj,
+ page_reverse=page_reverse)
def delete_qos_queue(self, context, queue_id):
qos_queue = self._get_qos_queue(context, queue_id)
pass
@abstractmethod
- def get_network_gateways(self, context, filters=None, fields=None):
+ def get_network_gateways(self, context, filters=None, fields=None,
+ sorts=None, limit=None, marker=None,
+ page_reverse=False):
pass
@abstractmethod
pass
@abstractmethod
- def get_gateway_devices(self, context, filters=None, fields=None):
+ def get_gateway_devices(self, context, filters=None, fields=None,
+ sorts=None, limit=None, marker=None,
+ page_reverse=False):
pass
pass
@abstractmethod
- def get_qos_queues(self, context, filters=None, fields=None):
+ def get_qos_queues(self, context, filters=None, fields=None, sorts=None,
+ limit=None, marker=None, page_reverse=False):
pass
"security-group"]
__native_bulk_support = True
+ __native_pagination_support = True
+ __native_sorting_support = True
# Map nova zones to cluster for easy retrieval
novazone_cluster_map = {}
self._extend_network_dict_provider(context, net_result)
return self._fields(net_result, fields)
- def get_networks(self, context, filters=None, fields=None):
+ def get_networks(self, context, filters=None, fields=None,
+ sorts=None, limit=None, marker=None,
+ page_reverse=False):
filters = filters or {}
with context.session.begin(subtransactions=True):
- networks = super(NsxPluginV2, self).get_networks(context, filters)
+ networks = (
+ super(NsxPluginV2, self).get_networks(
+ context, filters, fields, sorts,
+ limit, marker, page_reverse))
for net in networks:
self._extend_network_dict_provider(context, net)
return [self._fields(network, fields) for network in networks]
return super(NsxPluginV2, self).get_network_gateway(context,
id, fields)
- def get_network_gateways(self, context, filters=None, fields=None):
+ def get_network_gateways(self, context, filters=None, fields=None,
+ sorts=None, limit=None, marker=None,
+ page_reverse=False):
# Ensure the default gateway in the config file is in sync with the db
self._ensure_default_network_gateway()
# Ensure the tenant_id attribute is populated on returned gateways
- net_gateways = super(NsxPluginV2,
- self).get_network_gateways(context,
- filters,
- fields)
- return net_gateways
+ return super(NsxPluginV2, self).get_network_gateways(
+ context, filters, fields, sorts, limit, marker, page_reverse)
def update_network_gateway(self, context, id, network_gateway):
# Ensure the default gateway in the config file is in sync with the db
"lbaas",
"vpnaas"
])
+ # The service plugin cannot currently support pagination
+ __native_pagination_support = False
+ __native_sorting_support = False
def __init__(self):
super(NsxAdvancedPlugin, self).__init__()
with self._network_gateway(name='test_gw_2') as gw2:
req = self.new_list_request(networkgw.NETWORK_GATEWAYS)
res = self.deserialize('json', req.get_response(self.ext_api))
+ # Ensure we always get the list in the same order
+ gateways = sorted(
+ res[self.gw_resource + 's'], key=lambda k: k['name'])
+ self.assertEqual(len(gateways), 3)
# We expect the default gateway too
- key = self.gw_resource + 's'
- self.assertEqual(len(res[key]), 3)
- self.assertEqual(res[key][0]['default'],
- True)
- self.assertEqual(res[key][1]['name'],
+ self.assertEqual(gateways[0]['default'], True)
+ self.assertEqual(gateways[1]['name'],
gw1[self.gw_resource]['name'])
- self.assertEqual(res[key][2]['name'],
+ self.assertEqual(gateways[2]['name'],
gw2[self.gw_resource]['name'])
def test_list_network_gateway_with_multiple_connections(self):