<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi Paul,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Please be aware that there was also change in nova to support ovs_hybrid_plug:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><a href="https://review.openstack.org/#/c/83190/">https://review.openstack.org/#/c/83190/</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I am not sure, but maybe worth to check nova code and nova.conf  you are using to be aligned with neutron code.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hope it helps,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Irena<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Paul Michali (pcm) [mailto:pcm@cisco.com]
<br>
<b>Sent:</b> Saturday, March 29, 2014 1:17 AM<br>
<b>To:</b> openstack-dev@lists.openstack.org<br>
<b>Subject:</b> [openstack-dev] [Neutron] Problem plugging I/F into Neutron...<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi, <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I have a VM that I start up outside of OpenStack (as a short term solution, until we get it working inside a Nova VM), using KVM. It has scrips associated with the three interfaces that are created, to hook this VM into Neutron. One I/F
 is on br-ex (connected to the “public" network for DevStack), another to br-int (connected to a management network that is created), and a third is connected to br-int (connected to the “private” network for DevStack). It’s understood these are hacks to get
 things going and can be brittle.  With DevStack, I have a vanilla localrc, so using ML2, without any ML2 settings specified.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Now, the first two scripts use internal Neutron client calls to create the port, and then plug the VIF. The third, uses Neutron to create the port, and then Nova to plug the VIF. I don’t know why - I inherited the scripts.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">On one system, where Nova is based on commit b3e2e05 (10 days ago), this all works just peachy. Interfaces are hooked in and I can ping to my hearts content. On another system, that I just reimaged today, using the latest and greatest OpenStack
 projects, the third script fails.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I talked to Nova folks, and the vic is now an object, instead of a plain dict, and therefore calls on the object fail (as the script just provides a dict). I started trying to convert the vif to an object, but in discussing with a co-worker,
 we thought that we could too use Neutron calls for all of the setup of this third interface.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Well, I tried, and the port is created, but unlike the other system, the port is DOWN, and I cannot ping to or from it (the other ports still work fine, with this newer OpenStack repo). One difference is that the port is showing  {"port_filter":
 true, "ovs_hybrid_plug": true} for binding:vif_details, in the neutron port-show output. On the older system this is empty (so must be new changes in Neutron?)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Here is the Neutron based code (trimmed) to do the create and plugging:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">import neutron.agent.linux.interface as vif_driver<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">from neutronclient.neutron import client as qclient<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">qc = qclient.Client('2.0', auth_url=KEYSTONE_URL, username=user, tenant_name=tenant, password=pw)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">prefix, net_name = interface.split('__')<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">port_name = net_name + '_p'<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">try:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">    nw_id = qc.list_networks(name=net_name)['networks'][0]['id']<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">except qcexp.NeutronClientException as e:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">    …<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">p_spec = {'port': {'admin_state_up': True,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">                   'name': port_name,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">                   'network_id': nw_id,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">                   'mac_address': mac_addr,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">                   'binding:host_id': hostname,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">                   'device_id': vm_uuid,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">                   'device_owner': 'compute:None'}}<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">try:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">    port = qc.create_port(p_spec)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">except qcexp.NeutronClientException as e:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">    ...<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">port_id = port['port']['id']<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">br_name = 'br-int'<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">conf = cfg.CONF<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">config.register_root_helper(conf)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">conf.register_opts(vif_driver.OPTS)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">driver = vif_driver.OVSInterfaceDriver(cfg.CONF)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">driver.plug(nw_id, port_id, interface, mac_addr, br_name)<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Finally, here are the questions (hope you stuck with the long message)…<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><b>Any idea why the neutron version is not working?</b> I know there were a bunch of recent changes.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>Is there a way for me to turn off the ova_hybrid_plug and port_filter flags? Should I?</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>Should I go back to using Nova and build a VIF object?</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>If so, any reason why the Neutron version would not work?</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>Is there a way to do a similar thing, but via using Northbound APIs (so it isn’t as brittle)?</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks in advance!<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">PCM (Paul Michali)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">MAIL …..…. <a href="mailto:pcm@cisco.com">pcm@cisco.com</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">IRC ……..… pcm_ (<a href="http://irc.freenode.com">irc.freenode.com</a>)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">TW ………... @pmichali<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">GPG Key … 4525ECC253E31A83<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Fingerprint .. 307A 96BB 1A4C D2C7 931D 8D2D 4525 ECC2 53E3 1A83<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>