<?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: delete node from Python with service._path in NSO Developer Hub Discussions</title>
    <link>https://community.cisco.com/t5/nso-developer-hub-discussions/delete-node-from-python-with-service-path/m-p/4095422#M5306</link>
    <description>Yes I do, but as I say its only delete the Python pointer object and not the node in the CDB.</description>
    <pubDate>Mon, 01 Jun 2020 12:11:21 GMT</pubDate>
    <dc:creator>Gastonper</dc:creator>
    <dc:date>2020-06-01T12:11:21Z</dc:date>
    <item>
      <title>delete node from Python with service._path</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/delete-node-from-python-with-service-path/m-p/4091825#M5271</link>
      <description>&lt;P&gt;Hi, I have the following problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a services (service A) that when is created populate his path in another service (Service B). Service B have multiple path of instances of service A.&lt;/P&gt;&lt;P&gt;I want to make an action that read all service path in Service B, and delete the corresponding services A.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the problem, to get the service object in Python from the path string I use:&lt;/P&gt;&lt;PRE&gt;service_to_delete = ncs.maagic.get_node(t, service_path)&lt;BR /&gt;del service_to_delete&lt;/PRE&gt;&lt;P&gt;But this only delete the Python object service_to_delete, and not the CDB service, as is explained in the nso docs.&lt;/P&gt;&lt;P&gt;If I use:&lt;/P&gt;&lt;PRE&gt;del ncs.maagic.get_node(t, service_path)&lt;/PRE&gt;&lt;P&gt;I get an error on package reload:&lt;/P&gt;&lt;PRE&gt;*** ALARM package-load-failure: [SyntaxError: can't delete function call]&lt;/PRE&gt;&lt;P&gt;Is there a delete_node() function or a workaround to solve this?&lt;/P&gt;</description>
      <pubDate>Mon, 25 May 2020 19:52:24 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/delete-node-from-python-with-service-path/m-p/4091825#M5271</guid>
      <dc:creator>Gastonper</dc:creator>
      <dc:date>2020-05-25T19:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: delete node from Python with service._path</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/delete-node-from-python-with-service-path/m-p/4095001#M5302</link>
      <description>&lt;P&gt;WIth the first option, are you applying the transaction in which you use 'del service_to_delete'?&lt;/P&gt;</description>
      <pubDate>Sun, 31 May 2020 06:13:01 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/delete-node-from-python-with-service-path/m-p/4095001#M5302</guid>
      <dc:creator>yfherzog</dc:creator>
      <dc:date>2020-05-31T06:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: delete node from Python with service._path</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/delete-node-from-python-with-service-path/m-p/4095422#M5306</link>
      <description>Yes I do, but as I say its only delete the Python pointer object and not the node in the CDB.</description>
      <pubDate>Mon, 01 Jun 2020 12:11:21 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/delete-node-from-python-with-service-path/m-p/4095422#M5306</guid>
      <dc:creator>Gastonper</dc:creator>
      <dc:date>2020-06-01T12:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: delete node from Python with service._path</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/delete-node-from-python-with-service-path/m-p/4544768#M6809</link>
      <description>&lt;P&gt;You have to delete the &lt;STRONG&gt;child&lt;/STRONG&gt;(item) of the node so when you call the &lt;STRONG&gt;del&lt;/STRONG&gt; statement you have to mention which item you want to delete. In this case we have to identify the instance to be deleted by its name, so it had to look something like this:&lt;/P&gt;
&lt;PRE&gt;service_to_delete = ncs.maagic.get_node(t, service_path)&lt;BR /&gt;del service_to_delete[service_name]&lt;BR /&gt;t.apply&lt;/PRE&gt;
&lt;P&gt;Hope it helps.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 13:09:56 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/delete-node-from-python-with-service-path/m-p/4544768#M6809</guid>
      <dc:creator>cealves</dc:creator>
      <dc:date>2022-02-03T13:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: delete node from Python with service._path</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/delete-node-from-python-with-service-path/m-p/5146436#M8565</link>
      <description>&lt;P&gt;You can delete the instance using _ncs.maapi.delete()&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;service_to_delete = ncs.maagic.get_node(t, service_path)
_ncs.maapi.delete(m.msock, t.th, service_to_delete._path)
t.apply()&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 18 Jul 2024 05:48:59 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/delete-node-from-python-with-service-path/m-p/5146436#M8565</guid>
      <dc:creator>akumartm</dc:creator>
      <dc:date>2024-07-18T05:48:59Z</dc:date>
    </item>
  </channel>
</rss>

