<?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: load-native-config action in NSO python in NSO Developer Hub Discussions</title>
    <link>https://community.cisco.com/t5/nso-developer-hub-discussions/load-native-config-action-in-nso-python/m-p/4944362#M8137</link>
    <description>&lt;P&gt;Try load_native_output.info&lt;BR /&gt;See $NCS_DIR/&lt;SPAN class="s1"&gt;src/ncs/yang/tailf-ncs-devices.yang&amp;nbsp;&lt;/SPAN&gt;under&amp;nbsp;&lt;SPAN class="s1"&gt;load-native-config for input and output parameters.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Oct 2023 15:37:11 GMT</pubDate>
    <dc:creator>cohult</dc:creator>
    <dc:date>2023-10-19T15:37:11Z</dc:date>
    <item>
      <title>load-native-config action in NSO python</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/load-native-config-action-in-nso-python/m-p/4931104#M8082</link>
      <description>&lt;P&gt;I want to write code for calling&amp;nbsp;the action load-native-config in python.&lt;/P&gt;
&lt;P&gt;What is a sample code for doing that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 16:50:09 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/load-native-config-action-in-nso-python/m-p/4931104#M8082</guid>
      <dc:creator>suvdeshm</dc:creator>
      <dc:date>2023-09-28T16:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: load-native-config action in NSO python</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/load-native-config-action-in-nso-python/m-p/4931262#M8083</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here an example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import ncs

device_name="NETSIM-XR-0"


config="""
hostname TEST-PYTHON

"""


print(f"Loading config {config} on device {device_name}")
with ncs.maapi.Maapi() as m:
        with ncs.maapi.Session(m, 'admin', 'python', groups=['ncsadmin']):
                with m.start_write_trans() as t:
                        root = ncs.maagic.get_root(t)
                        load_native_input = root.devices.device[device_name].load_native_config.get_input()
                        load_native_input.data = config
                        load_native_output = root.devices.device[device_name].load_native_config(load_native_input)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 22:08:03 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/load-native-config-action-in-nso-python/m-p/4931262#M8083</guid>
      <dc:creator>Nabsch</dc:creator>
      <dc:date>2023-09-28T22:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: load-native-config action in NSO python</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/load-native-config-action-in-nso-python/m-p/4943184#M8135</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;From the above solution, when I try to access: load_native_output.result , then I get the below error:-&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt; 'ActionParams' object has no attribute 'result'&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 17:30:39 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/load-native-config-action-in-nso-python/m-p/4943184#M8135</guid>
      <dc:creator>suvdeshm</dc:creator>
      <dc:date>2023-10-18T17:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: load-native-config action in NSO python</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/load-native-config-action-in-nso-python/m-p/4944362#M8137</link>
      <description>&lt;P&gt;Try load_native_output.info&lt;BR /&gt;See $NCS_DIR/&lt;SPAN class="s1"&gt;src/ncs/yang/tailf-ncs-devices.yang&amp;nbsp;&lt;/SPAN&gt;under&amp;nbsp;&lt;SPAN class="s1"&gt;load-native-config for input and output parameters.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 15:37:11 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/load-native-config-action-in-nso-python/m-p/4944362#M8137</guid>
      <dc:creator>cohult</dc:creator>
      <dc:date>2023-10-19T15:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: load-native-config action in NSO python</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/load-native-config-action-in-nso-python/m-p/4947981#M8165</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I am still getting an error parsing the response:--&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;load_native_input = root.devices.device[device_name].load_native_config.get_input() load_native_input.data = config load_native_input.dry_run.outformat = "native" load_output = root.devices.device[device_name].load_native_config(load_native_input) self.log.info("result") self.log.info(load_output.native.device[device_name].data) The last line parses the result and gives an error: &amp;lt;INFO&amp;gt; 19-Oct-2023::11:21:56.182 act-load-native ncs-dp-34481-act-load-native:main-1-usid-130-act-load-native: - action name: act-load-native &amp;lt;INFO&amp;gt; 19-Oct-2023::11:21:56.182 act-load-native ncs-dp-34481-act-load-native:main-1-usid-130-act-load-native: - config in fileinterface TenGigabitEthernet0/1/1 description SERV_005 &amp;lt;INFO&amp;gt; 19-Oct-2023::11:21:56.196 act-load-native ncs-dp-34481-act-load-native:main-1-usid-130-act-load-native: - device name isxe0 &amp;lt;INFO&amp;gt; 19-Oct-2023::11:21:56.547 act-load-native ncs-dp-34481-act-load-native:main-1-usid-130-act-load-native: - result &amp;lt;ERROR&amp;gt; 19-Oct-2023::11:21:56.548 act-load-native ncs-dp-34481-act-load-native:main-1-usid-130-act-load-native: - Error in ActLoadNativeConfigAction &amp;lt;ERROR&amp;gt; 19-Oct-2023::11:21:56.548 act-load-native ncs-dp-34481-act-load-native:main-1-usid-130-act-load-native: - '{xe0} not in /native/device' &amp;lt;ERROR&amp;gt; 19-Oct-2023::11:21:56.549 act-load-native ncs-dp-34481-act-load-native:main-1-usid-130-act-load-native: - Traceback (most recent call last): File "/Users/suvdeshm/run-5.6.41/state/packages-in-use/1/act-load-native/python/act_load_native/main.py", line 99, in cb_action self.log.info(load_output.native.device[device_name].data) File "/Users/suvdeshm/nso-5.6.4/src/ncs/pyapi/ncs/maagic.py", line 1102, in __getitem__ raise KeyError('%s not in %s' % (keystr, self._path)) KeyError: '{xe0} not in /native/device'&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 17:42:10 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/load-native-config-action-in-nso-python/m-p/4947981#M8165</guid>
      <dc:creator>suvdeshm</dc:creator>
      <dc:date>2023-10-25T17:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: load-native-config action in NSO python</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/load-native-config-action-in-nso-python/m-p/4948416#M8167</link>
      <description>&lt;P&gt;The load-native-config action does not commit the transaction when using MAAPI as it does with, for example, RESTCONF.&lt;BR /&gt;So, after loading the native config, if you want the output of a dry-run and then commit/apply the transaction, try something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;...
self.log.info("result")
t = ncs.maagic.get_trans(root)
params = t.get_params()
params.dry_run_native()
result = t.apply_params(True, params)
self.log.info(result['local-node'])
t.apply_params(True, t.get_params())&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See &lt;A href="https://developer.cisco.com/docs/nso/api/#!ncs-maapi/ncs.maapi.Transaction.apply_params" target="_blank"&gt;https://developer.cisco.com/docs/nso/api/#!ncs-maapi/ncs.maapi.Transaction.apply_params&lt;/A&gt;&amp;nbsp;for details&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;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 07:42:47 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/load-native-config-action-in-nso-python/m-p/4948416#M8167</guid>
      <dc:creator>cohult</dc:creator>
      <dc:date>2023-10-26T07:42:47Z</dc:date>
    </item>
  </channel>
</rss>

