Able to search catalog
This commit is contained in:
parent
581b605b0e
commit
74ebac01fd
6
main.py
6
main.py
|
@ -11,9 +11,9 @@ x.keystone.getCatalog()
|
||||||
|
|
||||||
# print (x.keystone.catalogData)
|
# print (x.keystone.catalogData)
|
||||||
|
|
||||||
neutronService=x.keystone.getServicebyName("Neutron")
|
# neutronService=x.keystone.getServicebyName("Neutron")
|
||||||
print(neutronService)
|
# print(neutronService)
|
||||||
neutronEndpointInternal=x.keystone.getEndpointByServiceIDAndInterface(neutronService['id'],"internal")
|
neutronEndpointInternal=x.keystone.getEndpointByNameIDAndInterface("NeuTrOn","internal")
|
||||||
print(neutronEndpointInternal)
|
print(neutronEndpointInternal)
|
||||||
|
|
||||||
# token = ng_openstack.auth.getToken(os.getenv("OS_USERNAME"), os.getenv("OS_PASSWORD"),
|
# token = ng_openstack.auth.getToken(os.getenv("OS_USERNAME"), os.getenv("OS_PASSWORD"),
|
||||||
|
|
|
@ -47,8 +47,16 @@ class Openstack_Keystone():
|
||||||
|
|
||||||
|
|
||||||
def getEndpointByServiceIDAndInterface(_self,id,interface):
|
def getEndpointByServiceIDAndInterface(_self,id,interface):
|
||||||
for _endpoint in _self.catalogData['endpoints']:
|
for _endpoint in _self.catalogData['endpoints']:
|
||||||
if str(_endpoint['service_id']).lower()==str(id).lower():
|
if str(_endpoint['service_id']).lower()==str(id).lower():
|
||||||
if str(_endpoint['interface']).lower()==str(interface).lower():
|
if str(_endpoint['interface']).lower()==str(interface).lower():
|
||||||
# print(_endpoint)
|
# print(_endpoint)
|
||||||
return(_endpoint)
|
return(_endpoint)
|
||||||
|
|
||||||
|
def getEndpointByNameIDAndInterface(_self,name,interface):
|
||||||
|
serviceID=_self.getServicebyName(name)['id']
|
||||||
|
for _endpoint in _self.catalogData['endpoints']:
|
||||||
|
if str(_endpoint['service_id']).lower()==str(id).lower():
|
||||||
|
if str(_endpoint['interface']).lower()==str(interface).lower():
|
||||||
|
# print(_endpoint)
|
||||||
|
return(_endpoint)
|
Loading…
Reference in New Issue