Ask Your Question
0

Request payload list for OpenStack SDK

asked 2015-12-21 04:06:06 -0500

Randomly Named User gravatar image

Is there any place where I can get the parameters required in the request body while creating any entity using OpenStack SDK?

For example,

pool_body = {'pool': {'name':"pool3", 'lb_method':"ROUND_ROBIN", 'protocol':"HTTP", 'subnet_id':"d8f55c36-71a4-4e7b-806b-8751ebca0131"}}
created_pool = neutron.create_pool(body=pool_body)

Where do I get the complete list of possible parameters in the request body to create a pool / create a vip / create a member / or create anything at all?

I've looked http://developer.openstack.org/api-ref-networking-v2.html (here), where some parameters are mentioned, but not all.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2016-01-04 15:24:08 -0500

rtheis gravatar image

Each resource within the OpenStack SDK has a set of properties that can be used when creating a resource.

For example:

example_network = conn.network.create_network(
    name='openstacksdk-example-project-network')

example_subnet = conn.network.create_subnet(
    name='openstacksdk-example-project-subnet',
    network_id=example_network.id,
    ip_version='4',
    cidr='10.0.2.0/24',
    gateway_ip='10.0.2.1')

Also as you've noted in the question, you can review the OpenStack API documentation for the possible parameters in the request body.

But as you found out, the API documentation and/or the SDK resource properties may not give you a complete list. If you are using the master branch of the code then the API documentation and the SDK code may not yet be updated to reflect recent changes. Also, there could simply be bugs with incorrect or missing information (submit bug reports to https://bugs.launchpad.net/openstack/). As a result, the most accurate information is available by looking at the neutron code (see https://github.com/openstack/neutron).

edit flag offensive delete link more

Comments

I forgot to mention that the SDK resources are for LBaaS v2 not LBaaS v1. The example in the question appears to be for LBaaS v1.

rtheis gravatar imagertheis ( 2016-01-05 11:17:35 -0500 )edit
0

answered 2015-12-29 13:18:35 -0500

This is what i have used and works for me,

pool = {'lb_method': 'ROUND_ROBIN', 'name': self.lb_pool_name, 'protocol': 'HTTP', 'description': "my lbaas pool", 'subnet_id': self.snet_id, 'provider': self.lbaas_provider, 'admin_state_up': True}

body = {'pool': pool}

Obviously you need to replace the parameters matching your environment.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2015-12-21 04:06:06 -0500

Seen: 120 times

Last updated: Dec 21 '15