question

gmiquela avatar image
gmiquela asked gmiquela answered

Multi line checking

I want to compare the content of this policy, I want to use the whole policy as the token instead having it line by line. route-policy Policy_test if community matches-any (100) then drop else pass endif end-policy
iTestresponse mapanalysis rulefile compare
2 comments
10 |950

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

mabass avatar image mabass commented ·
Are you trying to compare using Analysis Rule or Response Map? Could you please share your testcase to get a better picture of it.
0 Likes 0 ·
gmiquela avatar image gmiquela commented ·
Let's say that I have a 10 policies in a router. I want to create a test that validate the contents of this policy. The test case is call a policy and the policy name is an argument. The problem is, I can't do compare a multi line compare. I listed a policy but not in a single line but 5-15 lines per policy. I don't know what will be the best approach in here.
0 Likes 0 ·
mallikarjunarao avatar image
mallikarjunarao answered mallikarjunarao edited
Do you need to use multi line regexp ![alt text][1] This could be done by using iTest custom rule, by clicking on add analysis rule on the response tab ![alt text][2] select custom and click on Extract Using: regular expression, In regular expression we have two options(portion of match(es) to extract) 1. Numbered group ( http://wiki.tcl.tk/986) Nothing but indicies to select in tcl, tcl support 0 to 9 numbered group, based on the our requirement may changed. 2. Full match This match compare full match in the regular expression, you may consider the according Based on your requirement you can use your own regular expression, here i use .+ to select what every displayed ![alt text][3] The output is look this ![alt text][4] [1]: http://itestforums.spirent.com/storage/attachments/2290-MultilineSeletion.png [2]: http://itestforums.spirent.com/storage/attachments/2291-Custom.png [3]: http://itestforums.spirent.com/storage/attachments/2292-numberd_group.png [4]: http://itestforums.spirent.com/storage/attachments/2293-MultilineSeletion.png Thanks http://tclscripting.blogspot.in/
1 comment
10 |950

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

gmiquela avatar image gmiquela commented ·
Looks good. Thanks for all the help.
0 Likes 0 ·
JeffJ avatar image
JeffJ answered
There are methods to do this in iTest; however, I would argue that doing a multi-line comparison may not yield reliable results nor give you the ability to specifically tell what's not right with the policy. Multi-line comparisons often fail due to issues with spacing and tabs. This can often lead to false negatives in testing. Instead, checking each "part" of the policy not only eliminates this issue, but also provides you with a way to determine exactly why the failure occurred. To do this, use the response maps to parse the response and provide you with a list of policies. You can use the policy name as the key. Then, you can use a series of analysis rules to test each part of the policy to ensure it's accuracy. I'd be glad to create a mock up of this if you'd provide your 10 policy response.
5 comments
10 |950

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

gmiquela avatar image gmiquela commented ·
Attached are the list of policies that I need to validate using iTest.
0 Likes 0 ·
JeffJ avatar image JeffJ ♦ commented ·
I'm not seeing your attachment. Please repost or if you'd rather keep the data private, feel free to click on my ID and email a copy directly.
0 Likes 0 ·
gmiquela avatar image gmiquela commented ·
Each policy is delimited by !. Thanks for your help/ [link text][1] [1]: /storage/temp/3796-list.txt
0 Likes 0 ·
list.txt (8.8 KiB)
JeffJ avatar image JeffJ ♦ commented ·
Thanks! I have it now. BTW, are you checking all policies at the same time or one in particular?
0 Likes 0 ·
gmiquela avatar image gmiquela commented ·
I can check one policy at a time. To call them propbably is to use the policy name as an argument. If I'l analysis rule, there's some items that might show up on different line number. I want that to be line specific kind of checking.
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.