def _get_policy_collection_for_tenant(self, db_session, model, tenant_id):
     policy_profile_ids = n1kv_db.get_profiles_for_tenant(
         db_session=db_session,
         tenant_id=tenant_id,
         profile_type=n1kv_const.POLICY)
     # get default policy profile objects
     default_pp_name = cfg.CONF.ml2_cisco_n1kv.default_policy_profile
     default_policy_profile = n1kv_db.get_policy_profile_by_name(
         default_pp_name)
     # append IDs of default policy profiles to the policy_profile_ids list
     policy_profile_ids.append(default_policy_profile.id)
     profiles = db_session.query(model).filter(model.id.in_(
         policy_profile_ids))
     return [self._make_policy_profile_dict(p) for p in profiles]
 def _get_network_collection_for_tenant(self, db_session, model, tenant_id):
     net_profile_ids = n1kv_db.get_profiles_for_tenant(
         db_session=db_session,
         tenant_id=tenant_id,
         profile_type=n1kv_const.NETWORK)
     # get default VLAN and VXLAN network profile objects
     default_vlan_profile = n1kv_db.get_network_profile_by_name(
         n1kv_const.DEFAULT_VLAN_NETWORK_PROFILE_NAME)
     default_vxlan_profile = n1kv_db.get_network_profile_by_name(
         n1kv_const.DEFAULT_VXLAN_NETWORK_PROFILE_NAME)
     # append IDs of default network profiles to the net_profile_ids list
     net_profile_ids.append(default_vlan_profile.id)
     net_profile_ids.append(default_vxlan_profile.id)
     network_profiles = (db_session.query(model).filter(model.id.in_(
         net_profile_ids)))
     return [self._make_network_profile_dict(p) for p in network_profiles]