def add_private_net(self, tenant_id=None, auth_token=None, user_name=None): from trove.patch.vip.models import DBPrivateNet if tenant_id is None or auth_token is None or user_name is None: raise Exception("tenant_id: %s, auth_token: %s, user_name: %s" % (tenant_id, auth_token, user_name)) self.db_api.configure_db(CONF) try: DBPrivateNet.create(tenant_id=str(tenant_id).strip(), auth_token=str(auth_token).strip(), user_name=str(user_name).strip()) except Exception as ex: print "add_private_net failed, tenant_id: %s, auth_token: %s, user_name: %s, ex: %s" \ % (tenant_id, auth_token, user_name, ex) else: print "add_private_net finished, tenant_id: %s, auth_token: %s, user_name: %s" \ % (tenant_id, auth_token, user_name)