question

ozn avatar image
ozn asked ozn edited

Response map sections of code/config

I am trying to map config from a Cisco device. here is an example of the config: service service_name1 blah blah blah blah blah blah blah blah blah blah blah blah gtpc ipv4-address 123.134.145.145 ipv6-address 2246:de00:2341:7100::14 exit service service_name2 blah blah blah blah blah blah blah blah blah blah blah blah gtpc ipv4-address 123.134.145.146 ipv6-address 2246:de00:2341:7100::15 exit service service_name3 blah blah blah blah blah blah blah blah blah blah blah blah gtpc ipv4-address 123.134.145.147 ipv6-address 2246:de00:2341:7100::17 exit service service_name4 blah blah blah gtpc ipv4-address 123.134.145.148 ipv6-address 2246:de00:2341:7100::16 exit I am trying to pattern map the IPv4 and IPv6 address on line (ex: "gtpc ipv4-address 123.134.145.148 ipv6-address 2246:de00:2341:7100::16") in each block while using the service (ex: "service_name3") as the key. Currently I've tried using pattern mapping. I made the token for the service (ex: "service_name4") while having the anchor "egtp-service\s+". After the egtp_service token I have the anchor "\s+.*gtpc bind ipv\d+-address\s+" to map the IPv4 address; I am trying to map anything, or 0 to any number lines containing any character between the egtp_service token and the IPv4 address. Then I have the token "\s+ipv\d+-address\s+" to map the IPv6 address. Between the Ipv6 address token and the exit there can be any number of lines or any text; to achieve that I've used the anchor "\s+.*exit". The response map is not able to map all the service names and IP addresses; it mapped the first service "ex service_name1" and the IP address "123.134.145.148 ipv6-address 2246:de00:2341:7100::16" which belong to the service "service_name4". I've also tried the block response Any suggestions on how I can achieve this? Here are the example config and response map: [link text][1] [link text][2] [1]: /storage/temp/4121-showconfigurationtest.ffrm [2]: /storage/temp/4123-config_template.txt
iTestresponse mapiTest Enterprise
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.

sandeepreddynv avatar image sandeepreddynv ♦ commented ·
Hello ozn, Is it possible to share the entire response in a text file or share the response map already created for this response. Regards, Venkat
0 Likes 0 ·
ozn avatar image ozn sandeepreddynv ♦ commented ·
I added the attachments
0 Likes 0 ·
ozn avatar image
ozn answered ozn edited
I figured it out. I need to use the anchor: \s+(.*?gtpc bind ipv\d+-address)\s+ This matches anything between the service name and the IPv4 Address. The key thing I was missing was the "(.*?gt...)". I guess my work was just incomplete regex. Thanks for your help sandeep.
10 |950

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

sandeepreddynv avatar image
sandeepreddynv answered ozn commented
I created a sample response map for the response you provided in the text file. Please check this and let me know how it works.[link text][1] [1]: /storage/temp/4109-block.ffrm

block.ffrm (18.0 KiB)
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.

ozn avatar image ozn commented ·
Hey Sandeepreddynv. Thank you for your response. However, I am still having trouble mapping it. I've modified the code and response map to give you a better idea on what I am trying to achieve. Thanks.
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.