<?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: Concatenate evaluated values before pushing conf to device in NSO Developer Hub Discussions</title>
    <link>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5155028#M8596</link>
    <description>&lt;P&gt;Maybe switch from Template only to a Python based service. If you do the logic in Python things get easier.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Aug 2024 14:18:24 GMT</pubDate>
    <dc:creator>Marcel Zehnder</dc:creator>
    <dc:date>2024-08-02T14:18:24Z</dc:date>
    <item>
      <title>Concatenate evaluated values before pushing conf to device</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5154445#M8586</link>
      <description>&lt;P&gt;&lt;BR /&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm writing a very basic service in order to configure an interface vlan on a list of switch. Le vlan number is the same for all switches, and each switch has its own IP address for this vlan interface.&lt;/P&gt;&lt;P&gt;When I create the service one switch, it works fine. But when I create the service with 2 switches, I have a behavior I don't understand. The evaluation of ip-add is correct for each switch, but it concatenates both ip-add to push on the device !&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;admin@ncs(config)# services int-vlan-cfs TEST-CFS-57 vlan-id 57 switch nx1 ip-add 10.10.10.1/24&lt;BR /&gt;admin@ncs(config)# services int-vlan-cfs TEST-CFS-57 vlan-id 57 switch nx2 ip-add 10.10.10.2/24&lt;BR /&gt;admin@ncs(config-switch-nx2)# commit dry-run | debug template&lt;BR /&gt;Evaluating "/switch/ip-add" (from file "int-vlan-cfs-template.xml", line 11)&lt;BR /&gt;.../...&lt;/P&gt;&lt;P&gt;Context node: /services/int-vlan-cfs:int-vlan-cfs[cfs-name='TEST-CFS-57']&lt;BR /&gt;Result:&lt;BR /&gt;For /services/int-vlan-cfs:int-vlan-cfs[cfs-name='TEST-CFS-57']/switch[name='nx1'], it evaluates to "10.10.10.1/24"&lt;BR /&gt;For /services/int-vlan-cfs:int-vlan-cfs[cfs-name='TEST-CFS-57']/switch[name='nx2'], it evaluates to "10.10.10.2/24"&lt;BR /&gt;Aborted: int-vlan-cfs-template.xml:11 Expression '{/switch/ip-add}' resulted in an incompatible value '10.10.10.1/2410.10.10.2/24' for /ncs:devices/device{nx1}/config/nx:interface/Vlan{57}/ip/address&lt;/P&gt;&lt;P&gt;I joined the xml, yang and full commit result files.&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 09:27:02 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5154445#M8586</guid>
      <dc:creator>Noel Cantenot</dc:creator>
      <dc:date>2024-08-01T09:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate evaluated values before pushing conf to device</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5154641#M8588</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's been a while since I last used NSO. However, based on your files and your YANG module, I think you need to put some logic in your config-template, something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;config-template xmlns="http://tail-f.com/ns/config/1.0" servicepoint="int-vlan-cfs"&amp;gt;
  &amp;lt;devices xmlns="http://tail-f.com/ns/ncs"&amp;gt;
      &amp;lt;?foreach {/switch}?&amp;gt;
        &amp;lt;device&amp;gt;
          &amp;lt;name&amp;gt;{./name}&amp;lt;/name&amp;gt;
          &amp;lt;config&amp;gt;
                &amp;lt;interface xmlns="http://tail-f.com/ned/cisco-nx"&amp;gt;
                    &amp;lt;Vlan&amp;gt;
                          &amp;lt;name tags="create"&amp;gt;{../vlan-id}&amp;lt;/name&amp;gt;
                          &amp;lt;ip&amp;gt;
                            &amp;lt;address tags="replace"&amp;gt;{./ip-add}&amp;lt;/address&amp;gt;
                          &amp;lt;/ip&amp;gt;
                          &amp;lt;description&amp;gt;Ma description de test&amp;lt;/description&amp;gt;
                    &amp;lt;/Vlan&amp;gt;
                &amp;lt;/interface&amp;gt;
          &amp;lt;/config&amp;gt;
        &amp;lt;/device&amp;gt;
      &amp;lt;?end?&amp;gt;
   &amp;lt;/devices&amp;gt;
&amp;lt;/config-template&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's out of my head, so I'm not sure if it works.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 16:47:28 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5154641#M8588</guid>
      <dc:creator>Marcel Zehnder</dc:creator>
      <dc:date>2024-08-01T16:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate evaluated values before pushing conf to device</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5154896#M8591</link>
      <description>&lt;P&gt;Hi Marcel,&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;I tested with foreach, but the result is the same.&lt;/P&gt;&lt;P&gt;On your example, I had to replace&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;address tags="replace"&amp;gt;{./ip-add}&amp;lt;/address&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;with&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;address tags="replace"&amp;gt;{/switch/ip-add}&amp;lt;/address&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;otherwise result of evaluating "./ip-add" is "empty node".&lt;/P&gt;&lt;P&gt;But again, same concatenation...&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 08:52:24 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5154896#M8591</guid>
      <dc:creator>Noel Cantenot</dc:creator>
      <dc:date>2024-08-02T08:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate evaluated values before pushing conf to device</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5154907#M8592</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/861758"&gt;@Noel Cantenot&lt;/a&gt;&amp;nbsp;/switch/ip-add resolves to all ip-add in your list, that's expected. Therefore by using the loop it should be possible to&amp;nbsp;&lt;SPAN&gt;evaluate&lt;/SPAN&gt;&amp;nbsp;all list entries one by one. Does this work or do you also get empty node?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;config-template xmlns="http://tail-f.com/ns/config/1.0" servicepoint="int-vlan-cfs"&amp;gt;
  &amp;lt;devices xmlns="http://tail-f.com/ns/ncs"&amp;gt;
      &amp;lt;?foreach {/switch}?&amp;gt;
        &amp;lt;device&amp;gt;
          &amp;lt;name&amp;gt;{name}&amp;lt;/name&amp;gt;
          &amp;lt;config&amp;gt;
                &amp;lt;interface xmlns="http://tail-f.com/ned/cisco-nx"&amp;gt;
                    &amp;lt;Vlan&amp;gt;
                          &amp;lt;name tags="create"&amp;gt;{../vlan-id}&amp;lt;/name&amp;gt;
                          &amp;lt;ip&amp;gt;
                            &amp;lt;address tags="replace"&amp;gt;{ip-add}&amp;lt;/address&amp;gt;
                          &amp;lt;/ip&amp;gt;
                          &amp;lt;description&amp;gt;Ma description de test&amp;lt;/description&amp;gt;
                    &amp;lt;/Vlan&amp;gt;
                &amp;lt;/interface&amp;gt;
          &amp;lt;/config&amp;gt;
        &amp;lt;/device&amp;gt;
      &amp;lt;?end?&amp;gt;
   &amp;lt;/devices&amp;gt;
&amp;lt;/config-template&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 09:35:54 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5154907#M8592</guid>
      <dc:creator>Marcel Zehnder</dc:creator>
      <dc:date>2024-08-02T09:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate evaluated values before pushing conf to device</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5154952#M8593</link>
      <description>&lt;P&gt;With this code I have empty node, so we can see that ip-add is not pushed in the configuration.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Evaluating "ip-add" (from file "int-vlan-cfs-template.xml", line 11)&lt;BR /&gt;Context node: /services/int-vlan-cfs:int-vlan-cfs[cfs-name='TEST-CFS-57']&lt;BR /&gt;Result: empty node&lt;BR /&gt;Operation 'merge' on non-existing node: /devices/device[name='nx2']/config/nx:interface/Vlan[name='57']/description (from file "int-vlan-cfs-template.xml", line 13)&lt;BR /&gt;Fetching literal "Ma description de test" (from file "int-vlan-cfs-template.xml", line 13)&lt;BR /&gt;Setting /devices/device[name='nx2']/config/nx:interface/Vlan[name='57']/description to "Ma description de test"&lt;BR /&gt;cli {&lt;BR /&gt;local-node {&lt;BR /&gt;data devices {&lt;BR /&gt;device nx1 {&lt;BR /&gt;config {&lt;BR /&gt;interface {&lt;BR /&gt;+ Vlan 57 {&lt;BR /&gt;+ description "Ma description de test";&lt;BR /&gt;+ }&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;device nx2 {&lt;BR /&gt;config {&lt;BR /&gt;interface {&lt;BR /&gt;+ Vlan 57 {&lt;BR /&gt;+ description "Ma description de test";&lt;BR /&gt;+ }&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;services {&lt;BR /&gt;+ int-vlan-cfs TEST-CFS-57 {&lt;BR /&gt;+ vlan-id 57;&lt;BR /&gt;+ switch nx1 {&lt;BR /&gt;+ ip-add 10.10.10.1/24;&lt;BR /&gt;+ }&lt;BR /&gt;+ switch nx2 {&lt;BR /&gt;+ ip-add 10.10.10.2/24;&lt;BR /&gt;+ }&lt;BR /&gt;+ }&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;admin@ncs(config-switch-nx2)#&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 10:46:40 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5154952#M8593</guid>
      <dc:creator>Noel Cantenot</dc:creator>
      <dc:date>2024-08-02T10:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate evaluated values before pushing conf to device</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5154986#M8594</link>
      <description>&lt;P&gt;Okay two more ideas (without using loops):&lt;/P&gt;
&lt;P&gt;What if you try to get the string value instead of the xpath-list:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;config-template xmlns="http://tail-f.com/ns/config/1.0" servicepoint="int-vlan-cfs"&amp;gt;
  &amp;lt;devices xmlns="http://tail-f.com/ns/ncs"&amp;gt;
      &amp;lt;device&amp;gt;
        &amp;lt;name&amp;gt;{/switch/name}&amp;lt;/name&amp;gt;
        &amp;lt;config&amp;gt;
              &amp;lt;interface xmlns="http://tail-f.com/ned/cisco-nx"&amp;gt;
                   &amp;lt;Vlan&amp;gt;
                        &amp;lt;name tags="create"&amp;gt;{/vlan-id}&amp;lt;/name&amp;gt;
                        &amp;lt;ip&amp;gt;
                          &amp;lt;address tags="replace"&amp;gt;{string(/switch/ip-add)}&amp;lt;/address&amp;gt;
                        &amp;lt;/ip&amp;gt;
                        &amp;lt;description&amp;gt;Ma description de test&amp;lt;/description&amp;gt;
                   &amp;lt;/Vlan&amp;gt;
              &amp;lt;/interface&amp;gt;
        &amp;lt;/config&amp;gt;
      &amp;lt;/device&amp;gt;
   &amp;lt;/devices&amp;gt;
&amp;lt;/config-template&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;If the above does not work, the context-switch mechanism should kick in, so the following may work:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;config-template xmlns="http://tail-f.com/ns/config/1.0" servicepoint="int-vlan-cfs"&amp;gt;
  &amp;lt;devices xmlns="http://tail-f.com/ns/ncs"&amp;gt;
      &amp;lt;device&amp;gt;
        &amp;lt;name&amp;gt;{/switch/name}&amp;lt;/name&amp;gt;
       &amp;lt;!-- context should change to current /switch --&amp;gt;
        &amp;lt;config&amp;gt;
              &amp;lt;interface xmlns="http://tail-f.com/ned/cisco-nx"&amp;gt;
                   &amp;lt;Vlan&amp;gt;
                        &amp;lt;name tags="create"&amp;gt;{../vlan-id}&amp;lt;/name&amp;gt;
                        &amp;lt;!-- with current /switch as context ../vlan-id should return the vlan --&amp;gt;
                        &amp;lt;ip&amp;gt;
                          &amp;lt;address tags="replace"&amp;gt;{ip-add}&amp;lt;/address&amp;gt;
                         &amp;lt;!-- with current /switch as context ip-add should return the IP of the current switch --&amp;gt;
                        &amp;lt;/ip&amp;gt;
                        &amp;lt;description&amp;gt;Ma description de test&amp;lt;/description&amp;gt;
                   &amp;lt;/Vlan&amp;gt;
              &amp;lt;/interface&amp;gt;
        &amp;lt;/config&amp;gt;
      &amp;lt;/device&amp;gt;
   &amp;lt;/devices&amp;gt;
&amp;lt;/config-template&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 12:10:45 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5154986#M8594</guid>
      <dc:creator>Marcel Zehnder</dc:creator>
      <dc:date>2024-08-02T12:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate evaluated values before pushing conf to device</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5155021#M8595</link>
      <description>&lt;P&gt;The first solution change the result, but it seams only the first ip-add is evaluated (so both switches are configured with the first ip-add.&lt;/P&gt;&lt;P&gt;Evaluating "string(/switch/ip-add)" (from file "int-vlan-cfs-template.xml", line 10)&lt;BR /&gt;Context node: /services/int-vlan-cfs:int-vlan-cfs[cfs-name='TEST-CFS-57']&lt;BR /&gt;Result: "10.10.10.1/24"&lt;BR /&gt;Setting /devices/device[name='nx2']/config/nx:interface/Vlan[name='57']/ip/address to "10.10.10.1/24"&lt;BR /&gt;Operation 'merge' on non-existing node: /devices/device[name='nx2']/config/nx:interface/Vlan[name='57']/description (from file "int-vlan-cfs-template.xml", line 12)&lt;BR /&gt;Fetching literal "Ma description de test" (from file "int-vlan-cfs-template.xml", line 12)&lt;BR /&gt;Setting /devices/device[name='nx2']/config/nx:interface/Vlan[name='57']/description to "Ma description de test"&lt;BR /&gt;cli {&lt;BR /&gt;local-node {&lt;BR /&gt;data devices {&lt;BR /&gt;device nx1 {&lt;BR /&gt;config {&lt;BR /&gt;interface {&lt;BR /&gt;+ Vlan 57 {&lt;BR /&gt;+ description "Ma description de test";&lt;BR /&gt;+ ip {&lt;BR /&gt;+ address 10.10.10.1/24;&lt;BR /&gt;+ }&lt;BR /&gt;+ }&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;device nx2 {&lt;BR /&gt;config {&lt;BR /&gt;interface {&lt;BR /&gt;+ Vlan 57 {&lt;BR /&gt;+ description "Ma description de test";&lt;BR /&gt;+ ip {&lt;BR /&gt;+ address 10.10.10.1/24;&lt;BR /&gt;+ }&lt;BR /&gt;+ }&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;services {&lt;BR /&gt;+ int-vlan-cfs TEST-CFS-57 {&lt;BR /&gt;+ vlan-id 57;&lt;BR /&gt;+ switch nx1 {&lt;BR /&gt;+ ip-add 10.10.10.1/24;&lt;BR /&gt;+ }&lt;BR /&gt;+ switch nx2 {&lt;BR /&gt;+ ip-add 10.10.10.2/24;&lt;BR /&gt;+ }&lt;BR /&gt;+ }&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;For the second solution, the evaluation of vlan is OK, but evaluation of ip-add is : empty node. I agree with you, my understanding of the context is that {ip-add} should work, but it doesn't... I testes with {./ip-add}, same result.&lt;/P&gt;&lt;P&gt;Evaluating "ip-add" (from file "int-vlan-cfs-template.xml", line 10)&lt;BR /&gt;Context node: /services/int-vlan-cfs:int-vlan-cfs[cfs-name='TEST-CFS-57']&lt;BR /&gt;Result: empty node&lt;/P&gt;&lt;P&gt;On ly {/switch/ip-add} evaluates both IPs, but concatenates...&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 14:05:41 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5155021#M8595</guid>
      <dc:creator>Noel Cantenot</dc:creator>
      <dc:date>2024-08-02T14:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate evaluated values before pushing conf to device</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5155028#M8596</link>
      <description>&lt;P&gt;Maybe switch from Template only to a Python based service. If you do the logic in Python things get easier.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 14:18:24 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5155028#M8596</guid>
      <dc:creator>Marcel Zehnder</dc:creator>
      <dc:date>2024-08-02T14:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate evaluated values before pushing conf to device</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5155045#M8597</link>
      <description>&lt;P&gt;Python Code&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# -*- mode: python; python-indent: 4 -*-
import ncs
from ncs.application import Service

class ServiceCallbacks(Service):
    &lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/9199"&gt;@service&lt;/a&gt;.create
    def cb_create(self, tctx, root, service, proplist):
        self.log.info('Service create(service=', service._path, ')')
        template = ncs.template.Template(service)

        for sw in service.switch:
            vars = ncs.template.Variables()
            self.log.info(f"{sw.name} / {service.vlanid} / {sw.ipadd}")
            vars.add('vlanid', service.vlanid)
            vars.add('swname', sw.name)
            vars.add('swipadd', sw.ipadd)
            template.apply('int-vlan-cfs-template', vars)
    
class Main(ncs.application.Application):
    def setup(self):
        self.log.info('Main RUNNING')
        self.register_service('int-vlan-cfs', ServiceCallbacks)

    def teardown(self):
        self.log.info('Main FINISHED')
&lt;/LI-CODE&gt;
&lt;P&gt;Also change the node names in the YANG module:&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;module int-vlan-cfs {

  namespace "http://example.com/int-vlan-cfs";
  prefix int-vlan-cfs;

  import ietf-inet-types {
    prefix inet;
  }
  import tailf-common {
    prefix tailf;
  }
  import tailf-ncs {
    prefix ncs;
  }

  description
    "CFS configure plusieurs interfaces d'un vlan avec: Noms devices, Id interface, IP/mask";

  revision 2016-01-01 {
    description
      "Initial revision.";
  }

  augment /ncs:services {
        list int-vlan-cfs {
            description "CFS skeleton service pour configurer les interfaces d'un vlan";
            tailf:info "CFS interfaces d'un vlan";
            key cfs-name;

            leaf cfs-name {
              tailf:info "-------- Nom du CFS";
              type string;
            }

            uses ncs:service-data;
            ncs:servicepoint "int-vlan-cfs";

            leaf vlanid {
              tailf:info "-------- Vlan number";
              type uint32;
            }

            list switch {
              key name;
              tailf:info "Liste des devices";
              unique "ipadd";

              leaf name {
                type leafref {
                  tailf:info "-------- Nom du switch";
                  path "/ncs:devices/ncs:device/ncs:name";
                }
              }

              leaf ipadd {
                tailf:info "-------- adresse IP";
                type string;
              }
            }
        }
  }
}&lt;/LI-CODE&gt;
&lt;P&gt;And the template:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;config-template xmlns="http://tail-f.com/ns/config/1.0" servicepoint="int-vlan-cfs"&amp;gt;
  &amp;lt;devices xmlns="http://tail-f.com/ns/ncs"&amp;gt;
      &amp;lt;device&amp;gt;
        &amp;lt;name&amp;gt;{$swname}&amp;lt;/name&amp;gt;
        &amp;lt;config&amp;gt;
              &amp;lt;interface xmlns="http://tail-f.com/ned/cisco-nx"&amp;gt;
                   &amp;lt;Vlan&amp;gt;
                        &amp;lt;name tags="create"&amp;gt;{$vlanid}&amp;lt;/name&amp;gt;
                        &amp;lt;ip&amp;gt;
                          &amp;lt;address tags="replace"&amp;gt;{$swipadd}&amp;lt;/address&amp;gt;
                        &amp;lt;/ip&amp;gt;
                        &amp;lt;description&amp;gt;Ma description de test&amp;lt;/description&amp;gt;
                   &amp;lt;/Vlan&amp;gt;
              &amp;lt;/interface&amp;gt;
        &amp;lt;/config&amp;gt;
      &amp;lt;/device&amp;gt;
   &amp;lt;/devices&amp;gt;
&amp;lt;/config-template&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 02 Aug 2024 14:55:04 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5155045#M8597</guid>
      <dc:creator>Marcel Zehnder</dc:creator>
      <dc:date>2024-08-02T14:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate evaluated values before pushing conf to device</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5155056#M8598</link>
      <description>&lt;P&gt;For such a simple service, I wanted to avoid using Python. Furthermore, Python doesn't seams to work on my free trial NSO copy (I don't want to go to the prod version for now). But I keep your Python code for further investigation &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks for you help.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 15:15:50 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5155056#M8598</guid>
      <dc:creator>Noel Cantenot</dc:creator>
      <dc:date>2024-08-02T15:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate evaluated values before pushing conf to device</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5155121#M8599</link>
      <description>&lt;P&gt;I‘m back in the office next week with access to NSO and will try it there.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 15:47:18 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5155121#M8599</guid>
      <dc:creator>Marcel Zehnder</dc:creator>
      <dc:date>2024-08-02T15:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate evaluated values before pushing conf to device</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5156116#M8600</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;The reason for "{./ip-add}" evaluating to empty node is that the this previous line triggers a context change:&lt;/P&gt;
&lt;PRE&gt;&amp;lt;name tags="create"&amp;gt;{../vlan-id}&amp;lt;/name&amp;gt;&lt;/PRE&gt;
&lt;P&gt;If you change it to:&lt;/P&gt;
&lt;PRE&gt;&amp;lt;name tags="create"&amp;gt;{string(../vlan-id)}&amp;lt;/name&amp;gt;&lt;/PRE&gt;
&lt;P&gt;You will avoid that context switch, and still have direct access the the ip-add intended for that switch. E.g. have a look in the&amp;nbsp; "Development Guide" section "XPath context in templates" last paragraph and example.&lt;/P&gt;
&lt;P&gt;br.&lt;/P&gt;
&lt;P&gt;Kristoffer Larsen&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2024 21:05:40 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5156116#M8600</guid>
      <dc:creator>radioman</dc:creator>
      <dc:date>2024-08-05T21:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate evaluated values before pushing conf to device</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5156257#M8601</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/637342"&gt;@radioman&lt;/a&gt;&amp;nbsp;I did not realize there is again a context switch with ../vlan-id.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 06:02:45 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5156257#M8601</guid>
      <dc:creator>Marcel Zehnder</dc:creator>
      <dc:date>2024-08-06T06:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate evaluated values before pushing conf to device</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5158382#M8604</link>
      <description>&lt;P&gt;Hello Noel,&lt;/P&gt;
&lt;P&gt;The evaluation NSO is exactly the same as a normal NSO. Python should work, it's probably something like the python in the PATH is not a python3 version.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;You are right that python is not needed for this. Did the answer from&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/637342"&gt;@radioman&lt;/a&gt;&amp;nbsp;not resolve your question?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2024 12:37:15 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5158382#M8604</guid>
      <dc:creator>snovello</dc:creator>
      <dc:date>2024-08-09T12:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate evaluated values before pushing conf to device</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5158411#M8605</link>
      <description>&lt;P&gt;Hello &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;snovello&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;I switched from 5.7 to 6.3, and no more python MV issue (I took care about default python version).&lt;/P&gt;&lt;P&gt;The answer of &amp;nbsp;&lt;A href="https://community.cisco.com/t5/user/viewprofilepage/user-id/637342" target="_blank" rel="noopener"&gt;@radioman&lt;/A&gt; explains the context behaviour, but do not resolve the agragation issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2024 13:12:36 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5158411#M8605</guid>
      <dc:creator>Noel Cantenot</dc:creator>
      <dc:date>2024-08-09T13:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate evaluated values before pushing conf to device</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5158424#M8606</link>
      <description>&lt;P&gt;My bad !!!&lt;/P&gt;&lt;P&gt;I mixed up with several proposed solution !&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/293649"&gt;@Marcel Zehnder&lt;/a&gt;solution with &lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/637342"&gt;@radioman&lt;/a&gt; modification makes it work !!&lt;/P&gt;&lt;P&gt;The thing is that I'm not sure to understand why... I will have a look at the doc &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2024 13:32:11 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/concatenate-evaluated-values-before-pushing-conf-to-device/m-p/5158424#M8606</guid>
      <dc:creator>Noel Cantenot</dc:creator>
      <dc:date>2024-08-09T13:32:11Z</dc:date>
    </item>
  </channel>
</rss>

