<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body style='font-family: Verdana,Geneva,sans-serif'>
<p>I'm sure the Documentation team would love to hear from you: https://wiki.openstack.org/wiki/Documentation</p>
<p>-Ben</p>
<p>On 2014-02-09 23:24, Rajdeep Dua wrote:</p>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<div style="color: #000; background-color: #fff; font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 10pt;">
<div><span>Yes, We would be interested in doing that.</span></div>
<div style="color: #000000; font-size: 13px; font-family: HelveticaNeue,; background-color: transparent; font-style: normal;">Please let me know which is the right group/ team for this?</div>
<div style="color: #000000; font-size: 13px; font-family: HelveticaNeue,; background-color: transparent; font-style: normal;"> </div>
<div style="color: #000000; font-size: 13px; font-family: HelveticaNeue,; background-color: transparent; font-style: normal;"> </div>
<div class="yahoo_quoted" style="display: block;"><br /><br />
<div style="font-family: HelveticaNeue,; font-size: 10pt;">
<div style="font-family: HelveticaNeue,; font-size: 12pt;">
<div dir="ltr"><span style="font-family: Arial; font-size: small;"> On Monday, February 10, 2014 10:34 AM, "Collins, Sean" <Sean_Collins2@cable.comcast.com> wrote:<br /></span></div>
<div class="y_msg_container">
<div id="yiv9101109076">
<div>
<div style="direction: ltr; font-family: Tahoma; color: #000000; font-size: 10pt;">Do you have plans to submit these back upstream? It would be a great first start, perhaps we could add these as examples underneath the JSON request/reponse in http://api.openstack.org/api-ref-networking.html<br clear="none" />
<div><br clear="none" />
<div style="font-family: Tahoma; font-size: 13px;">Sean M. Collins</div>
</div>
<div id="yiv9101109076yqt90377" class="yiv9101109076yqt8517478834">
<div style="color: #000000; font-size: 16px;"><hr />
<div id="yiv9101109076divRpF258394" style="direction: ltr;"><span style="color: #000000; font-family: Tahoma; font-size: small;"><strong>From:</strong> Rajdeep Dua [dua_rajdeep@yahoo.com]<br clear="none" /><strong>Sent:</strong> Saturday, February 08, 2014 11:10 PM<br clear="none" /><strong>To:</strong> OpenStack Development Mailing List (not for usage questions)<br clear="none" /><strong>Subject:</strong> Re: [openstack-dev] [Neutron] Using Python-Neutronclient from Python - docstrings needed?<br clear="none" /></span></div>
<div> </div>
<div>
<div style="color: #000000; background-color: #ffffff; font-family: HelveticaNeue,; font-size: 10pt;">
<div><span>Sean,</span></div>
<div style="color: #000000; font-size: 13px; font-family: HelveticaNeue,; background-color: transparent; font-style: normal;"><span>We have written a few docs for writing these samples</span></div>
<div style="color: #000000; font-size: 13px; font-family: HelveticaNeue,; background-color: transparent; font-style: normal;"><span> </span></div>
<div style="background-color: transparent;"><span>http://python-api-guide.cfapps.io/content/neutron.html<br clear="none" /></span></div>
<div style="background-color: transparent; color: #000000; font-size: 13px; font-family: HelveticaNeue,; font-style: normal;"><span> </span></div>
<div style="background-color: transparent; color: #000000; font-size: 13px; font-family: HelveticaNeue,; font-style: normal;"><span>You can find get the source here https://github.com/rajdeepd/openstack-samples</span></div>
<div style="background-color: transparent; color: #000000; font-size: 13px; font-family: HelveticaNeue,; font-style: normal;"><span> </span></div>
<div style="background-color: transparent; color: #000000; font-size: 13px; font-family: HelveticaNeue,; font-style: normal;"><span>Thanks</span></div>
<div style="background-color: transparent; color: #000000; font-size: 13px; font-family: HelveticaNeue,; font-style: normal;">Rajdeep</div>
<div class="yiv9101109076yahoo_quoted" style="display: block;"><br clear="none" /><br clear="none" />
<div style="font-family: HelveticaNeue,; font-size: 10pt;">
<div style="font-family: HelveticaNeue,; font-size: 12pt;">
<div dir="ltr"><span style="font-family: Arial; font-size: small;">On Sunday, February 9, 2014 12:57 AM, "Collins, Sean" <Sean_Collins2@cable.comcast.com> wrote:<br clear="none" /></span></div>
<div class="yiv9101109076y_msg_container">Hi,<br clear="none" /><br clear="none" /> I was writing a small script yesterday to parse a list of IP blocks and<br clear="none" /> create security groups and rules, by using python-neutronclient.<br clear="none" /><br clear="none" /> To be honest, it was very difficult - even though I have actually<br clear="none" /> written extensions to Python-Neutronclient for the QoS API. <br clear="none" /><br clear="none" /> For those that are trying to use the client from inside their code,<br clear="none" /> they end up getting zero help as to how to actually call any of the<br clear="none" /> functions, and what parameters they take. <br clear="none" /><br clear="none" /><br clear="none" />     >>> neutron = client.Client('2.0', auth_url=os.environ['OS_AUTH_URL'],<br clear="none" />     ...                            tenant_id=os.environ['OS_TENANT_ID'],<br clear="none" />     ...                            username=os.environ['OS_USERNAME'],<br clear="none" />     ...                            password=os.environ['OS_PASSWORD'])<br clear="none" />     >>> help(neutron)<br clear="none" /><br clear="none" />   |  create_credential = <function with_params><br clear="none" />   |  <br clear="none" />   |  create_firewall = <function with_params><br clear="none" />   |  <br clear="none" />   |  create_firewall_policy = <function with_params><br clear="none" />   |  <br clear="none" />   |  create_firewall_rule = <function with_params><br clear="none" />   |  <br clear="none" />   |  create_floatingip = <function with_params><br clear="none" />   |  <br clear="none" />   |  create_health_monitor = <function with_params><br clear="none" />   |  <br clear="none" />   |  create_ikepolicy = <function with_params><br clear="none" />   |  <br clear="none" />   |  create_ipsec_site_connection = <function with_params><br clear="none" />   |  <br clear="none" />   |  create_ipsecpolicy = <function with_params><br clear="none" />   |  <br clear="none" />   |  create_member = <function with_params><br clear="none" />   |  <br clear="none" />   |  create_metering_label = <function with_params><br clear="none" /><br clear="none" /><br clear="none" /> Since there was nothing there, I decided to go check the source of<br clear="none" /> python-neutronclient and see if there are any examples.<br clear="none" /><br clear="none" /><a href="https://github.com/openstack/python-neutronclient/blob/master/doc/source/index.rst" shape="rect">https://github.com/openstack/python-neutronclient/blob/master/doc/source/index.rst</a><br clear="none" /><br clear="none" /> If you read closely enough, you'll find out that the function takes a<br clear="none" /> dictionary, that looks very similar to the request/response examples<br clear="none" /> listed in the API documentation. So, I went over and checked it out.<br clear="none" /><br clear="none" /><a href="http://docs.openstack.org/api/openstack-network/2.0/content/POST_security-groups-v2.0_createSecGroup_v2.0_security-groups_security-groups-ext.html" shape="rect">http://docs.openstack.org/api/openstack-network/2.0/content/POST_security-groups-v2.0_createSecGroup_v2.0_security-groups_security-groups-ext.html</a><br clear="none" /><br clear="none" /> So from there, I was able to remember enough that each of these<br clear="none" /> functions takes a single argument, that is a dictionary, that mimics<br clear="none" /> the same structure that you see in the API documentation, so from there<br clear="none" /> it was just some experimentation to get the structure right.<br clear="none" /><br clear="none" /> Honestly it wasn't easy to remember all this stuff, since<br clear="none" /> it had been a couple months since I had worked with<br clear="none" /> python-neutronclient, and it had been from inside the library itself.<br clear="none" /><br clear="none" /> This was my first experience using it "on the outside" and it was pretty<br clear="none" /> tough - so I'm going to try and look into how we can improve the<br clear="none" /> docstrings for the client object, to make it a bit easier to figure out.<br clear="none" /><br clear="none" /> Thoughts?<br clear="none" /><br clear="none" /> -- <br clear="none" /> Sean M. Collins<br clear="none" /> _______________________________________________<br clear="none" /> OpenStack-dev mailing list<br clear="none" /><a href="mailto:OpenStack-dev@lists.openstack.org" shape="rect">OpenStack-dev@lists.openstack.org</a><br clear="none" /><a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" shape="rect">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br clear="none" /><br clear="none" /><br clear="none" /></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br /><br /></div>
</div>
</div>
</div>
</div>
<!-- html ignored --><br />
<pre>_______________________________________________
OpenStack-dev mailing list
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a>
</pre>
</blockquote>
<p> </p>
<div> </div>
</body></html>