def add_credential(tenant_id, credential_name, user_name, password):
 session = db.get_session()
 try:
  cred = session.query(network_models_v2.Credential).filter_by(tenant_id=tenant_id).filter_by(credential_name=credential_name).one()
  raise c_exc.CredentialAlreadyExists(credential_name=credential_name, tenant_id=tenant_id)
 except exc.NoResultFound:
  cred = network_models_v2.Credential(tenant_id, credential_name, user_name, password)
  session.add(cred)
  session.flush()
  return cred

def add_credential ( tenant_id , credential_name , user_name , password ) : session = db . get_session ( ) try : cred = session . query ( network_models_v2 . Credential ) . filter_by ( tenant_id = tenant_id ) . filter_by ( credential_name = credential_name ) . one ( ) raise c_exc . CredentialAlreadyExists ( credential_name = credential_name , tenant_id = tenant_id ) except exc . NoResultFound : cred = network_models_v2 . Credential ( tenant_id , credential_name , user_name , password ) session . add ( cred ) session . flush ( ) return cred
adds a qos to tenant association .