<?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: Support for context manager in Tools</title>
    <link>https://community.cisco.com/t5/tools/support-for-context-manager/m-p/3522201#M2978</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry I meant for the service provider.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without a support for 'with' statement, we have to wrap the service provider in a try/finally block.&amp;nbsp; Like&lt;/P&gt;&lt;P&gt;this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sp_instance = NetconfServiceProvider(address='1.1.1.1', &lt;SPAN style="font-size: 10pt;"&gt;port=830, &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;username='cisco', &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;password='cisco', &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;protocol='ssh')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do something&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;finally:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sp_instance.close()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many network engineers who may not necessarily have programming experience may forget to close the session, and that leaves netconf session opened on the router.&amp;nbsp; If we do this enough we may exhaust session resources on the router/switch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can we add the dunder enter/exit method on the provider class so we can do this ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with NetconfServiceProvider(....) as xr:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do something&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the exit method will always properly close the session.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 Jun 2017 15:31:37 GMT</pubDate>
    <dc:creator>Chalermchai D Hoonpongsimanont</dc:creator>
    <dc:date>2017-06-15T15:31:37Z</dc:date>
    <item>
      <title>Support for context manager</title>
      <link>https://community.cisco.com/t5/tools/support-for-context-manager/m-p/3522199#M2976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can we add a support for context manager so we can use 'with' statement to ensure every manager is closed properly?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need dunder __enter__ and __exit__ added to the manager class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jun 2017 21:11:17 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/support-for-context-manager/m-p/3522199#M2976</guid>
      <dc:creator>Chalermchai D Hoonpongsimanont</dc:creator>
      <dc:date>2017-06-14T21:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: Support for context manager</title>
      <link>https://community.cisco.com/t5/tools/support-for-context-manager/m-p/3522200#M2977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which "manager" class are you referring to?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Einar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jun 2017 14:21:25 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/support-for-context-manager/m-p/3522200#M2977</guid>
      <dc:creator>einarnn</dc:creator>
      <dc:date>2017-06-15T14:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: Support for context manager</title>
      <link>https://community.cisco.com/t5/tools/support-for-context-manager/m-p/3522201#M2978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry I meant for the service provider.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without a support for 'with' statement, we have to wrap the service provider in a try/finally block.&amp;nbsp; Like&lt;/P&gt;&lt;P&gt;this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sp_instance = NetconfServiceProvider(address='1.1.1.1', &lt;SPAN style="font-size: 10pt;"&gt;port=830, &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;username='cisco', &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;password='cisco', &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;protocol='ssh')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do something&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;finally:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sp_instance.close()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many network engineers who may not necessarily have programming experience may forget to close the session, and that leaves netconf session opened on the router.&amp;nbsp; If we do this enough we may exhaust session resources on the router/switch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can we add the dunder enter/exit method on the provider class so we can do this ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with NetconfServiceProvider(....) as xr:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do something&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the exit method will always properly close the session.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jun 2017 15:31:37 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/support-for-context-manager/m-p/3522201#M2978</guid>
      <dc:creator>Chalermchai D Hoonpongsimanont</dc:creator>
      <dc:date>2017-06-15T15:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: Support for context manager</title>
      <link>https://community.cisco.com/t5/tools/support-for-context-manager/m-p/3522202#M2979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree that this would be a good enhancement for the ServiceProvider classes. Feel free to raise an issue for this on github and we will address it &lt;A href="https://github.com/CiscoDevNet/ydk-gen/issues" title="https://github.com/CiscoDevNet/ydk-gen/issues"&gt;Issues · CiscoDevNet/ydk-gen · GitHub&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jun 2017 16:16:20 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/support-for-context-manager/m-p/3522202#M2979</guid>
      <dc:creator>abhirame</dc:creator>
      <dc:date>2017-06-15T16:16:20Z</dc:date>
    </item>
  </channel>
</rss>

