Getting Attribute error while listing networks

asked 2014-11-13 02:36:57 -0600

Gaurav Suryagandh gravatar image

updated 2014-11-14 11:32:30 -0600

smaffulli gravatar image

I am new to Openstack , Following is my sample code o list all the networks available. I am facing below issue with the setup.Any help is appreciated !!

#!/usr/bin/env python
import logging
from neutronclient.neutron import client
from os import environ as env
from keystoneclient.auth.identity import v3
from keystoneclient import session
from keystoneclient.v3 import client

logging.basicConfig(level=logging.DEBUG)
auth_url = 'auth_url #(i have removed valid url'
username = 'test_user'
user_domain_name = 'test_domain'
password = 'test_password'

keystone = client.Client(auth_url=auth_url, version=(3,),username=username, password=password, project_id=env['PROJECT_ID'], project_name=env['PROJECT_NAME'])
d = keystone.get_raw_token_from_identity_service(auth_url=auth_url,username=username, password=password, tenant_name=env['PROJECT_NAME'], user_domain_name=env['DOMAIN_NAME'])
token = d['auth_token']
print token



auth = v3.Password(auth_url=auth_url,user_id=username,password=password)
neutron = client.Client(auth_url=env['OS_AUTH_URL_TOKEN'], endpoint_url=['NEUTRON_ENDPOINT'], token=token)
neutron.format = 'json'
neutron.list_networks()

Facing below issue

DEBUG:requests.packages.urllib3.connectionpool:"POST /v3/auth/tokens HTTP/1.1" 201 262
True
{'original_ip': None, 'cert': None, 'verify_cert': 'verify', 'timeout': None}
Traceback (most recent call last):
  File "./network_connection.py", line 25, in <module>
    neutron.list_networks()
  File "/usr/lib/python2.6/site-packages/keystoneclient/httpclient.py", line 660, in __getattr__
    raise AttributeError("Unknown Attribute: %s" % name)
AttributeError: Unknown Attribute: list_networks
edit retag flag offensive close merge delete