<?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: Python http POST request in ExtremeSwitching (EXOS/Switch Engine)</title>
    <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-http-post-request/m-p/70679#M18820</link>
    <description>Hello Lennert,&lt;BR /&gt;
&lt;BR /&gt;
first of all. If I understand your correctly you want to change vlans if an AP is active on a port.&lt;BR /&gt;
If yes, there is a better way do realize that. Its the build in function "AP aware" see here:&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="https://gtacknowledge.extremenetworks.com/articles/How_To/EMC-How-to-enable-the-AP-Aware-Feature-in-EMC-s-Policy-Manager" target="_blank" rel="nofollow noreferrer noopener"&gt;https://gtacknowledge.extremenetworks.com/articles/How_To/EMC-How-to-enable-the-AP-Aware-Feature-in-EMC-s-Policy-Manager&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
With "AP Aware", NAC  and policies you can change the vlans on a port if an AP is present.&lt;BR /&gt;
&lt;BR /&gt;
If that's not the function you need. Its very ease to use the following commands in your workflow to run cli commands on a device managed by XMC.&lt;BR /&gt;
&lt;BR /&gt;
&lt;DIV class="threadCode"&gt;&lt;B&gt;code:&lt;/B&gt;&lt;PRE spellcheck="false"&gt;#Set Switch IP for example to the IP returned from notify&lt;BR /&gt;cli_result = emc_cli.setIpAddress(yourswitchIP)&lt;BR /&gt;&lt;BR /&gt;#Send arbitrary cli comands like that&lt;BR /&gt;cli_result = emc_cli.send("conf vlan 10 del port 10")&lt;BR /&gt;&lt;BR /&gt;#Check returns from switch&lt;BR /&gt;cli_output = cli_result.getOutput()&lt;BR /&gt;&lt;BR /&gt;#Close session to switch&lt;BR /&gt;emc_cli.close()&lt;BR /&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
If you use the mentioned command from XMC (scripts/workflows) there is no need to use the much more complex MMI functions. MMI is more suitable if you have not XMC.&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
Stephan</description>
    <pubDate>Tue, 13 Aug 2019 04:04:37 GMT</pubDate>
    <dc:creator>StephanH</dc:creator>
    <dc:date>2019-08-13T04:04:37Z</dc:date>
    <item>
      <title>Python http POST request</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-http-post-request/m-p/70678#M18819</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I'm quite new to XMC and Extreme in general and I'm trying to script that certain commands get send to switches when an AP gets connected/disconnected to it. For that purpose I'm using a notification and that triggers a workflow.&lt;BR /&gt;
Inside that workflow I'm trying to get the information I need to determine which commands I need to send to the switch. So for instance, I need to get 'show ports 1 info' so I can remove certain VLANs, so I need the show ports 1 info in a usable format.&lt;BR /&gt;
&lt;BR /&gt;
I got this working in my workflow with a http POST request aimed at URL http://10.10.10.10/jsonrpc/&lt;BR /&gt;
and body {"method":"cli","id":"10","jsonrpc":"2.0","params":["show ports 1 info"]} &lt;BR /&gt;
(all found in this doc: &lt;A href="https://documentation.extremenetworks.com/app_notes/MMI/121152_MMI_Application_Release_Notes.pdf" target="_blank" rel="nofollow noreferrer noopener"&gt;https://documentation.extremenetworks.com/app_notes/MMI/121152_MMI_Application_Release_Notes.pdf&lt;/A&gt;) but had to use a static ip address.&lt;BR /&gt;
&lt;BR /&gt;
My first question is: could I use a dynamic ip adress in the http activity input? as http://ipaddress/jsonrpc/ because I couldn't get it to work.&lt;BR /&gt;
&lt;BR /&gt;
What I tried after that was script this POST request in Python (using the requests library) so I can dynamically use an IP adress and advance with the data I would get with the response. But I can't get that to work as my authentication seems invalid (I used basic admin-password authentication).. &lt;BR /&gt;
&lt;BR /&gt;
Now my second question is: which parameters do I have to give the POST to be able to get the information that I need and how can I get the authentication to work?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Hope this is clear,&lt;BR /&gt;
Thanks in advance.</description>
      <pubDate>Mon, 12 Aug 2019 19:36:17 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-http-post-request/m-p/70678#M18819</guid>
      <dc:creator>Lennert_VL</dc:creator>
      <dc:date>2019-08-12T19:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: Python http POST request</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-http-post-request/m-p/70679#M18820</link>
      <description>Hello Lennert,&lt;BR /&gt;
&lt;BR /&gt;
first of all. If I understand your correctly you want to change vlans if an AP is active on a port.&lt;BR /&gt;
If yes, there is a better way do realize that. Its the build in function "AP aware" see here:&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="https://gtacknowledge.extremenetworks.com/articles/How_To/EMC-How-to-enable-the-AP-Aware-Feature-in-EMC-s-Policy-Manager" target="_blank" rel="nofollow noreferrer noopener"&gt;https://gtacknowledge.extremenetworks.com/articles/How_To/EMC-How-to-enable-the-AP-Aware-Feature-in-EMC-s-Policy-Manager&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
With "AP Aware", NAC  and policies you can change the vlans on a port if an AP is present.&lt;BR /&gt;
&lt;BR /&gt;
If that's not the function you need. Its very ease to use the following commands in your workflow to run cli commands on a device managed by XMC.&lt;BR /&gt;
&lt;BR /&gt;
&lt;DIV class="threadCode"&gt;&lt;B&gt;code:&lt;/B&gt;&lt;PRE spellcheck="false"&gt;#Set Switch IP for example to the IP returned from notify&lt;BR /&gt;cli_result = emc_cli.setIpAddress(yourswitchIP)&lt;BR /&gt;&lt;BR /&gt;#Send arbitrary cli comands like that&lt;BR /&gt;cli_result = emc_cli.send("conf vlan 10 del port 10")&lt;BR /&gt;&lt;BR /&gt;#Check returns from switch&lt;BR /&gt;cli_output = cli_result.getOutput()&lt;BR /&gt;&lt;BR /&gt;#Close session to switch&lt;BR /&gt;emc_cli.close()&lt;BR /&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
If you use the mentioned command from XMC (scripts/workflows) there is no need to use the much more complex MMI functions. MMI is more suitable if you have not XMC.&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
Stephan</description>
      <pubDate>Tue, 13 Aug 2019 04:04:37 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-http-post-request/m-p/70679#M18820</guid>
      <dc:creator>StephanH</dc:creator>
      <dc:date>2019-08-13T04:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Python http POST request</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-http-post-request/m-p/70680#M18821</link>
      <description>Hello Lennert,&lt;BR /&gt;
&lt;BR /&gt;
For the MMI interaction you might want to look at the jsonrpc python class and its usage here:&lt;BR /&gt;
https://github.com/extremenetworks/EXOS_Apps/tree/master/JSONRPC&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Ujwal</description>
      <pubDate>Tue, 13 Aug 2019 05:04:17 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-http-post-request/m-p/70680#M18821</guid>
      <dc:creator>ukomarla</dc:creator>
      <dc:date>2019-08-13T05:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: Python http POST request</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-http-post-request/m-p/70681#M18822</link>
      <description>&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your answer Stephan. &lt;BR /&gt;
&lt;BR /&gt;
AP Aware is not versatile enough what I'm trying to accomplish. I am trying to map the necessary nsi's so add/delete them accordingly. So I need a means to read out the VLAN for every port and finally determine if a nsi can stay or needs to be deleted. Which I am trying to script at the moment.&lt;BR /&gt;
&lt;BR /&gt;
So now I am trying to get 'show ports 1' e.g. into a useable format so that I can determine which nsi's can be deleted.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks Ujwal,&lt;BR /&gt;
&lt;BR /&gt;
I didn't find this class yet, which is better detailed than other rpc classes I found. &lt;BR /&gt;
This one works like a charm. I now used this class to get the data I need to continue.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thank you both,&lt;BR /&gt;
Lennert</description>
      <pubDate>Tue, 13 Aug 2019 15:42:08 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-http-post-request/m-p/70681#M18822</guid>
      <dc:creator>Lennert_VL</dc:creator>
      <dc:date>2019-08-13T15:42:08Z</dc:date>
    </item>
  </channel>
</rss>

