Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #82420

Re: Python Script to convert firewall rules

Newsgroups comp.lang.python
Date 2014-12-11 23:54 -0800
References <b23872cc-7b5c-4e38-96c1-ac907b6df7f1@googlegroups.com> <mailman.16883.1418348704.18130.python-list@python.org>
Message-ID <e0d8dd24-2256-4b89-972e-c1ebe82f72a9@googlegroups.com> (permalink)
Subject Re: Python Script to convert firewall rules
From Kashif Rana <kashifrana84@gmail.com>

Show all headers | View raw


Hi Jason

Thanks for the reply. Yes I can make the all possible keywords/values for both formate. But after that what gonna be the logic to convert one format to other format. Like to convert one line below are the keywords:

set interface ethernet2/5 ip 10.17.10.1/24 (format 1)
set interfaces ge-0/0/0 unit 0 family inet address 10.17.10.1/24 (format 2)

(set, interface, ip) = (set, interfaces, family inet address)

But some values are variable and should ask the user to convert manually like ethernet2/5 equal to ge-0/0/0 or ge-0/0/1 or ge-0/0/2

And some values keep as it is like 10.17.10.1/24 

Also then format 2 can be converted int o format 3 (as below) for more readability of format 2. This is just optional. 

interfaces {  
    ge-2/0/5 { 
        unit 0 { 
            family inet { 
                address 10.17.10.1/24; 
            } 
        } 
    } 
}

On Friday, December 12, 2014 5:45:20 AM UTC+4, Jason Friedman wrote:
> I am network engineer and not expert in programming. I would like to make one python script to convert juniper netscreen firewall configuration into juniper SRX firewall configuration.
> 
> 
> 
> Looks pretty tricky, do you have a specification for each format containing all the possible keywords/values?
> 
> 
> If you could describe the logic in English then writing the equivalent in Python would be straightforward for many people on this list.

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Python Script to convert firewall rules Kashif Rana <kashifrana84@gmail.com> - 2014-12-10 10:51 -0800
  Re: Python Script to convert firewall rules Jason Friedman <jsf80238@gmail.com> - 2014-12-11 18:44 -0700
    Re: Python Script to convert firewall rules Kashif Rana <kashifrana84@gmail.com> - 2014-12-11 23:54 -0800
      Re: Python Script to convert firewall rules Jason Friedman <jsf80238@gmail.com> - 2014-12-12 19:31 -0700
        Re: Python Script to convert firewall rules Kashif Rana <kashifrana84@gmail.com> - 2014-12-13 09:41 -0800
          Re: Python Script to convert firewall rules Jason Friedman <jsf80238@gmail.com> - 2014-12-13 18:35 -0700
          Re: Python Script to convert firewall rules Kashif Rana <kashifrana84@gmail.com> - 2014-12-14 10:51 +0400
          Re: Python Script to convert firewall rules Jason Friedman <jsf80238@gmail.com> - 2014-12-14 22:07 -0700

csiph-web