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)
|
||||
|
||||
neutronService=x.keystone.getServicebyName("Neutron")
|
||||
print(neutronService)
|
||||
neutronEndpointInternal=x.keystone.getEndpointByServiceIDAndInterface(neutronService['id'],"internal")
|
||||
# neutronService=x.keystone.getServicebyName("Neutron")
|
||||
# print(neutronService)
|
||||
neutronEndpointInternal=x.keystone.getEndpointByNameIDAndInterface("NeuTrOn","internal")
|
||||
print(neutronEndpointInternal)
|
||||
|
||||
# token = ng_openstack.auth.getToken(os.getenv("OS_USERNAME"), os.getenv("OS_PASSWORD"),
|
||||
|
|
|
@ -52,3 +52,11 @@ class Openstack_Keystone():
|
|||
if str(_endpoint['interface']).lower()==str(interface).lower():
|
||||
# print(_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