Forum Discussion

Vijay_Saxena_97's avatar
Vijay_Saxena_97
Icon for Nimbostratus rankNimbostratus
Nov 15, 2012

Map of key/value pair in Irules

I want to create list of key and value pairs in Irules. In Java we can use the HashMap to acivie the goal. Not sure how can I do similar thing in Irules. I should be able to add remove the key value pairs. I need to search in that map with key.

 

6 Replies

  • You want to add or remove KVPs 'on the fly'? If not and it's just something you need to do every now and then, then a Data Group will do the trick.
  • Yes, I want to add/remove KVP 'on the fly'. With each HTTPRequest I need to check the kvp and update kvp and take appropriate action. Can I use the TCL Array to achive the goal?
  • Hmmm, OK, Data Groups won't help here then. Perhaps the table command? https://devcentral.f5.com/wiki/iRules.table.ashx

     

     

    I'm not sure if array's are available I'm afraid.
  • Im not sure what the overall goal is but would a making a sideband connection to a database with CSV data and populating it into a table used by the Irule work better?

     

  • table entries can be used for dynamic key=value pairs. A data group would be good for statically defined pairs. And yes, you can use a sideband connection for supporting lookups from external sources.

     

     

    https://devcentral.f5.com/wiki/iRules.table.ashx

     

    https://devcentral.f5.com/wiki/iRules.class.ashx

     

    https://devcentral.f5.com/wiki/iRules.sideband.ashx

     

     

    Aaron