<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Python data for leaf-least in NSO Developer Hub Discussions</title>
    <link>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4023186#M4770</link>
    <description>&lt;P&gt;I have explored the other way, the template one, and it works!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just in case it might help someone, this is my template:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT size="2"&gt;          &amp;lt;interfaces&amp;gt;
            &amp;lt;interface&amp;gt;
              &amp;lt;name&amp;gt;{/ROUTER_VECINO/INT_AGREGADO_CONEXION/NOMBRE_INT_AGREGADO}&amp;lt;/name&amp;gt;
              &amp;lt;description&amp;gt;Conexion con {../NOMBRE} {INT_AGREGADO_REMOTO}&amp;lt;/description&amp;gt;
              &amp;lt;aggregated-ether-options&amp;gt;
                &amp;lt;?if {contains(OPCIONES,'ROBUSTO')}?&amp;gt;
                  &amp;lt;minimum-links&amp;gt;{count(PUERTO_LOCAL)}&amp;lt;/minimum-links&amp;gt;
                &amp;lt;?else?&amp;gt;
                  &amp;lt;minimum-links&amp;gt;{ceiling(count(PUERTO_LOCAL) div 2)}&amp;lt;/minimum-links&amp;gt;
                &amp;lt;?end?&amp;gt;
              &amp;lt;/aggregated-ether-options&amp;gt;
             &amp;lt;/interface&amp;gt;
          &amp;lt;/interfaces&amp;gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;If I have time, I will also try the python approach later.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for your help.&lt;/P&gt;</description>
    <pubDate>Tue, 04 Feb 2020 09:02:15 GMT</pubDate>
    <dc:creator>franjorge</dc:creator>
    <dc:date>2020-02-04T09:02:15Z</dc:date>
    <item>
      <title>Python data for leaf-least</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/3993563#M4579</link>
      <description>&lt;P&gt;&lt;FONT size="3"&gt;I need to populate a template with a list of data in teh XML-template. I know How to do when apply the yang to the XML as in this case&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;YANG DEFINTION&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" face="courier new,courier"&gt;...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" face="courier new,courier"&gt;augment /ncs:services {&lt;BR /&gt;&amp;nbsp; list LF3 {&lt;BR /&gt;&amp;nbsp; description "Provo la lisa di policy";&lt;BR /&gt;&amp;nbsp; ...&lt;BR /&gt;&amp;nbsp; leaf-list &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;nbarCat&lt;/STRONG&gt;&lt;/FONT&gt; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; type enumeration {&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" face="courier new,courier"&gt;&amp;nbsp; ...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" face="arial,helvetica,sans-serif"&gt;&lt;STRONG&gt;XML TEMPLATE&lt;BR /&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;category&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;category-type&amp;gt;{/&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;nbarCat&lt;/FONT&gt;&lt;/STRONG&gt;}&amp;lt;/category-type&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/category&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to use a variable to be manipulated in my Pyton code. I tried to use a list but it seems it does not work. How can I do?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 17:07:45 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/3993563#M4579</guid>
      <dc:creator>Fantolino</dc:creator>
      <dc:date>2019-12-04T17:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Python data for leaf-least</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/3993901#M4580</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In most cases, if you want to manipulate the list elements in python, you'd then have to apply the template for each list element (the template engine doesn't process python objects in the same way it processes data model references)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;for entry in service.nbarCat:
  vars.add('FOO', foo(entry))
  template.apply('my-template', vars)&lt;/PRE&gt;
&lt;PRE&gt;    &amp;lt;category&amp;gt;
         &amp;lt;category-type&amp;gt;{$FOO}&amp;lt;/category-type&amp;gt;
    &amp;lt;/category&amp;gt;&lt;/PRE&gt;
&lt;P&gt;Hope that answers your question!&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 06:25:03 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/3993901#M4580</guid>
      <dc:creator>yfherzog</dc:creator>
      <dc:date>2019-12-05T06:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Python data for leaf-least</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4022038#M4741</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for posting to such an old thread, but what I have a similar case to this one, but I think my question is quite related to this one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like the OP, I want to manipulate elements of a list in python, but in the same service I use variables that are not part of a list. Applying the template in each loop iteration, messes all my service.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What should I do in these cases?&lt;/P&gt;</description>
      <pubDate>Sat, 01 Feb 2020 07:48:03 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4022038#M4741</guid>
      <dc:creator>franjorge</dc:creator>
      <dc:date>2020-02-01T07:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: Python data for leaf-least</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4022275#M4744</link>
      <description>&lt;P&gt;You can use multiple templates.&lt;/P&gt;
&lt;P&gt;Have your list-related configs in one template, which you apply iteratively, and have your other configs on a separate template which you apply only once.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(In most cases, applying the same configs over and over again as part of the same service should not generate any issues)&lt;/P&gt;</description>
      <pubDate>Sun, 02 Feb 2020 08:41:50 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4022275#M4744</guid>
      <dc:creator>yfherzog</dc:creator>
      <dc:date>2020-02-02T08:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: Python data for leaf-least</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4022377#M4747</link>
      <description>&lt;P&gt;Thanks for your reply. After struggling for several hours I think the problem is not related to what I thought.&lt;/P&gt;&lt;P&gt;I have the following yang (simplified):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;list cr-art {
&amp;nbsp;&amp;nbsp;key DEVICE;&amp;nbsp;
&amp;nbsp; leaf DEVICE {
&amp;nbsp; ...&amp;nbsp;&amp;nbsp;
&amp;nbsp; }
&amp;nbsp; list ROUTER_VECINO {

&amp;nbsp; &amp;nbsp; key NOMBRE;
&amp;nbsp; &amp;nbsp; leaf NOMBRE {
&amp;nbsp; &amp;nbsp; ...
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; list INT_AGREGADO_CONEXION {
&amp;nbsp; &amp;nbsp; &amp;nbsp; key NOMBRE_INT_AGREGADO;
&amp;nbsp; &amp;nbsp; &amp;nbsp; leaf NOMBRE_INT_AGREGADO {
&amp;nbsp; &amp;nbsp; &amp;nbsp; ...
&amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; list PUERTO_LOCAL {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; key NOMBRE;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; leaf NOMBRE {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ...
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; leaf PUERTO_REMOTO {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ...
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; }
}&lt;/PRE&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;The template has a part where I have to fill the variable $MIN_LINKS with some python calculations.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT face="courier new,courier"&gt;&amp;lt;interface&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;lt;name&amp;gt;{/ROUTER_VECINO/INT_AGREGADO_CONEXION/NOMBRE_INT_AGREGADO}&amp;lt;/name&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;lt;description&amp;gt;Conexion con {../NOMBRE} {INT_AGREGADO_REMOTO}&amp;lt;/description&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;lt;minimum-links&amp;gt;{$MIN_LINKS}&amp;lt;/minimum-links&amp;gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;The python code is similar to this:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT face="courier new,courier"&gt;for rv in service.ROUTER_VECINO:&lt;BR /&gt;&amp;nbsp; for iac in rv.INT_AGREGADO_CONEXION:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; num_puertos=len(iac.PUERTO_LOCAL)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; vars.add('MIN_LINKS',min_links)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; template.apply('cr-art-template',vars)&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;But this always returns MIN_LINKS as the number of the last aggregated interface that the code processes. That is logical, since the 'for' statements go through all the aggregated interfaces, not the one that is being processed at that moment in the template. It would be easy if somehow I could access the value of the current aggregated interface being processed each time, but nothing like the following seem to work (I get errors like "Error: Python cb_create error. 'List' object has no attribute 'NOMBRE'"):&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;service.ROUTER_VECINO.NOMBRE&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;service.ROUTER_VECINO[NOMBRE]&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Any hint?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Thanks.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Fran&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Feb 2020 18:31:14 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4022377#M4747</guid>
      <dc:creator>franjorge</dc:creator>
      <dc:date>2020-02-02T18:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: Python data for leaf-least</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4022382#M4748</link>
      <description>&lt;P&gt;So in the loop you can do rv.NOMBRE and iac.NOMBRE_INT_AGREGADO, since that points to the current instance.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Feb 2020 19:03:09 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4022382#M4748</guid>
      <dc:creator>vleijon</dc:creator>
      <dc:date>2020-02-02T19:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: Python data for leaf-least</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4022397#M4750</link>
      <description>&lt;P&gt;I throws an error if I add the following print statement to the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;for rv in service.ROUTER_VECINO:&lt;BR /&gt;   print(rv.NOMBRE)&lt;BR /&gt;   for iac in rv.INT_AGREGADO_CONEXION:&lt;BR /&gt;   ...&lt;BR /&gt;&lt;BR /&gt;admin@ncs(config-cr-art-artfran1-01)# re-deploy
Error: Python cb_create error. 'List' object has no attribute 'NOMBRE'&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Feb 2020 20:17:52 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4022397#M4750</guid>
      <dc:creator>franjorge</dc:creator>
      <dc:date>2020-02-02T20:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Python data for leaf-least</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4022407#M4751</link>
      <description>&lt;P&gt;I must be misunderstanding the model or the code, because rv shouldn't be a list. Try printing rv._path, and try making sure in the logs that it isn't some other line giving you the error.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Feb 2020 20:47:49 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4022407#M4751</guid>
      <dc:creator>vleijon</dc:creator>
      <dc:date>2020-02-02T20:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Python data for leaf-least</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4022416#M4752</link>
      <description>&lt;P&gt;Sorry, you are correct, it was another line which was triggering the error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, it looks like in the loop, rv.NOMBRE is not pointing to the current instance. Instead, the for loop goes through all instances of the service.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The service config looks like this:&lt;/P&gt;&lt;PRE&gt;cr-art artfran1-01
  ROUTER_VECINO Prueba
    INT_AGREGADO_CONEXION ae1
      PUERTO_LOCAL ge-0/0/2
      PUERTO_LOCAL ge-0/0/3

  ROUTER_VECINO artlaur1-01
    INT_AGREGADO_CONEXION ae3
      PUERTO_LOCAL ge-0/0/5&lt;/PRE&gt;&lt;P&gt;I have put some print statements in the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        for rv in service.ROUTER_VECINO:
          print(rv.NOMBRE)
          for iac in rv.INT_AGREGADO_CONEXION:
            num_puertos=len(iac.PUERTO_LOCAL)
            print(num_puertos)&lt;/PRE&gt;&lt;P&gt;What I get in the logs is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;INFO&amp;gt; 2-Feb-2020::21:43:44.882 cisco ncs[3724]: cr-art :: Prueba
&amp;lt;INFO&amp;gt; 2-Feb-2020::21:43:44.883 cisco ncs[3724]: cr-art :: 2
&amp;lt;INFO&amp;gt; 2-Feb-2020::21:43:45.149 cisco ncs[3724]: cr-art :: artlaur1-01
&amp;lt;INFO&amp;gt; 2-Feb-2020::21:43:45.151 cisco ncs[3724]: cr-art :: 1&lt;/PRE&gt;&lt;P&gt;That is correct, but when I look at the config of the router artfran1-01, the value for MIN_LINKS is "1" for both aggregated interfaces.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What can I do to have "2" for ae1 and "1" fora ae3?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 07:19:48 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4022416#M4752</guid>
      <dc:creator>franjorge</dc:creator>
      <dc:date>2020-02-03T07:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: Python data for leaf-least</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4022738#M4760</link>
      <description>&lt;P&gt;I'm still struggling with this. I have divided the original template into two different templates. The debug shows that the second template is being applied twice, but I do not quite understand the results. First calculation for MIN_LINKS results in "2" for both aggregate interfaces, even though the second aggregate only has one port. The second pass returns MIN_LINKS="1" for both aggregates, although the first aggregate only has one port.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; 2020-02-03T15:12:58.070 xpath: template agregados-template: match: /cr-art[DEVICE='artfran1-01']/ROUTER_VECINO[NOMBRE='artlaur1-01']/INT_AGREGADO_CONEXION[NOMBRE_INT_AGREGADO='ae3']/NOMBRE_INT_AGREGADO
 2020-02-03T15:12:58.070 xpath: template agregados-template: result: 2 nodes [0.001 sec]
 2020-02-03T15:12:58.070 xpath: template agregados-template: evaluating: ../NOMBRE
 2020-02-03T15:12:58.071 xpath: template agregados-template: match: /cr-art[DEVICE='artfran1-01']/ROUTER_VECINO[NOMBRE='Prueba']/NOMBRE
 2020-02-03T15:12:58.071 xpath: template agregados-template: result: one node [0.000 sec]
 2020-02-03T15:12:58.071 xpath: template agregados-template: evaluating: INT_AGREGADO_REMOTO
 2020-02-03T15:12:58.071 xpath: template agregados-template: match: /cr-art[DEVICE='artfran1-01']/ROUTER_VECINO[NOMBRE='Prueba']/INT_AGREGADO_CONEXION[NOMBRE_INT_AGREGADO='ae1']/INT_AGREGADO_REMOTO: ae2
 2020-02-03T15:12:58.071 xpath: template agregados-template: result: one node [0.000 sec]
 2020-02-03T15:12:58.072 xpath: template agregados-template: evaluating: string($MIN_LINKS)
 2020-02-03T15:12:58.072 xpath: template agregados-template: result: 2 [0.000 sec]
 2020-02-03T15:12:58.073 xpath: template agregados-template: evaluating: ../NOMBRE
 2020-02-03T15:12:58.073 xpath: template agregados-template: match: /cr-art[DEVICE='artfran1-01']/ROUTER_VECINO[NOMBRE='artlaur1-01']/NOMBRE
 2020-02-03T15:12:58.073 xpath: template agregados-template: result: one node [0.000 sec]
 2020-02-03T15:12:58.073 xpath: template agregados-template: evaluating: INT_AGREGADO_REMOTO
 2020-02-03T15:12:58.073 xpath: template agregados-template: match: /cr-art[DEVICE='artfran1-01']/ROUTER_VECINO[NOMBRE='artlaur1-01']/INT_AGREGADO_CONEXION[NOMBRE_INT_AGREGADO='ae3']/INT_AGREGADO_REMOTO: ae1
 2020-02-03T15:12:58.074 xpath: template agregados-template: result: one node [0.000 sec]
 2020-02-03T15:12:58.074 xpath: template agregados-template: evaluating: string($MIN_LINKS)
 2020-02-03T15:12:58.074 xpath: template agregados-template: result: 2 [0.000 sec]
 2020-02-03T15:12:58.079 xpath: template agregados-template: evaluating: /DEVICE
 2020-02-03T15:12:58.079 xpath: template agregados-template: match: /cr-art[DEVICE='artfran1-01']/DEVICE
 2020-02-03T15:12:58.080 xpath: template agregados-template: result: one node [0.000 sec]
 2020-02-03T15:12:58.081 xpath: template agregados-template: evaluating: ROUTER_VECINO/INT_AGREGADO_CONEXION/NOMBRE_INT_AGREGADO
 2020-02-03T15:12:58.081 xpath: template agregados-template: match: /cr-art[DEVICE='artfran1-01']/ROUTER_VECINO[NOMBRE='Prueba']/INT_AGREGADO_CONEXION[NOMBRE_INT_AGREGADO='ae1']/NOMBRE_INT_AGREGADO
 2020-02-03T15:12:58.082 xpath: template agregados-template: match: /cr-art[DEVICE='artfran1-01']/ROUTER_VECINO[NOMBRE='artlaur1-01']/INT_AGREGADO_CONEXION[NOMBRE_INT_AGREGADO='ae3']/NOMBRE_INT_AGREGADO
 2020-02-03T15:12:58.082 xpath: template agregados-template: result: 2 nodes [0.001 sec]
 2020-02-03T15:12:58.082 xpath: template agregados-template: evaluating: ../NOMBRE
 2020-02-03T15:12:58.082 xpath: template agregados-template: match: /cr-art[DEVICE='artfran1-01']/ROUTER_VECINO[NOMBRE='Prueba']/NOMBRE
 2020-02-03T15:12:58.083 xpath: template agregados-template: result: one node [0.000 sec]
 2020-02-03T15:12:58.083 xpath: template agregados-template: evaluating: INT_AGREGADO_REMOTO
 2020-02-03T15:12:58.083 xpath: template agregados-template: match: /cr-art[DEVICE='artfran1-01']/ROUTER_VECINO[NOMBRE='Prueba']/INT_AGREGADO_CONEXION[NOMBRE_INT_AGREGADO='ae1']/INT_AGREGADO_REMOTO: ae2
 2020-02-03T15:12:58.083 xpath: template agregados-template: result: one node [0.000 sec]
 2020-02-03T15:12:58.084 xpath: template agregados-template: evaluating: string($MIN_LINKS)
 2020-02-03T15:12:58.084 xpath: template agregados-template: result: 1 [0.000 sec]
 2020-02-03T15:12:58.084 xpath: template agregados-template: evaluating: ../NOMBRE
 2020-02-03T15:12:58.085 xpath: template agregados-template: match: /cr-art[DEVICE='artfran1-01']/ROUTER_VECINO[NOMBRE='artlaur1-01']/NOMBRE
 2020-02-03T15:12:58.085 xpath: template agregados-template: result: one node [0.000 sec]
 2020-02-03T15:12:58.085 xpath: template agregados-template: evaluating: INT_AGREGADO_REMOTO
 2020-02-03T15:12:58.085 xpath: template agregados-template: match: /cr-art[DEVICE='artfran1-01']/ROUTER_VECINO[NOMBRE='artlaur1-01']/INT_AGREGADO_CONEXION[NOMBRE_INT_AGREGADO='ae3']/INT_AGREGADO_REMOTO: ae1
 2020-02-03T15:12:58.085 xpath: template agregados-template: result: one node [0.000 sec]
 2020-02-03T15:12:58.086 xpath: template agregados-template: evaluating: string($MIN_LINKS)
 2020-02-03T15:12:58.086 xpath: template agregados-template: result: 1 [0.000 sec]&lt;/PRE&gt;&lt;P&gt;This is driving me crazy. Any hint would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 14:25:08 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4022738#M4760</guid>
      <dc:creator>franjorge</dc:creator>
      <dc:date>2020-02-03T14:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: Python data for leaf-least</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4023124#M4766</link>
      <description>&lt;P&gt;Can you post the template for which you see unexpected debug output?&lt;/P&gt;
&lt;P&gt;One thing to have in mind is that the template engine supports some sort of iteration capability as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your template contains path to lists in your service model, then NSO will iterate the list entries and apply the same structure of the XML for each entry. Looking at XML snippets you shared earlier, I suspect that might be happening.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 07:02:48 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4023124#M4766</guid>
      <dc:creator>yfherzog</dc:creator>
      <dc:date>2020-02-04T07:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: Python data for leaf-least</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4023140#M4768</link>
      <description>&lt;P&gt;This is the relevant piece of the template:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT size="2"&gt;            &amp;lt;interface&amp;gt;
              &amp;lt;name&amp;gt;{/ROUTER_VECINO/INT_AGREGADO_CONEXION/NOMBRE_INT_AGREGADO}&amp;lt;/name&amp;gt;
              &amp;lt;description&amp;gt;Conexion con {../NOMBRE} {INT_AGREGADO_REMOTO}&amp;lt;/description&amp;gt;
              &amp;lt;aggregated-ether-options&amp;gt;
                &amp;lt;minimum-links&amp;gt;{$MIN_LINKS}&amp;lt;/minimum-links&amp;gt;
              &amp;lt;/aggregated-ether-options&amp;gt;
              &amp;lt;unit&amp;gt;
                &amp;lt;name&amp;gt;0&amp;lt;/name&amp;gt;
                &amp;lt;family&amp;gt;
                    &amp;lt;inet&amp;gt;
                        &amp;lt;address&amp;gt;
                            &amp;lt;name&amp;gt;{IP-MASK}&amp;lt;/name&amp;gt;
                        &amp;lt;/address&amp;gt;
                    &amp;lt;/inet&amp;gt;
                &amp;lt;/family&amp;gt;
            &amp;lt;/unit&amp;gt;
          &amp;lt;/interface&amp;gt;&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Feb 2020 07:30:39 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4023140#M4768</guid>
      <dc:creator>franjorge</dc:creator>
      <dc:date>2020-02-04T07:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Python data for leaf-least</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4023171#M4769</link>
      <description>&lt;P&gt;ok.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, both ROUTER_VECINO and INT_AGREGADO_CONEXION, so your XML template is also doing some sort of iteration on those lists.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd say, try to limit your logic to iterate either on python or on XML.&lt;/P&gt;
&lt;P&gt;Suppose that you go with python here, have your python code fetch the values of NOMBRE_INT_AGREGADO, NOMBRE, INT_AGREGADO_REMOTO and&amp;nbsp;IP-MASK and populate them in template variables.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 08:23:52 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4023171#M4769</guid>
      <dc:creator>yfherzog</dc:creator>
      <dc:date>2020-02-04T08:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: Python data for leaf-least</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4023186#M4770</link>
      <description>&lt;P&gt;I have explored the other way, the template one, and it works!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just in case it might help someone, this is my template:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT size="2"&gt;          &amp;lt;interfaces&amp;gt;
            &amp;lt;interface&amp;gt;
              &amp;lt;name&amp;gt;{/ROUTER_VECINO/INT_AGREGADO_CONEXION/NOMBRE_INT_AGREGADO}&amp;lt;/name&amp;gt;
              &amp;lt;description&amp;gt;Conexion con {../NOMBRE} {INT_AGREGADO_REMOTO}&amp;lt;/description&amp;gt;
              &amp;lt;aggregated-ether-options&amp;gt;
                &amp;lt;?if {contains(OPCIONES,'ROBUSTO')}?&amp;gt;
                  &amp;lt;minimum-links&amp;gt;{count(PUERTO_LOCAL)}&amp;lt;/minimum-links&amp;gt;
                &amp;lt;?else?&amp;gt;
                  &amp;lt;minimum-links&amp;gt;{ceiling(count(PUERTO_LOCAL) div 2)}&amp;lt;/minimum-links&amp;gt;
                &amp;lt;?end?&amp;gt;
              &amp;lt;/aggregated-ether-options&amp;gt;
             &amp;lt;/interface&amp;gt;
          &amp;lt;/interfaces&amp;gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;If I have time, I will also try the python approach later.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for your help.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 09:02:15 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/python-data-for-leaf-least/m-p/4023186#M4770</guid>
      <dc:creator>franjorge</dc:creator>
      <dc:date>2020-02-04T09:02:15Z</dc:date>
    </item>
  </channel>
</rss>

