Forum Discussion

David_18981's avatar
David_18981
Icon for Nimbostratus rankNimbostratus
Mar 09, 2009

How to parse data group list ?

Hi all,

 

 

i have an interresting question about : how to parse element within a data group list ?

 

 

In fact, for example if i create a data group with a list of IP addresses (192.168.1.1, 192.168.1.2...), when i try to access to these elements there are braces around them =>: {192.168.1.1}, {192.168.1.2}.

 

 

It is an undesirable behaviour, and i just want to know what i have to do to obtain my real IP addresses values without the braces "{" & "}".

 

 

Here is another forum topic related to this issue:

 

http://devcentral.f5.com/Default.aspx?tabid=53&view=topic&postid=1842

 

 

Thanks in advance for your answers.

 

 

Environment:

 

TMMOS 9.4.3

 

Big IP 1500

 

 

 

David
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi David,

    You can use lindex (Click here) to retrieve individual elements of the list. If you're trying to create a list of IP addresses, it would be more efficient to use a datagroup of type 'address' and use the matchclass command (Click here) to check if an IP address/subnet is part of the datagroup.

     
     when RULE_INIT { 
      
     log local0. "\$::aol: $::aol" 
     log local0. "\[lindex \$::aol 0\]: [lindex $::aol 0]" 
     } 
     

    Rule : $::aol: {64.12.96.0/19} {149.174.160.0/20} {152.163.240.0/21} {152.163.248.0/22} {152.163.252.0/23} {152.163.96.0/22} {152.163.100.0/23} {195.93.32.0/22} {195.93.48.0/22} {195.93.64.0/19} {195.93.96.0/19} {195.93.16.0/20} {198.81.0.0/22} {198.81.16.0/20} {198.81.8.0/23} {202.67.64.128/25} {205.188.192.0/20} {205.188.208.0/23} {205.188.112.0/20} {205.188.146.144/30} {207.200.112.0/21}

    Rule : [lindex $::aol 0]: 64.12.96.0/19

    Aaron
  • Hi Aaron,

     

     

    thank you for your answer, it was exactly what i was looking for.

     

     

    I've just tested it, it's working perfectly.

     

     

    Thank you so much.

     

     

    David