<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 14, 2018 at 11:16 PM, Ben Nemec <span dir="ltr"><<a href="mailto:openstack@nemebean.com" target="_blank">openstack@nemebean.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 02/09/2018 08:49 AM, Jiri Tomasek wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
*Step 2. network-environment -> NIC configs*<span><br>
<br>
Second step of network configuration is NIC config. For this network-environment.yaml is used which references NIC config templates which define network_config in their resources section. User is currently required to configure these templates manually. We would like to provide interactive view which would allow user to setup these templates using TripleO UI. A good example is a standalone tool created by Ben Nemec [3].<br>
<br>
There is currently work aimed for Pike to introduce jinja templating for network environments and templates [4] (single-nic-with-vlans, bond-with-vlans) to support composable networks and roles (integrate data from roles_data.yaml and network_data.yaml) It would be great if we could move this one step further by using these samples as a starting point and let user specify full NIC configuration.<br>
<br>
Available information at this point:<br>
- list of roles and networks as well as which networks need to be configured at which role's NIC Config template<br>
- os-net-config schema which defines NIC configuration elements and relationships [5]<br>
- jinja templated sample NIC templates<br>
<br>
Requirements:<br>
- provide feedback to the user about networks assigned to role and have not been configured in NIC config yet<br>
</span></blockquote>
<br>
I don't have much to add on this point, but I will note that because my UI is standalone and pre-dates composable networks it takes the opposite approach. As a user adds a network to a role, it exposes the configuration for that network. Since you have the networks ahead of time, you can obviously expose all of those settings up front and ensure the correct networks are configured for each nic-config.<br>
<br>
I say this mostly for everyone's awareness so design elements of my tool don't get copied where they don't make sense.<span><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
- let user construct network_config section of NIC config templates for each role (brigdes/bonds/vlans/interface<wbr>s...)<br>
- provide means to assign network to vlans/interfaces and automatically construct network_config section parameter references<br>
</blockquote>
<br></span>
So obviously your UI code is going to differ, but I will point out that the code in my tool for generating the actual os-net-config data is semi-standalone: <a href="https://github.com/cybertron/tripleo-scripts/blob/master/net_processing.py" rel="noreferrer" target="_blank">https://github.com/cybertron/t<wbr>ripleo-scripts/blob/master/net<wbr>_processing.py</a><br>
<br>
It's also about 600 lines of code and doesn't even handle custom roles or networks yet. I'm not clear whether it ever will at this point given the change in my focus.<br>
<br>
Unfortunately the input JSON schema isn't formally documented, although the unit tests do include a number of examples. <a href="https://github.com/cybertron/tripleo-scripts/blob/master/test-data/all-the-things/nic-input.json" rel="noreferrer" target="_blank">https://github.com/cybertron/t<wbr>ripleo-scripts/blob/master/tes<wbr>t-data/all-the-things/nic-inpu<wbr>t.json</a> covers quite a few different cases.<span><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
- populate parameter definitions in NIC config templates based on role/networks assignment<br>
- populate parameter definitions in NIC config templates based on specific elements which use them e.g. BondInterfaceOvsOptions in case when ovs_bond is used<br>
</blockquote>
<br></span>
I guess there's two ways to handle this - you could use the new jinja templating to generate parameters, or you could handle it in the generation code.<br>
<br>
I'm not sure if there's a chicken-and-egg problem with the UI generating jinja templates, but that's probably the simplest option if it works. The approach I took with my tool was to just throw all the parameters into all the files and if they're unused then oh well. With jinja templating you could do the same thing - just copy a single boilerplate parameter header that includes the jinja from the example nic-configs and let the templating handle all the logic for you.<br>
<br>
It would be cleaner to generate static templates that don't need to be templated, but it would require re-implementing all of the custom network logic for the UI. I'm not sure being cleaner is sufficient justification for doing that.<span><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
- store NIC config templates in deployment plan and reference them from network-environment.yaml<br>
<br>
Problems to solve:<br>
As a biggest problem to solve I see defining logic which would automatically handle assigning parameters to elements in network_config based on Network which user assigns to the element. For example: Using GUI, user is creating network_config for compute role based on network/config/multiple-nics/c<wbr>ompute.yaml, user adds an interface and assigns the interface to Tenant network. Resulting template should then automatically populate addresses/ip_netmask: get_param: TenantIpSubnet. Question is whether all this logic should live in GUI or should GUI pass simplified format to Mistral workflow which will convert it to proper network_config format and populates the template with it.<br>
</blockquote>
<br></span>
I guess the fact that I separated the UI and config generation code in my tool is my answer to this question. I don't remember all of my reasons for that design, but I think the main thing was to keep the input and generation cleanly separated. Otherwise there was a danger of making a UI change and having it break the generation process because they were tightly coupled. Having a JSON interface between the two avoids a lot of those problems. It also made it fairly easy to unit test the generation code, whereas trying to mock out all of the UI elements would have been a fragile nightmare.<br>
<br>
It does require a bunch of translation code[1], but a lot of it is fairly boilerplate (just map UI inputs to JSON keys).<br>
<br>
1: <a href="https://github.com/cybertron/tripleo-scripts/blob/171aedabfead1f27f4dc0fce41a8b82da28923ed/net-iso-gen.py#L515" rel="noreferrer" target="_blank">https://github.com/cybertron/t<wbr>ripleo-scripts/blob/171aedabfe<wbr>ad1f27f4dc0fce41a8b82da28923ed<wbr>/net-iso-gen.py#L515</a><br>
<br>
Hope this helps.</blockquote><div><br></div>Ben, thanks a lot for your input. I think this makes the direction with NIC configs clearer:<div><br></div><div>1. The generated template will include all possible parameters definitions unless we find a suitable way of populating parameters section part of template generation process. Note that current jinja templates for NIC config (e.g. network/config/multiple-nics/<wbr>role.role.j2.yaml:127) create these definitions conditionally by specific role name which is not very elegant in terms of custom roles.</div><div><br></div><div>2. GUI is going to define forms to add/configure network elements (interface, bridge, bond, vlan, ...) and provide user friendly way to combine these together. The whole data construct (per Role) is going to be sent to tripleo-common workflow as json. Workflow consumes json input and produces final template yaml. I think we should be able to reuse bunch of the logic which Ben already created.</div><div><br></div><div>Example: </div><div>json input from GUI:</div><div><font face="monospace, monospace">..., {</font></div><div><font face="monospace, monospace"> type: 'interface',</font></div><div><font face="monospace, monospace"> name: 'nic1',</font></div><div><font face="monospace, monospace"> network_name_lower: 'external'</font></div><div><font face="monospace, monospace">},...</font></div><div>transformed by tripleo-common:</div><div><font face="monospace, monospace">...</font></div><div><div><font face="monospace, monospace">- type: interface</font></div><div><font face="monospace, monospace"> name: nic{{loop.index + 1}}</font></div><div><font face="monospace, monospace"> use_dhcp: false</font></div><div><font face="monospace, monospace"> addresses:</font></div><div><font face="monospace, monospace"> - ip_netmask:</font></div><div><font face="monospace, monospace"> get_param: {{<a href="http://network.name/" target="_blank">network.name</a>}}IpSubnet</font></div></div><div><font face="monospace, monospace">...</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">With this approach, we'll create common API provided by Mistral to generate NIC config templates which can be reused by CLI and other clients, not TripleO UI specifically. Note that we will also need a 'reverse' Mistral workflow which is going to convert template yaml network_config into the input json format, so GUI can display current configuration to the user and let him change that.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Liz has updated network configuration wireframes which can be found here <a href="https://lizsurette.github.io/OpenStack-Design/tripleo-ui/3-tripleo-ui-edge-cases/7.advancednetworkconfigurationandtopology">https://lizsurette.github.io/OpenStack-Design/tripleo-ui/3-tripleo-ui-edge-cases/7.advancednetworkconfigurationandtopology</a> . The goal is to provide a graphical network configuration overview and let user perform actions from it. This ensures that with every action performed, user immediately gets clear feedback on how does the network configuration look.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">-- Jirka</font></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-m_7957400931392313882HOEnZb"><font color="#888888"><br>
<br>
-Ben<br>
</font></span></blockquote></div><br></div></div>