Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎08-12-2019 12:36 PM
Hi,
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.
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.
I got this working in my workflow with a http POST request aimed at URL http://10.10.10.10/jsonrpc/
and body {"method":"cli","id":"10","jsonrpc":"2.0","params":["show ports 1 info"]}
(all found in this doc: https://documentation.extremenetworks.com/app_notes/MMI/121152_MMI_Application_Release_Notes.pdf) but had to use a static ip address.
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.
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)..
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?
Hope this is clear,
Thanks in advance.
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.
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.
I got this working in my workflow with a http POST request aimed at URL http://10.10.10.10/jsonrpc/
and body {"method":"cli","id":"10","jsonrpc":"2.0","params":["show ports 1 info"]}
(all found in this doc: https://documentation.extremenetworks.com/app_notes/MMI/121152_MMI_Application_Release_Notes.pdf) but had to use a static ip address.
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.
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)..
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?
Hope this is clear,
Thanks in advance.
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎08-12-2019 10:04 PM
Hello Lennert,
For the MMI interaction you might want to look at the jsonrpc python class and its usage here:
https://github.com/extremenetworks/EXOS_Apps/tree/master/JSONRPC
Regards,
Ujwal
For the MMI interaction you might want to look at the jsonrpc python class and its usage here:
https://github.com/extremenetworks/EXOS_Apps/tree/master/JSONRPC
Regards,
Ujwal
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎08-13-2019 08:42 AM
Thanks for your answer Stephan.
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.
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.
Thanks Ujwal,
I didn't find this class yet, which is better detailed than other rpc classes I found.
This one works like a charm. I now used this class to get the data I need to continue.
Thank you both,
Lennert
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎08-12-2019 10:04 PM
Hello Lennert,
For the MMI interaction you might want to look at the jsonrpc python class and its usage here:
https://github.com/extremenetworks/EXOS_Apps/tree/master/JSONRPC
Regards,
Ujwal
For the MMI interaction you might want to look at the jsonrpc python class and its usage here:
https://github.com/extremenetworks/EXOS_Apps/tree/master/JSONRPC
Regards,
Ujwal
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎08-12-2019 09:04 PM
Hello Lennert,
first of all. If I understand your correctly you want to change vlans if an AP is active on a port.
If yes, there is a better way do realize that. Its the build in function "AP aware" see here:
https://gtacknowledge.extremenetworks.com/articles/How_To/EMC-How-to-enable-the-AP-Aware-Feature-in-...
With "AP Aware", NAC and policies you can change the vlans on a port if an AP is present.
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.
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.
Regards
Stephan
first of all. If I understand your correctly you want to change vlans if an AP is active on a port.
If yes, there is a better way do realize that. Its the build in function "AP aware" see here:
https://gtacknowledge.extremenetworks.com/articles/How_To/EMC-How-to-enable-the-AP-Aware-Feature-in-...
With "AP Aware", NAC and policies you can change the vlans on a port if an AP is present.
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.
code:
#Set Switch IP for example to the IP returned from notify
cli_result = emc_cli.setIpAddress(yourswitchIP)
#Send arbitrary cli comands like that
cli_result = emc_cli.send("conf vlan 10 del port 10")
#Check returns from switch
cli_output = cli_result.getOutput()
#Close session to switch
emc_cli.close()
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.
Regards
Stephan
Regards
Stephan
