Aruba & ProVision-based
1752801 Members
5553 Online
108789 Solutions
New Discussion

REST CLI commands not working on WC.16.10.0011

 
egabrum
Occasional Collector

REST CLI commands not working on WC.16.10.0011

Model 2930F

I've been upgrading and downgrading and can confirm that, at least for me, CLI commands don't work over REST on WC.16.10.0011

They do work however on WC.16.10.0002 

I don't have any example handy, bu tI've been using python with napalm-arubaos-switch and/or aos-sw-api libraries.

5 REPLIES 5
drk787
HPE Pro

Re: REST CLI commands not working on WC.16.10.0011

@egabrum Could you please share more details about the issue. If possible the results to compre with working code and non working code WC.16.10.0011

Thank You!
I am an HPE Employee

Accept or Kudo

egabrum
Occasional Collector

Re: REST CLI commands not working on WC.16.10.0011

@drk787Thanks for reacting.

Here's an example of script that works perfecty on WC.16.10.0002 , but not on WC.16.10.0011 :

import aos_sw_api

def main():
    with aos_sw_api.Client(
        switch_ip="x.x.x.x",
        api_version=7,
        username="manager",
        password="x",
        https=False,
    ) as client:
        client.cookie
        res = client.vlan.get_all_vlans()
        print(res)


if __name__ == "__main__":
    main()

 

Similar if I use the napalm-arubaos-switch library.

The traceback with the script above is:

Traceback (most recent call last):
  File "U:\dev\aruba\rest_bug.py", line 30, in <module>
    main()
  File "U:\dev\aruba\rest_bug.py", line 10, in main
    with aos_sw_api.Client(
  File "C:\Users\user\.virtualenvs\aruba-Fs4htifT\lib\site-packages\aos_sw_api\_client.py", line 104, in __enter__

    self.auth.login(cookie=self.cookie)
  File "C:\Users\user\.virtualenvs\aruba-Fs4htifT\lib\site-packages\aos_sw_api\auth\_auth.py", line 34, in login
    r = self._session.post(url=self._auth_base_url, json=self._user_data)
  File "C:\Users\user\.virtualenvs\aruba-Fs4htifT\lib\site-packages\httpx\_client.py", line 824, in post
    return self.request(
  File "C:\Users\user\.virtualenvs\aruba-Fs4htifT\lib\site-packages\httpx\_client.py", line 600, in request
    return self.send(
  File "C:\Users\user\.virtualenvs\aruba-Fs4htifT\lib\site-packages\httpx\_client.py", line 620, in send
    response = self.send_handling_redirects(
  File "C:\Users\user\.virtualenvs\aruba-Fs4htifT\lib\site-packages\httpx\_client.py", line 647, in send_handling_redirects
    response = self.send_handling_auth(
  File "C:\Users\user\.virtualenvs\aruba-Fs4htifT\lib\site-packages\httpx\_client.py", line 684, in send_handling_auth
    response = self.send_single_request(request, timeout)
  File "C:\Users\user\.virtualenvs\aruba-Fs4htifT\lib\site-packages\httpx\_client.py", line 714, in send_single_request
    ) = transport.request(
  File "C:\Users\user\.virtualenvs\aruba-Fs4htifT\lib\site-packages\httpcore\_sync\connection_pool.py", line 152, in request
    response = connection.request(
  File "C:\Users\user\.virtualenvs\aruba-Fs4htifT\lib\site-packages\httpcore\_sync\connection.py", line 78, in request
    return self.connection.request(method, url, headers, stream, timeout)
  File "C:\Users\user\.virtualenvs\aruba-Fs4htifT\lib\site-packages\httpcore\_sync\http11.py", line 62, in request

    ) = self._receive_response(timeout)
  File "C:\Users\user\.virtualenvs\aruba-Fs4htifT\lib\site-packages\httpcore\_sync\http11.py", line 115, in _receive_response
    event = self._receive_event(timeout)
  File "C:\Users\user\.virtualenvs\aruba-Fs4htifT\lib\site-packages\httpcore\_sync\http11.py", line 142, in _receive_event
    event = self.h11_state.next_event()
  File "c:\program files\python39\lib\contextlib.py", line 135, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\Users\user\.virtualenvs\aruba-Fs4htifT\lib\site-packages\httpcore\_exceptions.py", line 12, in map_exceptions
    raise to_exc(exc) from None
httpcore._exceptions.ProtocolError: can't handle event type ConnectionClosed when role=SERVER and state=SEND_RESPONSE

 

Maybe this is an issue on the Python side, not on the AOS side but what could have changed on AOS to break this?

 

egabrum
Occasional Collector

Re: REST CLI commands not working on WC.16.10.0011

WC.16.10.0011 works with curl:

POST /rest/v7/login-sessions HTTP/1.1
Host: x.x.x.x
User-Agent: curl/7.55.1
Accept: */*
Content-Length: 46
Content-Type: application/x-www-form-urlencoded

{"userName":"manager", "password":"x"}

 

 

But not with Python (I have tried httpx and requests):

 

POST /rest/v7/login-sessions HTTP/1.1
Host: x.x.x.x
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
User-Agent: python-httpx/0.16.1
Content-Length: 48
Content-Type: application/json

{"userName": "manager", "password": "x"}

 

No response, the switch just shuts the connection.

I'm reading and researching as much as I can. But I'm flabbergastered as to why this version would behave differently. I read the changelog and can't find anything that seems relevant.

Can somebody look into this? I've been chasing this for long now.

Thanks

drk787
HPE Pro

Re: REST CLI commands not working on WC.16.10.0011

@egabrum  I would suggest to open a support case to investigate further on the differences between the codes.

Also can you try enabling the debugging and see the evetns during non-peak hours.

debug destination session (to display the events on the terminal)

debug rest-interface (debuggin the rest api)

 

Once done, stop the debugging using  'no debug all' 

Thank You!
I am an HPE Employee

Accept or Kudo

egabrum
Occasional Collector

Re: REST CLI commands not working on WC.16.10.0011

Thank you drk787

It was a bug in WC.16.10.0011 , fixed in WC.16.10.0012