Solved

Import Devices Into XMC

  • 3 March 2021
  • 9 replies
  • 94 views

Userlevel 6
Badge

Hi,

Have several hundred none Extreme devices I need to add into XMC that are generally unique IP address, under ping only, probably will configure each as out of service as monitoring them is not important.

Obviously only being able to add these in one at a time would be a considerable amount of work. The discovery options (that I can see) wouldn’t work for me as putting in subnet ranges for these would equally be as time consuming, even if I was able to use SNMP (could use seed, but not an option) and besides there not being a ping option anyway, if there was, it would pick up more then just the switches.

The primary reason for adding the switches is just to add them into control as RADIUS clients, as management login for all these switches is being done through XMC / ExtremeControl.

Thought there was a way, maybe more in the legacy (although can’t find it) that allows me to import devices, but been unable to find it?

Currently running latest version 8.5.5.32.

Many thanks in advance for any ideas.

icon

Best answer by Martin Flammia 19 March 2021, 13:01

Just see this:

https://github.com/extremenetworks/ExtremeScripting/tree/master/Netsight/oneview_workflows

There is a workflow listed called Import Devices

This looks like exactly what was needed, so putting here for anyone else whom might come across the same query.

 

View original

9 replies

Userlevel 6

Probably using the rest api.

/services/device/create/{ipAddress}/{nickName} Create a device

Script it to insert IP’s from a file.

 

/oscar

Userlevel 6
Badge

Thanks Oscar.

That’s helped me, not that I maybe doing in best way but given me something to work with.

Was trying to dig up some material about putting some context around using REST API calls, but couldn’t find anything quickly.

Initially I went to the following URL:

https://<ip address>:8443/Clients/nbi/graphiql/index.html

Via the ‘NBI Explorer’ link in XMC shown below:

Which take’s me to GraphiQL

 

I was trying to find something in there that lead me to something along the lines of the URL you provided, via the Documentation Explorer on the top right

/services/device/create/{ipAddress}/{nickName} 

Instead I come across this:

https://emc.extremenetworks.com/content/oneview/docs/connect/docs/netsight_device_web_service/ov_connect_netsightdevice.htm

Specifically this method:

Method: addDeviceEx

https://emc.extremenetworks.com/content/oneview/docs/connect/docs/netsight_device_web_service/ov_connect_netsightdevice_method_adddeviceex.htm

The example provided is as follows:

https://192.168.30.34:8443/axis/services/NetSightDeviceWebService/addDeviceEx?ipAddress=192.168.10.25&profileName=public_v1_Profile&snmpContext=&nickName=Fake-Switch

So I initially wasn’t sure how to convert this into the exact line I needed, so I initially run a query using this method

Method: getAllDevices

Here is the example:

https://192.168.30.34:8443/axis/services/NetSightDeviceWebService/getAllDevices

I then looked at an entry I already had in XMC for ping only:

And then used that information in that to formulate the string, which now looked like:

https://<enter ip address>:8443/axis/services/NetSightDeviceWebService/addDeviceEx?ipAddress=xx.xx.xx.xx&profileName=<Ping Only>&snmpContext=&nickName=Switch1

After running that it added it into XMC perfectly!

So maybe not the same way you mentioned but think I can adapt that do what I need on mass, with a workflow. What I will work on next and post back when done.

 

Userlevel 6

Go to Connect on XMC, then services api, there you will find some examples.

 

Userlevel 6
Badge

Ah, that's where it is. Thanks Oscar.

Did add another post about a different method I used whilst I was trying to find my feet on the API. It went to moderator, so should hopefully show soon.

Will have a look at the services API now.

Cheers

Userlevel 6
Badge

I’ve got as far as the following.

I need to spend more time with workflows (do cutting a few corners), so I’m cheating and trying to run a python script straight from my PC

I created the following:

Which I got the following error:

This was due to the space in the URL string in <Ping Only>, replacing the space with a %20 got past that issue

Then I got another issue:

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)

So to get around that using the example below:

Now I get this error:

urllib.error.HTTPError: HTTP Error 400: Bad Request

Yet if I take the URL as is, replace the %20 back for a space:

So not sure what's causing that Bad Request at the moment, maybe not the right call in the script?

Anyway, just posting for ideas

Thanks

Userlevel 7
Badge +1

Hello Martin,

I think the module urllib.request leads you in the wrong direction. Check out the following guide

https://api.extremenetworks.com/XMC/Scripting/Python_with_XMC_8.1_v0.94.pdf

 

Userlevel 7
Badge +1

In addition you can check if the NBI-Client written by Markus is something you can use.

https://github.com/extremenetworks/ExtremeScripting/blob/master/Netsight/nbi_clients/README.md

Userlevel 6
Badge

Thanks Stephen for the information.

Next on my list is to fully understand the NBI component and get a bit more familiar with Python.

As I started delving into it, it was just taking me down a rabbit warren that I’ll invest the time in at a later date.

I did figured out why the I was getting

urllib.error.HTTPError: HTTP Error 400: Bad Request

Its because I needed to change the section in the URL from:

<Ping Only>

And replace it with:

%3CPing%20Only%3E

The code then just presented me with another error:

urllib.error.HTTPError: HTTP Error 401: Unauthorized

So I gave up (time running out), and just created a list of URLs based on the formula above (took a few minutes) in Excel, each URL looked like this:

Which I just simply clicked on one at a time!

Again didn’t take me too long, but least it was way way faster then having to have put them in one at a time directly into XMC :)

Userlevel 6
Badge

Just see this:

https://github.com/extremenetworks/ExtremeScripting/tree/master/Netsight/oneview_workflows

There is a workflow listed called Import Devices

This looks like exactly what was needed, so putting here for anyone else whom might come across the same query.

 

Reply