<?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: Execute configuration script on APIC server in Controllers</title>
    <link>https://community.cisco.com/t5/controllers/execute-configuration-script-on-apic-server/m-p/4188546#M59</link>
    <description>&lt;P&gt;You can use &lt;STRONG&gt;urllib&lt;/STRONG&gt; module which is built-in, but the best way to deal with this is venv and install requests there:&lt;/P&gt;&lt;PRE&gt;admin@apic1: cd /data/techsupport/
admin@apic1:techsupport&amp;gt; 
admin@apic1:techsupport&amp;gt; python3 -m venv venv
admin@apic1:techsupport&amp;gt; source venv/bin/activate
(venv) admin@apic1:techsupport&amp;gt; pip install requests
&amp;lt;snip&amp;gt;
Installing collected packages: chardet, urllib3, certifi, idna, requests
Successfully installed certifi-2020.11.8 chardet-3.0.4 idna-2.10 requests-2.25.0 urllib3-1.26.2
WARNING: You are using pip version 19.2.3, however version 20.2.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(venv) admin@apic1:techsupport&amp;gt; python
Python 3.7.6 (default, Dec 20 2019, 15:05:20) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
&amp;gt;&amp;gt;&amp;gt; import requests&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: you just need to make sure you have internet access and DNS configured.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Stay safe,&lt;/P&gt;&lt;P&gt;Sergiu&lt;/P&gt;</description>
    <pubDate>Wed, 25 Nov 2020 08:30:10 GMT</pubDate>
    <dc:creator>Sergiu.Daniluk</dc:creator>
    <dc:date>2020-11-25T08:30:10Z</dc:date>
    <item>
      <title>Execute configuration script on APIC server</title>
      <link>https://community.cisco.com/t5/controllers/execute-configuration-script-on-apic-server/m-p/4185644#M58</link>
      <description>&lt;P&gt;I wrote a python script to apply a baseline configuration to fresh ACI fabrics utilizing the REST API.&lt;BR /&gt;It uses the 'requests' module and I tested it from my laptop successfully in our LAB.&lt;/P&gt;&lt;P&gt;One issue I'm running into, is that after so many requests the next will fail with 'the host did reset the connection'.&lt;BR /&gt;This may be due to transport issues, because introducing a 5 sec sleep every now and then will have the whole script work through just fine.&lt;/P&gt;&lt;P&gt;However, the plan was anyway to have a deployment engineer run the script directly on one of the APIC servers in the cluster, to avoid requiring another machine with python installed.&lt;/P&gt;&lt;P&gt;Now, it appears that neither python 2.7 nor python 3.7 (we're on 4.2(4p)) come with the 'requests' module installed, which took me off guard.&lt;/P&gt;&lt;P&gt;I'm not sure why such an essential module is missing from the APIC, but I'm now facing a redo of my script and wonder what to use as I'm not too keen to go the bash/icurl way.&lt;BR /&gt;Any suggestions are very much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 04:10:39 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/execute-configuration-script-on-apic-server/m-p/4185644#M58</guid>
      <dc:creator>andreas.blum</dc:creator>
      <dc:date>2020-11-19T04:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: Execute configuration script on APIC server</title>
      <link>https://community.cisco.com/t5/controllers/execute-configuration-script-on-apic-server/m-p/4188546#M59</link>
      <description>&lt;P&gt;You can use &lt;STRONG&gt;urllib&lt;/STRONG&gt; module which is built-in, but the best way to deal with this is venv and install requests there:&lt;/P&gt;&lt;PRE&gt;admin@apic1: cd /data/techsupport/
admin@apic1:techsupport&amp;gt; 
admin@apic1:techsupport&amp;gt; python3 -m venv venv
admin@apic1:techsupport&amp;gt; source venv/bin/activate
(venv) admin@apic1:techsupport&amp;gt; pip install requests
&amp;lt;snip&amp;gt;
Installing collected packages: chardet, urllib3, certifi, idna, requests
Successfully installed certifi-2020.11.8 chardet-3.0.4 idna-2.10 requests-2.25.0 urllib3-1.26.2
WARNING: You are using pip version 19.2.3, however version 20.2.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(venv) admin@apic1:techsupport&amp;gt; python
Python 3.7.6 (default, Dec 20 2019, 15:05:20) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
&amp;gt;&amp;gt;&amp;gt; import requests&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: you just need to make sure you have internet access and DNS configured.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Stay safe,&lt;/P&gt;&lt;P&gt;Sergiu&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 08:30:10 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/execute-configuration-script-on-apic-server/m-p/4188546#M59</guid>
      <dc:creator>Sergiu.Daniluk</dc:creator>
      <dc:date>2020-11-25T08:30:10Z</dc:date>
    </item>
  </channel>
</rss>

