API - see disabled interfaces/ip addresses

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 =)

invalid means just that - it is invalid, and in console it will be marked as invalid (eg; interface is missing or disabled)

What’s new in 3.23:
*) api - ‘disabled’ property was not available from api since 3.21, fixed;

:wink:

hmmm… let’s see…
Clipboard03.gif

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
Clipboard01.gif

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…

using API you can directly see these values - winbox and CLI shows only one of the states that is sufficient.