Header Only - DO NOT REMOVE - Extreme Networks

Get XMC licenses via script or Rest-API


Userlevel 5
Hello,

is there a way to get the current licenses via script or REST-API?

I need the info how many End-Systems for NAC are licensed to proceed in another script.
If I can get the license string it's easy do find out that value.

Or is there another place where I can find the information how many end systems for NAC are licensed?

Best regards
Stephan

13 replies

Userlevel 4
Hi SH,

Current ES count updated in NAC manager ---> configuration tab--> license status.

if you right click on a appliance and go to web view ---> End system authentication status , where we can see how many ES are managed during last 24 horus.

Thanks,

Suresh.B
Userlevel 5
Hello Suresh,

thank you for you fast replay. But I need the info in an script/python program, because of I will process the license information in an script.

Best regards
Stephan
Userlevel 4
Hi Stephan,

Could you share your python script which will look for license file ? if you have one already.

The license file is located in below location but we have to use the pointer to locate below file.

root@xmc52.extremenetworks.com:/usr/local/Extreme_Networks/NetSight/appdata/license$ ls
NetSightEval.lic

Thanks,
Suresh.B
Userlevel 5
Bharathiraja, Suresh wrote:

Hi Stephan,

Could you share your python script which will look for license file ? if you have one already.

The license file is located in below location but we have to use the pointer to locate below file.

root@xmc52.extremenetworks.com:/usr/local/Extreme_Networks/NetSight/appdata/license$ ls
NetSightEval.lic

Thanks,
Suresh.B

Thank you very much Suresh,

that's what I need. I had forgotten that there is this file.

I have no python script up to now, because I needed first the info how I can get the license 🙂.
Userlevel 4
Hi Stephan,

Sure ,

Please share us the status once you able to get the info by using Python.

Thanks,
Suresh.B
Userlevel 5
Hello Suresh,

here a little Python script working for me:

Best regards
Stephan

import re import sys #open license file try: f = open('/usr/local/Extreme_Networks/NetSight/appdata/license/NacEnterprise.lic', 'r') except IOError: print "Can't open license file" sys.exit(0) #sum single licenses licenses = 0 for x in f: reg = re.search(r"IA-ES-([13]|12)K", x) lic = reg.group(1) lic = int(lic) * 1000 licenses = licenses + lic #print sum of single licenses print licenses
[/code]
Userlevel 5
SH wrote:

Hello Suresh,

here a little Python script working for me:

Best regards
Stephan

import re import sys #open license file try: f = open('/usr/local/Extreme_Networks/NetSight/appdata/license/NacEnterprise.lic', 'r') except IOError: print "Can't open license file" sys.exit(0) #sum single licenses licenses = 0 for x in f: reg = re.search(r"IA-ES-([13]|12)K", x) lic = reg.group(1) lic = int(lic) * 1000 licenses = licenses + lic #print sum of single licenses print licenses
[/code]

One little hint.
I do not care about other licenses in the license file (maybe there are assessment licenses or anything else) with the script. Because in my case I have only NAC licenses!!!
Userlevel 7
SH wrote:

Hello Suresh,

here a little Python script working for me:

Best regards
Stephan

import re import sys #open license file try: f = open('/usr/local/Extreme_Networks/NetSight/appdata/license/NacEnterprise.lic', 'r') except IOError: print "Can't open license file" sys.exit(0) #sum single licenses licenses = 0 for x in f: reg = re.search(r"IA-ES-([13]|12)K", x) lic = reg.group(1) lic = int(lic) * 1000 licenses = licenses + lic #print sum of single licenses print licenses
[/code]

Thanks for sharing!
SH wrote:

Hello Suresh,

here a little Python script working for me:

Best regards
Stephan

import re import sys #open license file try: f = open('/usr/local/Extreme_Networks/NetSight/appdata/license/NacEnterprise.lic', 'r') except IOError: print "Can't open license file" sys.exit(0) #sum single licenses licenses = 0 for x in f: reg = re.search(r"IA-ES-([13]|12)K", x) lic = reg.group(1) lic = int(lic) * 1000 licenses = licenses + lic #print sum of single licenses print licenses
[/code]

You might also try your luck with GraphQL based NBI (https://:8443/nbi/graphiql/index.html?query=%7B%0A%20%20accessControl%20%7B%0A%20%20%20...) or Reporting SOAP API (https://emc.extremenetworks.com/content/oneview/docs/connect/docs/reporting_web_service/r_ov_connect...)
Userlevel 5
SH wrote:

Hello Suresh,

here a little Python script working for me:

Best regards
Stephan

import re import sys #open license file try: f = open('/usr/local/Extreme_Networks/NetSight/appdata/license/NacEnterprise.lic', 'r') except IOError: print "Can't open license file" sys.exit(0) #sum single licenses licenses = 0 for x in f: reg = re.search(r"IA-ES-([13]|12)K", x) lic = reg.group(1) lic = int(lic) * 1000 licenses = licenses + lic #print sum of single licenses print licenses
[/code]

Hello Alexander,

thank you for you hint.

I love the Rest(SOAP)-API but the report_web_services are quite complex (for me).
Because of you have to figure out the correct data types Therefore to read the license info from the mentioned file is much easier.

But you hint with GraphiQL is a good alternative.

Best regards
Stephan
SH wrote:

Hello Suresh,

here a little Python script working for me:

Best regards
Stephan

import re import sys #open license file try: f = open('/usr/local/Extreme_Networks/NetSight/appdata/license/NacEnterprise.lic', 'r') except IOError: print "Can't open license file" sys.exit(0) #sum single licenses licenses = 0 for x in f: reg = re.search(r"IA-ES-([13]|12)K", x) lic = reg.group(1) lic = int(lic) * 1000 licenses = licenses + lic #print sum of single licenses print licenses
[/code]

Is there any documentation on the GraphiQL interface?
Userlevel 5
SH wrote:

Hello Suresh,

here a little Python script working for me:

Best regards
Stephan

import re import sys #open license file try: f = open('/usr/local/Extreme_Networks/NetSight/appdata/license/NacEnterprise.lic', 'r') except IOError: print "Can't open license file" sys.exit(0) #sum single licenses licenses = 0 for x in f: reg = re.search(r"IA-ES-([13]|12)K", x) lic = reg.group(1) lic = int(lic) * 1000 licenses = licenses + lic #print sum of single licenses print licenses
[/code]

Hello James,

I do not know a printed documentation. But I think all you need is here:

GraphiQL for testing and documentation

https://:8443/nbi/graphiql/index.html



GraphQL schema

https://:8443/nbi/graphql/schema.idl



GraphQL API

https://:8443/nbi/graphql

Have fun!

Best regards
Stephan
SH wrote:

Hello Suresh,

here a little Python script working for me:

Best regards
Stephan

import re import sys #open license file try: f = open('/usr/local/Extreme_Networks/NetSight/appdata/license/NacEnterprise.lic', 'r') except IOError: print "Can't open license file" sys.exit(0) #sum single licenses licenses = 0 for x in f: reg = re.search(r"IA-ES-([13]|12)K", x) lic = reg.group(1) lic = int(lic) * 1000 licenses = licenses + lic #print sum of single licenses print licenses
[/code]

For the XMC version I use there are two links that gave me some intro into the GraphQL:

https://XMC:8443/nbi/graphql/schema.idl
https://XMC:8443/nbi/graphiql/index.html (make sure to open the panel on the right side):
https://i.snag.gy/l6txLk.jpg

Reply