Developer Community

Reply
Highlighted
Occasional Contributor I

How to push Json config into a switch ??

Guys,

 

i have a json config file.

 

example :

},
"no-syslog/ipv4": {
"cfg_aces": {
"10": {
"action": "deny",
"dst_ip": "10.30.56.31/255.255.255.255",
"dst_l4_port_max": 514,
"dst_l4_port_min": 514,
"protocol": 17
},
"20": {
"action": "permit"
},
"5": {
"action": "deny",
"dst_ip": "10.30.1.55/255.255.255.255",
"dst_l4_port_max": 514,
"dst_l4_port_min": 514,
"protocol": 17
}
},
"cfg_version": -1614603666118581,
"list_type": "ipv4",
"name": "no-syslog"
}

 

 

how do i get started to push this json config into a switch.

 

I am fimiliar with postman "GET" and "POST" request. But i have a feeling it will be hard using postman.

 

I could use python, but still unsure how API technically work.

 

Is there any tool/application for pushing json configs ?

 

Can anyone please point me in the right direction ??

 

Thanks

Highlighted
MVP Guru Elite

Re: How to push Json config into a switch ??

Hi,

 

What switch do you want to configure ?

 

and where can from this json config ?



PowerArubaSW: Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP... More info

PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...) More info

PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)

PowerArubaIAP: Powershell Module to use Aruba Instant AP

PowerArubaMC: Powershell Module to use Mobility Controller / Master


ACMP 6.4 / ACMX #107 / ACCP 6.5 / ACSP
Highlighted
Occasional Contributor I

Re: How to push Json config into a switch ??

its a aruba os(2930)

 

i dont get this "and where can from this json config ?"

 

i will take a look at the link.

Highlighted
Occasional Contributor I

Re: How to push Json config into a switch ??

following the link, i install the module and imported it.

 

but the connect command is not working

Connect to your switch

Connect-ArubaSW 192.0.2.1

Connect-ArubaSW : The term 'Connect-ArubaSW' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:1

Highlighted
Occasional Contributor I

Re: How to push Json config into a switch ??

Sorry i had to import the module again.

Highlighted
MVP Guru Elite

Re: How to push Json config into a switch ??


@headshotboy wrote:

 

 

i will take a look at the link.


for the link, it is only my signature about some PowerShell Module for ArubaSW..

 

i can be a solution for import JSON to ArubaSW

But you need to known the URL/URI and the payload

and you can use

Invoke-ArubaSWWebRequest -url "rest/v.." -method "post" -body $payload


PowerArubaSW: Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP... More info

PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...) More info

PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)

PowerArubaIAP: Powershell Module to use Aruba Instant AP

PowerArubaMC: Powershell Module to use Mobility Controller / Master


ACMP 6.4 / ACMX #107 / ACCP 6.5 / ACSP
Highlighted
Aruba Employee

Re: How to push Json config into a switch ??

Hi Headshotboy,

 

There are plenty of options to utilize the REST API on AOS-Switch devices.  You are certainly welcome to use Postman to configure the switch.  After enabling REST on the switch, you'll simply need to first save the login cookie by sending a POST command to the URI https://<ip address>/rest/v1/login-sessions with the keys userName and password, such as in this screen shot:AOS-Switch Postman login.PNG

 

which should return your session cookie, and you're then able to do more POST and GETs from there.  More information on this can be found in our REST guide here.

Don't forget to "logout" of the session by sending a DELETE request to the sessionID of the login-sessions URI.

 

For information about the Schema and format for each JSON request, here is the REST Schema for the 2930M (depending which firmware version you're running).

 

If you were interested in Python, we actually have some examples in our GitHub (located here) as well as some videos on our Airheads Broadcasting Channel all about using Python and REST with our AOS-Switches!

 

I hope this helps, and feel free to ask any more questions if you have them.

Search Airheads
cancel
Showing results for 
Search instead for 
Did you mean: