Get route-advertisement state for a VIP

Hi guys,

I’m stumbling a bit on something that seems to be quite easy to find in the docs of iControl but not for iCall… I have a TCL array of VIPs (name or IPs..I can do both) that I selected according to my specific criteria. How can I see if the route-advertisement option is already enabled or not for a VIP?

With iControl it was easy from the API: get_route_advertisement_state(VIP) → 1 = enabled, 0 = disabled

Does anyone know how I can do this with iCall?

Thanks, Mihai

Hi Mihai

you have to get_config with all-properties (otherwise no route-advertisement object) and then iterate

set vipaddresses [tmsh::get_config /ltm virtual-address all-properties]
foreach virt $vipaddresses {
                 if { [tmsh::get_name $virt] eq $vaddr } {
                     puts "virtual=$virt"
                     set routeadv [tmsh::get_field_value $virt route-advertisement]
                     puts "route adv status=$routeadv"
                }
             }

would output

virtual=ltm virtual-address 172.31.xx.xxx {
    address 172.31.xx.xxx
    app-service none
    arp enabled
    auto-delete true
    connection-limit 0
    description none
    enabled yes
    floating enabled
    icmp-echo enabled
    inherited-traffic-group false
    mask 255.255.255.255
    metadata none
    partition Common
    route-advertisement enabled
    server-scope any
    traffic-group traffic-group-1
    unit 1
}
route adv status=enabled

damn. seems this is the only way. the iControl API is much more structured and can address objects directly without needing to parse whole things. I guess F5 still has to improve on this side. thanks for the answer.

I will probably do this query once and store it in a hash array something like: array[“ip address”]=1 or 0 (for enabled/disabled). This saves me then the trouble for the other parsing I will do.

Thanks Alex. As always you’re keeping a close eye on my questions:)

Although it doesn’t simply provide a true/false response, you can at least parse fewer lines with:

(tmos) list ltm virtual-address 1.1.1.1 route-advertisement

ltm virtual-address 1.1.1.1 {
    route-advertisement enabled
}

Although it doesn’t simply provide a true/false response, you can at least parse fewer lines with:

(tmos) list ltm virtual-address 1.1.1.1 route-advertisement

ltm virtual-address 1.1.1.1 {
    route-advertisement enabled
}

One last question and a pertinent one for Shaggy :slight_smile:

set entity [tmsh::list /ltm virtual-address “My VIP here”] puts $entity set ohaoha [tmsh::get_field_value $entity mask] puts “nothing==$ohaoha” }

The entity works and if I do puts it shows: ltm virtual-address my-IP { address my-IP mask 255.255.255.255 route-advertisement enabled traffic-group Redundant unit 2 }

the ohaoha testing part did not work…tested with mask/route-advertisement/etc Anything I might be missing out in the syntax ?

The error given is: can’t eval proc: “script::run” unexpected TCL object type while executing “tmsh::get_field_value $entity mask” (procedure “script::run” line 22) invoked from within

One last question and a pertinent one for Shaggy :slight_smile:

set entity [tmsh::list /ltm virtual-address “My VIP here”] puts $entity set ohaoha [tmsh::get_field_value $entity mask] puts “nothing==$ohaoha” }

The entity works and if I do puts it shows: ltm virtual-address my-IP { address my-IP mask 255.255.255.255 route-advertisement enabled traffic-group Redundant unit 2 }

the ohaoha testing part did not work…tested with mask/route-advertisement/etc Anything I might be missing out in the syntax ?

The error given is: can’t eval proc: “script::run” unexpected TCL object type while executing “tmsh::get_field_value $entity mask” (procedure “script::run” line 22) invoked from within

One last question and a pertinent one for Shaggy :slightly_smiling_face:

set entity [tmsh::list /ltm virtual-address "My VIP here"]
puts $entity
set ohaoha [tmsh::get_field_value $entity mask]
puts "nothing==$ohaoha"
}

The entity works and if I do puts it shows:

ltm virtual-address my-IP {
    address my-IP
    mask 255.255.255.255
    route-advertisement enabled
    traffic-group Redundant
    unit 2
}

the ohaoha testing part did not work…tested with mask/route-advertisement/etc

Anything I might be missing out in the syntax ? The error given is:

can't eval proc: "script::run"
unexpected TCL object type
    while executing
"tmsh::get_field_value $entity mask"
    (procedure "script::run" line 22)
    invoked from within

I can’t edit this one and the duplicate that was added by itself for reformatting…somehow it gives an error..please ignore..I will report it so that someone who has more rights removes it (suppose something went wrong on the server side).

Just tried also with:

set obs [tmsh::get_config /ltm virtual-address ip-address]

which should return an object in the format that the scripting engine expects..but ran into the same error (probably I’m not getting the syntax right) when trying to do get_field_value/get_field_name on it.

If I print just $obs I get:

ltm virtual-address ip-address {
    address ip-address
    mask 255.255.255.255
    route-advertisement enabled
    traffic-group Redundant
    unit 2
}

But so far it seems I am missing an important bit or not seeing it in front of my eyes..how to access the contents.

Found the answer by myself…seems sleep helps a lot:

foreach member [tmsh::get_config /ltm virtual-address ip-address]
{   set ola [tmsh::get_field_value $member route-advertisement]
    puts "oha=$member"
    puts $ola
    }

like this it works so I can get my value.

Thanks to both Alex and Shaggy.

I would give the answer checkbox to both if possible as I find both solutions interesting.

Shaggy’s saves a bit of processing time operation wise.

I used get_config instead as the tmsh::list does not provide the data in the object format that I can then parse / extract easily with the get_field_value command.

I used get_config instead as the tmsh::list does not provide the data in the object format that I can then parse / extract easily with the get_field_value command.