Get Started with Mellanox NEO REST API

Version 3

    This post shows how to get started with Mellanox NEO REST API.

    This post is meant for advanced users, such as IT managers and developers.

     

    References

     

    In order to get started with Mellanox NEO REST API, a software tool that can perform REST operations such as GET/POST/PUT/DELETE is required.

    Various tools can be used. For example:

    The example below is from the I'm Only Resting tool.

     

    Setup

    Make sure you have Mellanox NEO installed on the network.

     

    Configuration

     

    1. Download and install the I'm Only Resting tool.

     

    2. Perform the login operation in order to get the session cookie:

     

    Set the proper username and password.

     

    For example:

     

    1.PNG

     

    Make sure that the Response Status is 200 OK, and the Response Body is /neo

     

    Select the Response Headers tab to extract (copy) the session cookie string.

    2.PNG


    3. Following the successful login process, you must add the session cookie to each REST call on the Headers field.

     

    Headers:

    Content-Type: Content-Type: application/json

    Cookie: session=<Session ID>

     

    4. GET operation example: Get Events

     

    Content-Type: application/json

    session=.eJyrVopPK0otzlCyKikqTdVRis9MUbKqVlJIUrJS8ncJy43M8jSMDPHK9gvxNPKryq7wc0nJjcpyNY3MDcr0d0k28Q_xyvALcbVVqgXqLUgtyk3MS80rgZlWWpxaBDZRKTElNzNPqRYA5aMktw.CKVuNw._1XlPSdpXRWha5cEjWjiXhH6104

    • Body: <empty>

     

    3.PNG

     

    The Response body will hold the events structure.

     

    Make sure that the Response Status is 200 OK

     

    5. Post operation example: Create a group (of switches)

     

    Content-Type: application/json

    session=.eJyrVopPK0otzlCyKikqTdVRis9MUbKqVlJIUrJS8ncJy43M8jSMDPHK9gvxNPKryq7wc0nJjcpyNY3MDcr0d0k28Q_xyvALcbVVqgXqLUgtyk3MS80rgZlWWpxaBDZRKTElNzNPqRYA5aMktw.CKVuNw._1XlPSdpXRWha5cEjWjiXhH6104

    • Body:

    {

    “elementName”: “my-group-name”,

    “description”: “my-group-description”

    }

    4.PNG

    Make sure that the Response Status is 201 CREATED.

     

    Verify that the group was created via the GUI:

    5.PNG

     

    6. Post operation example: Add systems/switches a group

     

    Content-Type: application/json

    session=.eJyrVopPK0otzlCyKikqTdVRis9MUbKqVlJIUrJS8ncJy43M8jSMDPHK9gvxNPKryq7wc0nJjcpyNY3MDcr0d0k28Q_xyvALcbVVqgXqLUgtyk3MS80rgZlWWpxaBDZRKTElNzNPqRYA5aMktw.CKVuNw._1XlPSdpXRWha5cEjWjiXhH6104

    • Body:

    [

    “10.20.2.53.system”,

    “10.20.2.54.system”

    ]

    6.PNG

     

    Make sure that the Response Status is 201 CREATED.

     

    Verify that the group was created via the GUI:

    7.PNG

     

    For more information, refer to the Mellanox NEO REST API document.