Campus Switching and Routing

Reply
New Contributor

ArubaOS REST API /vlans-ports/{VlanPort.vlan_id}-{VlanPort.port_id}

Hello,

 

I'm trying to add a VLAN to a port with an API call. I can retrieve and delete a VLAN from a port (GET .../vlans-ports and DELETE .../vlans-ports/{VlanPort.vlan_id}-{VlanPort.port_id}).

 

Accourding to the documentation a PUT .../vlans-ports/{VlanPort.vlan_id}-{VlanPort.port_id} should add the VLAN to the specified port and return VlanPort. Instead the call returns a session id:

{
"uri": "/rest/v1/login-sessions","cookie":
"sessionId=09CG1bRuT5hkCPzI97mmDjpn4uLtsmgkBsAaWUr9h7GxlkbsiASak1PEyj7Ov3n"
}

 

Has anyone succeeded in adding a VLAN to a 802.1q port?

 

Link to the documentation:https://www.google.nl/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjX1Neh0b3VAhWLaVAKHWN-BRAQFggmMAA&url=http%3A%2F%2Fh20566.www2.hpe.com%2Fhpsc%2Fdoc%2Fpublic%2Fdisplay%3Fsp4ts.oid%3D7074783%26docLocale%3Den_US%26docId%3Demr_na...

 

Aruba Employee

Re: ArubaOS REST API /vlans-ports/{VlanPort.vlan_id}-{VlanPort.port_id}

Hi,

 

I think this is a bit different. In this case put is used to change a port mode to tag/untagg for e.g. This can be done in following way:

 

vlan_port = { "port_id": "21", "port_mode" : "POM_TAGGED_STATIC"}

 r3 = requests.put('http://192.168.100.1/rest/v1/vlans-ports/1-21', data = json.dumps(vlan_port))

 

vlan_port = { "port_id": "21", "port_mode" : "POM_UNTAGGED"}

 r3 = requests.put('http://192.168.100.1/rest/v1/vlans-ports/1-21', data = json.dumps(vlan_port))

 

But if you want to add port in certain vlan you need to use post:

vlan_port1 = { "vlan_id": 10, "port_id": "20", "port_mode" : "POM_UNTAGGED"}

r4 = requests.post('http://192.168.100.1/rest/v1/vlans-ports', data = json.dumps(vlan_port1))

 

vlan_port1 = { "vlan_id": 70, "port_id": "21", "port_mode" : "POM_TAGGED_STATIC"}

r4 = requests.post('http://192.168.100.1/rest/v1/vlans-ports', data = json.dumps(vlan_port1))

 

Hope this will help you!

 

Regards, Dobias

 

 

Aruba Employee

Re: ArubaOS REST API /vlans-ports/{VlanPort.vlan_id}-{VlanPort.port_id}

Did this work for you?

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