ira avatar image
ira asked Spirent_Admin edited

TL1 Response

Hi. I would like to pull the highlighted text from this response out and put it into variables or a list so I can run a query command on each one. Any help is much appreciated:

  LABBRFDCOCOREDIRLAB3 10-11-01 17:07:48  
M  ira COMPLD  
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

PaulD avatar image
PaulD answered PaulD posted

If you have set the mode of the CLI session to TL-1, it will do all of the TL-1 parsing for you automatically.  With this step selected in a test case, open the Structure view and you should see all of the individual items (including the highlighted one) available for analysis.


In this case, you are trying to extract a repeating field.  That's probably easy by just choosing the appropriate XPATH query that will fetch all of the matching elements.  If you post the information from the Structure view, we can help by explaining the appropriate XPATH query syntax for you.

10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ira avatar image ira commented ·

Thanks. I now have the blue boxes. Now I just need to be able to grab those fields and run  a command on each. The number of fields will vary depending on the device I connect to. How do I post the information from the structure view?

0 Likes 0 ·
PaulD avatar image PaulD ira commented ·

You can switch the mode to text view, select all, and paste the text.  It will all be XML and we can review it from there.  Or you could post a screenshot if we can see enough from it.

0 Likes 0 ·
ira avatar image ira PaulD commented ·

I added the text as an attachment.

0 Likes 0 ·
PaulD avatar image PaulD ira commented ·

You are looking for the values of the first parameter in the first subblock of each parameter.  The query you want is, therefore,:




Since there are many Block tags, this will return the first parameter of the first subblock in each of them.  


You might wonder about all of that XML content inside the Parameter elements (parsed into Words, Punctuation, Number, etc.).  You are looking for just the concatentated textual content of the Parameter block, and this query will get you exactly that.  (That sub-structured in the parameters can often be useful, though, when the value of the parameters contains some text that has some structural significance.)

0 Likes 0 ·
ira avatar image ira PaulD commented ·

Thanks. The query works. My analysis rule is putting all of the values into one variable though. How can I use the values in a way that I can run individual commands on each value?

0 Likes 0 ·
ira avatar image ira ira commented ·

A coworker helped my get this with


foreach        i ${var1}







0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.