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


Groups > comp.lang.python > #82471

Re: Python Script to convert firewall rules

References <b23872cc-7b5c-4e38-96c1-ac907b6df7f1@googlegroups.com> <mailman.16883.1418348704.18130.python-list@python.org> <e0d8dd24-2256-4b89-972e-c1ebe82f72a9@googlegroups.com>
Date 2014-12-12 19:31 -0700
Subject Re: Python Script to convert firewall rules
From Jason Friedman <jsf80238@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.16931.1418437882.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

>
>
> 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;
>             }
>         }
>     }
> }
>
>
Note that the practice on this list is to put your response after the
(edited) portion of the previous posts.

Are you willing to learn some Python, if someone gets you started?
Would it be helpful if someone provided Python code to convert this:

set interfaces ge-0/0/0 unit 0 family inet address 10.17.10.1/24

to this:

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

?

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