It is assumed that OpenStack is already installed. CentOS7 + RDO(All-in-one)
python-install neutron client #pip install python-neutronclient
Since it is necessary to tell the program the IP or eye path of the neutron server, set it in the environment variable. Same as "keystonerc_XX" created during installation.
export OS_USERNAME=XXXX export OS_TENANT_NAME=XXXXX export OS_PASSWORD=XXXXX export OS_AUTH_URL=http://172.19.60.93:5000/v2.0/ export OS_REGION_NAME=RegionOne
As documented.
from os import environ
from neutronclient.v2_0 import client
neutron = client.Client(
auth_url=environ['OS_AUTH_URL'],
username=environ['OS_USERNAME'],
password=environ['OS_PASSWORD'],
tenant_name=environ['OS_TENANT_NAME'],
region_name=environ['OS_REGION_NAME'])
list is a display system
#Display Version
print neutron.version
#View security group
print neutron.list_security_groups()
#Display security group (display only specific group)
print neutron.show_security_group("XXXXXX")
#There are many
print dir(neutron)
http://docs.openstack.org/user-guide/enduser/sdk.html
Recommended Posts