Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tag support #19

Open
luqasz opened this issue Nov 6, 2017 · 0 comments
Open

Add tag support #19

luqasz opened this issue Nov 6, 2017 · 0 comments

Comments

@luqasz
Copy link
Owner

luqasz commented Nov 6, 2017

API has support for .tag which as name suggests, tags each response when request is tagged. This enables async usage of API and other issues:

  • Does library need to track each request and return a response when it is ready ?
  • API allows to use same tags multiple times
  • API may return multiple !trap errors
  • API behaves differently on different routeros versions
  • When tag is passed as '1' (int as a string) API must return same type.

on version 5.25 with url which is malformed:

<--- /tool/fetch (11)
<--- =url=http://wp.pl/xxx (21)
<--- .tag=3 (6)
<--- EOS

---> !re (3)
---> =status=connecting (18)
---> .tag=3 (6)
---> EOS
---> !re (3)
---> =status=failed (14)
---> .tag=3 (6)
---> EOS
---> !re (3)
---> =status=failed (14)
---> .tag=3 (6)
---> EOS

<--- /cancel (7)
<--- =tag=3 (6)
<--- .tag=7 (6)
<--- EOS

---> !trap (5)
---> =category=2 (11)
---> =message=interrupted (20)
---> .tag=3 (6)
---> EOS
---> !done (5)
---> .tag=7 (6)
---> EOS
---> !trap (5)
---> =message=failure: 301 Moved Permanently (39)
---> .tag=3 (6)
---> EOS
---> !done (5)
---> .tag=3 (6)
---> EOS

on version 6.1 with url that exists:

<--- /tool/fetch
<--- =url=http://noc.gts.pl/1mb.gts
<--- .tag=1
<--- EOS

---> !re
---> =status=connecting
---> .tag=1
---> EOS
---> !re
---> =status=downloading
---> =downloaded=753
---> =total=1000
---> =duration=2d09:29:51
---> .tag=1
---> EOS
---> !re
---> =status=finished
---> .tag=1
---> EOS
---> !done
---> .tag=1
---> EOS

on version 6.1 with url which is malformed:

<--- /tool/fetch
<--- =url=http://noc.gts.pl/1mb.gtsss
<--- .tag=1
<--- EOS

---> !re
---> =status=connecting
---> .tag=1
---> EOS
---> !re
---> =status=failed
---> .tag=1
---> EOS
---> !trap
---> =message=failure: closing connection: <404 Not Found> 217.153.108.10:80 (4)
---> .tag=1
---> EOS
---> !done
---> .tag=1
---> EOS

Canceling a listen command returns !trap which is not actually any error at all:

<--- '/ip/address/listen'
<--- '.tag=10'
<--- EOS

---> '!re'
---> '.tag=10'
---> '=.id=*A'
---> '=address=1.1.1.1/32'
---> '=network=1.1.1.1'
---> '=interface=br-lan'
---> '=actual-interface=br-lan'
---> '=invalid=false'
---> '=dynamic=false'
---> '=disabled=false'
---> EOS
---> '!re'
---> '.tag=10'
---> '=.id=*A'
---> '=.dead=true'
---> EOS

<--- '/cancel'
<--- '=tag=10'
<--- '.tag=20'
<--- EOS

---> '!trap'
---> '.tag=10'
---> '=category=2'
---> '=message=interrupted'
---> EOS
---> '!done'
---> '.tag=20'
---> EOS
---> '!done'
---> '.tag=10'
---> EOS
@luqasz luqasz changed the title Add tag support. Add tag support Nov 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant