<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px;">
<div>
<div style="font-family: Calibri, sans-serif;">Hi Brent,</div>
<div style="font-family: Calibri, sans-serif;"><br>
</div>
<div style="font-family: Calibri, sans-serif;">I managed to do this by creating the port first, and then associating it with the instance:</div>
<div style="font-family: Calibri, sans-serif;"><br>
</div>
<div>
<div><font face="Courier">instance0_port0:</font></div>
<div><font face="Courier">    type: OS::Neutron::Port</font></div>
<div><font face="Courier">    properties:</font></div>
<div><font face="Courier">      admin_state_up: true</font></div>
<div><font face="Courier">      network_id: e0be3064-2011-4d92-b73c-5c4c6825b0c1</font></div>
<div><font face="Courier">      security_groups:</font></div>
<div><font face="Courier">        - 0875fe40-c509-44bf-ac68-e9a4795a64c6</font></div>
</div>
<div><font face="Courier"><br>
</font></div>
<div>
<div><font face="Courier">instance0:</font></div>
<div><font face="Courier">    type: OS::Nova::Server</font></div>
<div><font face="Courier">    properties:</font></div>
<div><font face="Courier">      image: 1499479f-80d9-4f39-9129-eec7b6c8d976</font></div>
<div><font face="Courier">      flavor: m1.tiny</font></div>
<div><font face="Courier">      config_drive: true</font></div>
<div><font face="Courier">      networks:</font></div>
<div><font face="Courier">        - port: { get_resource: instance0_port0 }</font></div>
</div>
<div style="font-family: Calibri, sans-serif;"><br>
</div>
<div style="font-family: Calibri, sans-serif;">You should be able to then use get_attr in your template to get characteristics of the port:</div>
<div style="font-family: Calibri, sans-serif;"><br>
</div>
<div><font face="Courier">get_attr: [instance0_port0, fixed_ips, 0, ip_address] </font>
<font face="Calibri">-or-</font></div>
<div><font face="Courier">get_attr: [instance0_port0, fixed_ips, 0, mac_address]</font></div>
<div><font face="Courier"><br>
</font></div>
<div><font face="Courier"><br>
</font></div>
<div><font face="Calibri">Hope that helps.</font></div>
</div>
<div><font face="Calibri"><br>
</font></div>
<div><font face="Calibri">James</font></div>
<div style="font-family: Calibri, sans-serif;"><br>
</div>
<span id="OLK_SRC_BODY_SECTION" style="font-family: Calibri, sans-serif;">
<div style="font-family:Calibri; font-size:12pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Brent Troge <<a href="mailto:brenttroge2016@gmail.com">brenttroge2016@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Thursday, March 24, 2016 at 2:44 PM<br>
<span style="font-weight:bold">To: </span>"<a href="mailto:openstack@lists.openstack.org">openstack@lists.openstack.org</a>" <<a href="mailto:openstack@lists.openstack.org">openstack@lists.openstack.org</a>><br>
<span style="font-weight:bold">Subject: </span>[Openstack] Neutron Provider Networks Without DHCP<br>
</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div><br>
</div>
Using HEAT, I am creating VM instances against a neutron provider network that does not<br>
</div>
supply DHCP services. <br>
<br>
</div>
Still using HEAT, any ideas on how I can grab the MAC address of the assigned neutron port? I will also need to grab the IP Neutron has allocated to my VM instance.<br>
<br>
</div>
I will pass the MAC and IP to a user-data template.<br>
The MAC will be used to find the name of the network interface on the VM.<br>
</div>
Once the script finds the correct interface name, the user-data script<br>
</div>
will plumb the VM NIC, then continue to create the network interface file to make the network changes persistent.<br>
<br>
</div>
So I guess my first hurdle is to find out how to modify my existing heat template to discover
<br>
</div>
the allocated MAC and IP of the created/attached neutron port.  Then pass those data points to<br>
</div>
a cloud-init user-data script.<br>
<br>
<br>
</div>
</div>
</div>
</span>
</body>
</html>