Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from keystoneauth1 import loading
- from keystoneauth1 import session
- from neutronclient.v2_0 import client
- import pymysql
- #########Database Connection##########################
- connection = pymysql.connect(host='localhost', user='root', password='Ro3118086', db='billing', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor)
- ################function to execute in SQL#################################
- project_list=[]
- def upsert_db():
- with connection.cursor() as cur:
- cur.execute("SELECT id FROM project")
- rows=cur.fetchall()
- for row in rows:
- project_list.append(row["id"])
- upsert_db()
- for this_project_id in project_list:
- #print(this_project_id)
- loader = loading.get_plugin_loader('password')
- auth = loader.load_from_options(auth_url='http://10.10.33.140:35357/v3',username='admin',password='k3st0ne2017ZEtka', project_id= this_project_id, user_domain_name='default')
- sess = session.Session(auth=auth)
- neutron = client.Client( session=sess)
- print(neutron.list_floatingips(retrieve_all=True))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement