Esempio n. 1
0
    def get_security_groups(self,
                            context,
                            filters=None,
                            fields=None,
                            sorts=None,
                            limit=None,
                            marker=None,
                            page_reverse=False,
                            default_sg=False):

        # If default_sg is True do not call _ensure_default_security_group()
        # so this can be done recursively. Context.tenant_id is checked
        # because all the unit tests do not explicitly set the context on
        # GETS. TODO(arosen)  context handling can probably be improved here.
        if not default_sg and context.tenant_id:
            tenant_id = filters.get('tenant_id')
            if tenant_id:
                tenant_id = tenant_id[0]
            else:
                tenant_id = context.tenant_id
            self._ensure_default_security_group(context, tenant_id)
        marker_obj = db_utils.get_marker_obj(self, context, 'security_group',
                                             limit, marker)
        return model_query.get_collection(context,
                                          sg_models.SecurityGroup,
                                          self._make_security_group_dict,
                                          filters=filters,
                                          fields=fields,
                                          sorts=sorts,
                                          limit=limit,
                                          marker_obj=marker_obj,
                                          page_reverse=page_reverse)
Esempio n. 2
0
 def get_network_gateways(self, context, filters=None, fields=None,
                          sorts=None, limit=None, marker=None,
                          page_reverse=False):
     marker_obj = db_utils.get_marker_obj(self,
         context, 'network_gateway', limit, marker)
     return model_query.get_collection(context, nsx_models.NetworkGateway,
                                       self._make_network_gateway_dict,
                                       filters=filters, fields=fields,
                                       sorts=sorts, limit=limit,
                                       marker_obj=marker_obj,
                                       page_reverse=page_reverse)
Esempio n. 3
0
 def _query_gateway_devices(self, context,
                            filters=None, sorts=None,
                            limit=None, marker=None,
                            page_reverse=None):
     marker_obj = db_utils.get_marker_obj(self,
         context, 'gateway_device', limit, marker)
     return self._get_collection_query(context,
                                       nsx_models.NetworkGatewayDevice,
                                       filters=filters,
                                       sorts=sorts,
                                       limit=limit,
                                       marker_obj=marker_obj,
                                       page_reverse=page_reverse)
Esempio n. 4
0
 def _get_subnets(self, context, filters=None, fields=None,
                  sorts=None, limit=None, marker=None,
                  page_reverse=False):
     marker_obj = db_utils.get_marker_obj(self, context, 'subnet',
                                          limit, marker)
     make_subnet_dict = functools.partial(self._make_subnet_dict,
                                          context=context)
     return model_query.get_collection(context, models_v2.Subnet,
                                       make_subnet_dict,
                                       filters=filters, fields=fields,
                                       sorts=sorts,
                                       limit=limit,
                                       marker_obj=marker_obj,
                                       page_reverse=page_reverse)
 def _get_subnets(self, context, filters=None, fields=None,
                  sorts=None, limit=None, marker=None,
                  page_reverse=False):
     marker_obj = db_utils.get_marker_obj(self, context, 'subnet',
                                          limit, marker)
     make_subnet_dict = functools.partial(self._make_subnet_dict,
                                          context=context)
     return model_query.get_collection(context, models_v2.Subnet,
                                       make_subnet_dict,
                                       filters=filters, fields=fields,
                                       sorts=sorts,
                                       limit=limit,
                                       marker_obj=marker_obj,
                                       page_reverse=page_reverse)
Esempio n. 6
0
 def get_routers(self, context, filters=None, fields=None,
                 sorts=None, limit=None, marker=None,
                 page_reverse=False):
     marker_obj = db_utils.get_marker_obj(self, context, 'router',
                                          limit, marker)
     routers_db = model_query.get_collection(context, l3_db.Router,
                                             dict_func=None,
                                             filters=filters,
                                             fields=fields,
                                             sorts=sorts,
                                             limit=limit,
                                             marker_obj=marker_obj,
                                             page_reverse=page_reverse)
     return self._make_routers_dict(routers_db, fields)
Esempio n. 7
0
 def get_security_group_rules(self,
                              context,
                              filters=None,
                              fields=None,
                              sorts=None,
                              limit=None,
                              marker=None,
                              page_reverse=False):
     marker_obj = db_utils.get_marker_obj(self, context,
                                          'security_group_rule', limit,
                                          marker)
     return model_query.get_collection(context,
                                       sg_models.SecurityGroupRule,
                                       self._make_security_group_rule_dict,
                                       filters=filters,
                                       fields=fields,
                                       sorts=sorts,
                                       limit=limit,
                                       marker_obj=marker_obj,
                                       page_reverse=page_reverse)
 def _get_marker_obj(self, context, resource, limit, marker):
     return ndb_utils.get_marker_obj(self, context, resource, limit, marker)
Esempio n. 9
0
 def _get_marker_obj(self, context, resource, limit, marker):
     return ndb_utils.get_marker_obj(self, context, resource, limit, marker)