Hi,
I am trying to build a response map for a response with the following characteristics:
- it is of the form 0 { <key-value list 1>} { <key-value list 2>} { <key-value list 3>} …, where the key-value list consists of key-value pairs separated by space.
- it contains a variable number of key-value lists, i.e. it may contain multiple key value lists, or none at all, but will always start with the 0.
- the response is always returned as a single line.
I'd like to extract the key-value pairs and store some of them in variables or return them as a more user-friendly response.
What is the best way to parse a response of this type? It would be very easy to parse this in Tcl, but I am struggling with building a response map in iTest. I tried block and pattern method without success. Can someone offer a suggestion or example?
Here is a sample of the response:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0 { {display_id 30510 status 1 owner_group contractor alarmed No name Untitled series_id {} access_rights_list 12486 rsvn_id 30510 topology_path {} movable No utc_end 1257194102 priority 0 haspermission Yes deadline {} owner divya utc_start 1257183302 status_text active} {display_id 30528 status 1 owner_group contractor alarmed No name PerfCase5-24Port series_id {} access_rights_list 12486 rsvn_id 30528 topology_path {/users/Divya/IPTC Regression - October 2009} movable No utc_end 1257218894 priority 0 haspermission Yes deadline {} owner divya utc_start 1257186494 status_text active}}
Thanks!
Milen