raise c_exc.PolicyProfileIdNotFound(profile_id=id)
- def create_profile_binding(tenant_id, profile_id, profile_type):
+ def create_profile_binding(db_session, tenant_id, profile_id, profile_type):
"""Create Network/Policy Profile association with a tenant."""
+ db_session = db_session or db.get_session()
if profile_type not in ["network", "policy"]:
- raise q_exc.NeutronException(_("Invalid profile type"))
+ raise n_exc.NeutronException(_("Invalid profile type"))
- if _profile_binding_exists(tenant_id, profile_id, profile_type):
- return get_profile_binding(tenant_id, profile_id)
+ if _profile_binding_exists(db_session,
+ tenant_id,
+ profile_id,
+ profile_type):
+ return get_profile_binding(db_session, tenant_id, profile_id)
- db_session = db.get_session()
with db_session.begin(subtransactions=True):
binding = n1kv_models_v2.ProfileBinding(profile_type=profile_type,
profile_id=profile_id,