I have a text config file sitting in my home directory (linux). This is the format:
ip nat pool nat_pool1 192.168.10.100 192.168.10.100 netmask /24
!
ip route 0.0.0.0 /0 192.168.15.1
!
slb server websrv1 192.168.10.5
port 80 tcp
!
slb server websrv2 192.168.10.6
port 80 tcp
!
slb server websrv3 192.168.10.7
port 80 tcp
!
slb service-group websrv_80 tcp
member websrv1 80
member websrv2 80
member websrv3 80
!
slb virtual-server websrv1 192.168.15.11
port 80 tcp
source-nat pool at_pool1
service-group websrv_80
!
end
I need a script (perl? / python?) that can be fed an argument like this:
script_name virtual-server_name
And then produce output showing the source-nat and service-group details tied to the virtual server. So, in the example config below, if ran "script_name websrv1"
The script would parse for the websrv1 virtual server and display the output along with the source-nat and slb-service-group configuration info tied to it. The script would output something like this:
slb virtual-server websrv1 192.168.15.11
port 80 tcp
source-nat pool at_pool1
service-group websrv_80
slb service-group websrv_80 tcp
member websrv1 80
member websrv2 80
member websrv3 80
ip nat pool nat_pool1 192.168.10.100 192.168.10.100 netmask /24
An extra benefit would be if it added the websrv1, 2 and 3 lines below it as well. Any help is very much appreciated.