baddah
April 15, 2009, 7:28am
1
Hi,
How can one get back the status(enabled/disabled) of an entry back from the API? i.e
4 X 192.168.102.1/24 192.168.102.0 192.168.102.255 ether1
but from API,i only get back the following
[4] => Array
(
[.id] => *8
[comment] =>
[address] => 192.168.102.1/24
[network] => 192.168.102.0
[broadcast] => 192.168.102.255
[interface] => ether1
)
In the API, there is no indication if the address is disabled or enabled. Any way to get this info from the API?
Thnx
hmmm… in v3.22 I have this:
=.id=*19
=comment=
=address=1.1.1.1/32
=network=1.1.1.1
=broadcast=1.1.1.1
=interface=srv
=actual-interface=srv
=invalid=true
=dynamic=false
seems like ‘=invalid’ shows whether interface is disabled or not
but ‘=enabled’ is still missing. hope to see it in v3.23 =)
janisk
April 16, 2009, 9:34am
3
invalid means just that - it is invalid, and in console it will be marked as invalid (eg; interface is missing or disabled)
janisk
April 17, 2009, 6:25am
6
in 3.23 you will see something like this:
when ip address that is set on some interface, and then this interface is disabled - as you notice, disabled=false and invalid=true
=.id=*3
=comment=
=address=10.0.0.1/24
=network=10.0.0.0
=broadcast=10.0.0.255
=interface=eoip-tunnel
=actual-interface=eoip-tunnel1
=disabled=false
=invalid=true
=dynamic=false
.tag=adr
console output
2 I 10.0.0.1/24 10.0.0.0 10.0.0.255 eoip-tunnel1
now, if you disable that item in ip address then you get disabled=true invalid=true
!re
=.id=*3
=comment=
=address=10.0.0.1/24
=network=10.0.0.0
=broadcast=10.0.0.255
=interface=eoip-tunnel1
=actual-interface=eoip-tunnel1
=disabled=true
=invalid=true
=dynamic=false
.tag=adr
console output
2 X 10.0.0.1/24 10.0.0.0 10.0.0.255 eoip-tunnel1
in your case, i thing you have disabled interface and disabled ip address, so it shows ip as disabled and not as invalid, if you enable that interface you would see invalid tag set up.
hope you notice the difference.
do you think I’m crazy? I will never disable the only ethernet interface on the router =)
so - the interface is up and running, but API still says invalid=true
janisk
April 20, 2009, 9:54am
8
think of yourself what you want but you have to knot that there is a difference between invalid and disabled.
when you disable address, it is set as invalid and as disabled, when something else is wrong, then address can be invalid but not disabled.
so, if address is disabled = 100% invalid but not vice versa.
neither ssh nor winbox shows ‘invalid’ state - are they broken? =)
why only API knows that disabled address is invalid? I think it should be invalid everywhere, not only in API…
p.s. Normis said that there’s bug in items states in 3.22 API, so about what version we are talking about? =) will wait for 3.23…
janisk
April 21, 2009, 7:53am
10
using API you can directly see these values - winbox and CLI shows only one of the states that is sufficient.