Neutron

class playback.neutron.Neutron(user='ubuntu', hosts=None, key_filename=None, password=None, parallel=True, *args, **kwargs)

Bases: playback.common.Common

Deploy neutron

Parameters:
  • user(str) – the user for remote server to login
  • hosts(list) – this is a second param
  • key_filename(str) – the ssh private key to used, default None
  • password(str) – the password for remote server
  • parallel(bool) – paralleler execute on remote server, default True
Returns:

None

Examples:
# create neutron instances
neutron1 = Neutron(
    user='ubuntu',
    hosts=['controller1']
)
neutron2 = Neutron(
    user='ubuntu',
    hosts=['controller2']
)

# create neutron database
neutron1.create_neutron_db(
    root_db_pass='changeme',
    neutron_db_pass='changeme'
)

# create service credentials
neutron1.create_service_credentials(
    os_password='changeme',
    os_auth_url='http://192.168.1.1:35357/v3',
    neutron_pass='changeme',
    public_endpoint='http://192.168.1.1:9696',
    internal_endpoint='http://192.168.1.1:9696',
    admin_endpoint='http://192.168.1.1:9696'
)

# install neutron for self-service
neutron1.install_self_service(
    connection='mysql+pymysql://neutron:changeme@192.168.1.1/neutron',
    rabbit_hosts='controller1,controller2',
    rabbit_user='openstack',
    rabbit_pass='changeme',
    auth_uri='http://192.168.1.1:5000',
    auth_url='http://192.168.1.1:35357',
    neutron_pass='changeme',
    nova_url='http://192.168.1.1:8774/v2.1',
    nova_pass='changeme',
    public_interface='eth1',
    local_ip='192.168.1.2',
    nova_metadata_ip='192.168.1.1',
    metadata_proxy_shared_secret='changeme-changeme-changeme-changeme',
    memcached_servers='controller1:11211,controller2:11211'
    populate=True
)
neutron2.install_self_service(
    connection='mysql+pymysql://neutron:changeme@192.168.1.1/neutron',
    rabbit_hosts='controller1,controller2',
    rabbit_user='openstack',
    rabbit_pass='changeme',
    auth_uri='http://192.168.1.1:5000',
    auth_url='http://192.168.1.1:35357',
    neutron_pass='changeme',
    nova_url='http://192.168.1.1:8774/v2.1',
    nova_pass='changeme',
    public_interface='eth1',
    local_ip='192.168.1.3',
    nova_metadata_ip='192.168.1.1',
    metadata_proxy_shared_secret='changeme-changeme-changeme-changeme',
    memcached_servers='controller1:11211,controller2:11211'
)
create_neutron_db(*args, **kwargs)

Create the neutron database and the user named neutron

Parameters:
  • root_db_pass – the password of openstack database root user
  • neutron_db_pass – the password of neutron database user
Returns:

None

create_service_credentials(*args, **kwargs)

create the neutron service credentials

Parameters:
  • os_password – the password of openstack admin user
  • os_auth_url – keystone endpoint url e.g. http://CONTROLLER_VIP:35357/v3
  • neutron_pass – the password of neutron user
  • public_endpoint – public endpoint for neutron service e.g. http://CONTROLLER_VIP:9696
  • internal_endpoint – internal endpoint for neutron service e.g. http://CONTROLLER_VIP:9696
  • admin_endpoint – admin endpoint for neutron service e.g. http://CONTROLLER_VIP:9696
Returns:

None

install_self_service(*args, **kwargs)

Install neutron for self-service

Parameters:
  • connection – The SQLAlchemy connection string to use to connect to the database. (string value) e.g. mysql+pymysql://neutron:NEUTRON_PASS@CONTROLLER_VIP/neutron
  • rabbit_hosts – RabbitMQ HA cluster host:port pairs. (list value) e.g. CONTROLLER1,CONTROLLER2
  • rabbit_user – The RabbitMQ userid. (string value) e.g. openstack
  • rabbit_pass – The RabbitMQ password. (string value)
  • auth_uri – Complete public Identity API endpoint. (string value) e.g. http://CONTROLLER_VIP:5000
  • auth_url – keystone admin endpoint e.g. http://CONTROLLER_VIP:35357
  • neutron_pass – the password of neutron user
  • nova_url – URL for connection to nova (Only supports one nova region currently) e.g. http://CONTROLLER_VIP:8774/v2.1
  • nova_pass – passowrd of nova user
  • public_interface – public interface e.g. eth1
  • local_ip – underlying physical network interface that handles overlay networks(uses the management interface IP) (ip address value)
  • nova_metadata_ip – IP address used by Nova metadata server. (string value) e.g. CONTROLLER_VIP
  • metadata_proxy_shared_secret – When proxying metadata requests, Neutron signs the Instance-ID header with a shared secret to prevent spoofing. You may select any string for a secret, but it must match here and in the configuration used by the Nova Metadata Server. NOTE: Nova uses the same config key, but in [neutron] section. (string value)
  • memcached_servers – Optionally specify a list of memcached server(s) to use for caching. (list value) e.g. CONTROLLER1:11211,CONTROLLER2:11211
  • populate – populate the neutron database
Returns:

None