| author | Tomas Zeman <tzeman@volny.cz> |
| Tue, 21 Aug 2012 13:10:37 +0200 | |
| changeset 42 | 89e94dd37556 |
| parent 24 | d6c31cf412a7 |
| permissions | -rw-r--r-- |
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
1 |
# Grammar for Cisco devices |
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
2 |
# Configuration is expected to be preprocessed via following command: |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
3 |
# perl -ne '/(^\s*)(\S.*)$/; print length($1)." $2\n"' |
|
24
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
4 |
# |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
5 |
# Copyright (c) 2009, Tomas Zeman <tzeman@volny.cz> |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
6 |
# All rights reserved. |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
7 |
# |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
8 |
# Redistribution and use in source and binary forms, with or without |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
9 |
# modification, are permitted providing that the following conditions |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
10 |
# are met: |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
11 |
# 1. Redistributions of source code must retain the above copyright |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
12 |
# notice, this list of conditions and the following disclaimer. |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
13 |
# 2. Redistributions in binary form must reproduce the above copyright |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
14 |
# notice, this list of conditions and the following disclaimer in the |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
15 |
# documentation and/or other materials provided with the distribution. |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
16 |
# |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
17 |
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
18 |
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
19 |
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
20 |
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
21 |
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
22 |
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
23 |
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
24 |
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
25 |
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
26 |
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
27 |
# POSSIBILITY OF SUCH DAMAGE. |
|
d6c31cf412a7
grammars: (c) notice, bsd license
"Tomas Zeman <tzeman@volny.cz>"
parents:
23
diff
changeset
|
28 |
# |
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
29 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
30 |
{ # perl code follows
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
31 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
32 |
$::res = {};
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
33 |
|
|
15
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
34 |
# Returns pointer to context hashref as specified by ctx stack. |
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
35 |
# @param ctx_path array of ctx stack. |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
36 |
sub ctx {
|
|
15
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
37 |
return ctx_rel($::res, @_); |
|
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
38 |
} |
|
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
39 |
|
|
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
40 |
# Returns pointer to context hashref as specified by ctx stack, |
|
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
41 |
# relative to the supplied ctx pointer. |
|
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
42 |
# @param ptr current ctx pointer from which ctx build starts. |
|
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
43 |
# @param ctx_path array of ctx stack. |
|
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
44 |
sub ctx_rel {
|
|
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
45 |
my $ptr = shift; |
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
46 |
my @ctx_path = @_; |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
47 |
foreach my $part (@ctx_path) {
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
48 |
$ptr->{$part} = {} unless exists ($ptr->{$part});
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
49 |
$ptr = $ptr->{$part};
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
50 |
} |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
51 |
return $ptr; |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
52 |
} |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
53 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
54 |
} # end of perl code |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
55 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
56 |
file: <skip: qr/[^\S\n]*/> # Ignore non-newline whitespace |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
57 |
line(s) eofile |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
58 |
|
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
59 |
line: s_controller |
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
60 |
| s_interface |
| 12 | 61 |
| s_vrf |
| 13 | 62 |
| s_vlan |
| 14 | 63 |
| vtp_line |
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
64 |
| indent comment |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
65 |
| indent cmdline |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
66 |
| indent emptyline |
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
67 |
| <error> |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
68 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
69 |
emptyline: eol |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
70 |
|
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
71 |
comment: /!.*/ eol |
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
72 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
73 |
cmdline: l_hostname eol |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
74 |
| l_hash eol |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
75 |
| word(s) eol |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
76 |
|
|
23
27a2afb406bf
cisco.grammar: word can contain any nonspace character
"Tomas Zeman <tzeman@volny.cz>"
parents:
22
diff
changeset
|
77 |
word: /\S+/ # any non-space |
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
78 |
{ $item[1] }
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
79 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
80 |
type: /\w+/ |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
81 |
{ $item[1] }
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
82 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
83 |
num: /\d+/ |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
84 |
{ $item[1] }
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
85 |
|
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
86 |
indent: /\d+/ |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
87 |
{ $item[1] }
|
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
88 |
|
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
89 |
range: /\d+/"-"/\d+/ |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
90 |
{ { from => $item[1], to => $item[3] } }
|
|
16
6822d0e5df57
cisco.grammar: fixed timeslot range, e3 controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
15
diff
changeset
|
91 |
| /\d+/ |
|
6822d0e5df57
cisco.grammar: fixed timeslot range, e3 controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
15
diff
changeset
|
92 |
{ { from => $item[1], to => $item[1] } }
|
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
93 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
94 |
keyword: /[\w-]+/ |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
95 |
{ $item[1] }
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
96 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
97 |
identifier: /[0-9a-zA-Z:_-]+/ |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
98 |
{ $item[1] }
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
99 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
100 |
quoted_text: <perl_quotelike> |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
101 |
{ $item[1][2] }
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
102 |
| /[0-9a-zA-Z:\/_\#\"\.,-]+/ |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
103 |
{ $item[1] }
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
104 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
105 |
value: /[0-9a-zA-Z:\/_\#\"\.,-]+/ |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
106 |
{ $item[1] }
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
107 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
108 |
eofile: /^\Z/ |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
109 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
110 |
eol: /\n/ |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
111 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
112 |
rest_of_line: word(s) |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
113 |
| eol |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
114 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
115 |
# section |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
116 |
section: cmdline(s) "!" |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
117 |
{ print "section\n"; }
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
118 |
|
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
119 |
l_section: /[1-9]/ word(s) eol |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
120 |
| /[1-9]/ "!" eol |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
121 |
| /[1-9]/ eol |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
122 |
| <error> |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
123 |
|
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
124 |
# Lines w/ hash (passwd, secret etc) |
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
125 |
l_hash: word(s) /\S+/ word(s) |
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
126 |
| word(s) /\S+/ |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
127 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
128 |
# Hostname |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
129 |
l_hostname: "hostname" identifier |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
130 |
{ $::res->{hostname} = $item{identifier} }
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
131 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
132 |
# Description |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
133 |
l_description: "description" /[^\n]+/ |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
134 |
{ $arg{ctx}->{description} = $item[2] }
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
135 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
136 |
# controller section |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
137 |
controller_num: /\d+\/\d+/ |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
138 |
{ $item[1] }
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
139 |
|
|
16
6822d0e5df57
cisco.grammar: fixed timeslot range, e3 controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
15
diff
changeset
|
140 |
chan_grp_content: "channel-group" num "timeslots" range |
|
6822d0e5df57
cisco.grammar: fixed timeslot range, e3 controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
15
diff
changeset
|
141 |
{ $arg{ctx}->{"channel-group"}->{$item{num}}->{ts} = $item{range} }
|
|
6822d0e5df57
cisco.grammar: fixed timeslot range, e3 controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
15
diff
changeset
|
142 |
|
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
143 |
s_controller: "0" "controller" type controller_num eol s_controller_l[ctx => ctx('controller', $item{controller_num}) ](s) "0" "!" eol
|
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
144 |
{ $::res->{controller}->{$item{controller_num}}->{type} = $item{type} }
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
145 |
|
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
146 |
s_controller_l: "1" s_controller_content[ctx => $arg{ctx}] eol
|
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
147 |
| l_section |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
148 |
|
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
149 |
s_controller_content: l_description[ctx => $arg{ctx}]
|
|
16
6822d0e5df57
cisco.grammar: fixed timeslot range, e3 controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
15
diff
changeset
|
150 |
| chan_grp_content[ctx => $arg{ctx}]
|
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
151 |
| "channel-group" num "unframed" |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
152 |
{ $arg{ctx}->{"channel-group"}->{$item{num}}->{unframed} = 1 }
|
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
153 |
| "framing" keyword |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
154 |
{ $arg{ctx}->{framing} = $item{keyword} }
|
|
15
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
155 |
| "au-4" num "tug-3" num eol s_tug_l[ctx => ctx_rel($arg{ctx}, 'au', $item[2], 'tug', $item[4]) ](s)
|
|
16
6822d0e5df57
cisco.grammar: fixed timeslot range, e3 controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
15
diff
changeset
|
156 |
| s_e3_l[ctx => $arg{ctx}]
|
|
15
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
157 |
|
|
16
6822d0e5df57
cisco.grammar: fixed timeslot range, e3 controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
15
diff
changeset
|
158 |
# SONET controller specific |
|
15
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
159 |
s_tug_l: "2" "tug-2" num "e1" num tug_content[ctx => ctx_rel($arg{ctx}, $item[3].'/'.$item[5]) ] eol
|
|
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
160 |
|
|
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
161 |
tug_content: l_description[ctx => $arg{ctx}]
|
|
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
162 |
| "unframed" |
|
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
163 |
{ $arg{ctx}->{unframed} = 1 }
|
|
16
6822d0e5df57
cisco.grammar: fixed timeslot range, e3 controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
15
diff
changeset
|
164 |
| chan_grp_content[ctx => $arg{ctx}]
|
|
15
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
165 |
| word(s) |
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
166 |
|
|
16
6822d0e5df57
cisco.grammar: fixed timeslot range, e3 controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
15
diff
changeset
|
167 |
# E3 controller specific |
|
6822d0e5df57
cisco.grammar: fixed timeslot range, e3 controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
15
diff
changeset
|
168 |
s_e3_l: "e1" num chan_grp_content[ctx => ctx_rel($arg{ctx}, 'e1', $item{num})]
|
|
6822d0e5df57
cisco.grammar: fixed timeslot range, e3 controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
15
diff
changeset
|
169 |
|
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
170 |
# Vlan range |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
171 |
vlan_s_range: /\d+/"-"/\d+/ |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
172 |
{
|
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
173 |
for (my $i = $item[1]; $i <= $item[3]; $i++) {
|
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
174 |
$arg{ctx}->{$arg{key}}->{$i} = 1; }
|
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
175 |
} |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
176 |
| /\d+/ |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
177 |
{ $arg{ctx}->{$arg{key}}->{$item[1]} = 1 }
|
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
178 |
vlan_range: vlan_s_range","vlan_range |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
179 |
| vlan_s_range |
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
180 |
|
| 13 | 181 |
# vlan section |
182 |
s_vlan: "0" "vlan" num eol "1" "name" identifier eol |
|
183 |
{ $::res->{vlans}->{$item{num}}->{name} = $item{identifier} }
|
|
184 |
||
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
185 |
# interface section |
| 12 | 186 |
iface_name: /\w+(-\w+)?\d+[0-9\/\.:]*/ |
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
187 |
{ $item[1] }
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
188 |
|
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
189 |
s_interface: "0" "interface" iface_name /\S*/ eol s_interface_l[ctx => ctx("interface", $item{iface_name}) ](s) "0" "!" eol
|
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
190 |
{
|
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
191 |
$::res->{interface}->{$item{iface_name}}->{type} = $item[4]
|
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
192 |
if length($item[4]) > 0 |
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
193 |
} |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
194 |
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
195 |
ip: /\d+\.\d+\.\d+\.\d+/ |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
196 |
{ $item[1] }
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
197 |
|
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
198 |
s_interface_l: "1" s_interface_content[ctx => $arg{ctx}] eol
|
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
199 |
| l_section |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
200 |
|
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
201 |
s_interface_content: l_description[ctx => $arg{ctx}]
|
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
202 |
| /(no)?/ "shutdown" |
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
203 |
{ $arg{ctx}->{shutdown} = ($item[1] eq 'no') ? 0 : 1 }
|
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
204 |
| "ip" "address" ip ip |
|
15
fb5c38cb93a9
cisco.grammar: parse au/tug inside sonet controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
14
diff
changeset
|
205 |
{ $arg{ctx}->{ip} = $item[3]; $arg{ctx}->{mask} = $item[4] }
|
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
206 |
| "encapsulation" keyword /\S*/ |
|
10
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
207 |
{
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
208 |
$arg{ctx}->{encap} = $item[2];
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
209 |
$arg{ctx}->{encap_param} = $item[3] if length($item[3]) > 0
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
210 |
} |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
211 |
| "frame-relay" keyword keyword |
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
212 |
{ $arg{ctx}->{"frame-relay"} = {type => $item[2], value => $item[3]} }
|
|
91148603fd70
added cisco.grammar: parse hostname, controllers, interfaces
"Tomas Zeman <tzeman@volny.cz>"
parents:
diff
changeset
|
213 |
| "bandwidth" num |
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
214 |
{ $arg{ctx}->{bandwidth} = $item{num} }
|
|
16
6822d0e5df57
cisco.grammar: fixed timeslot range, e3 controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
15
diff
changeset
|
215 |
| "speed" num |
|
6822d0e5df57
cisco.grammar: fixed timeslot range, e3 controller
"Tomas Zeman <tzeman@volny.cz>"
parents:
15
diff
changeset
|
216 |
{ $arg{ctx}->{speed} = $item{num} }
|
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
217 |
| "ip" "vrf" "forwarding" word |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
218 |
{ $arg{ctx}->{"ip-vrf-fwd"} = $item{word} }
|
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
219 |
| "switchport" "mode" /access|trunk/ |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
220 |
{ $arg{ctx}->{"switchport-mode"} = $item[3] }
|
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
221 |
| "switchport" "access" "vlan" num |
|
19
0f5d67d6ed04
cisco.grammar: unify vlans for access/trunk switch port
"Tomas Zeman <tzeman@volny.cz>"
parents:
16
diff
changeset
|
222 |
{ $arg{ctx}->{vlan}->{$item{num}} = 1 }
|
|
11
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
223 |
| "switchport" "trunk" "encapsulation" keyword |
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
224 |
{ $arg{ctx}->{"trunk-encap"} = $item{keyword} }
|
|
c170b1da9b6e
cisco.grammar: refactored to use indentation markers fro proper in-section parsing; more controller, interface properties
"Tomas Zeman <tzeman@volny.cz>"
parents:
10
diff
changeset
|
225 |
| "switchport" "trunk" "allowed" "vlan" vlan_range[ctx => $arg{ctx}, key => "vlan"]
|
|
20
2635a9301907
cisco.grammar: allowed vlan add for trunkports
"Tomas Zeman <tzeman@volny.cz>"
parents:
19
diff
changeset
|
226 |
| "switchport" "trunk" "allowed" "vlan" "add" vlan_range[ctx => $arg{ctx}, key => "vlan"]
|
|
21
6669e636dfa2
cisco.grammar: channel-group, bridge-group
"Tomas Zeman <tzeman@volny.cz>"
parents:
20
diff
changeset
|
227 |
| "channel-group" num |
|
6669e636dfa2
cisco.grammar: channel-group, bridge-group
"Tomas Zeman <tzeman@volny.cz>"
parents:
20
diff
changeset
|
228 |
{ $arg{ctx}->{"channel-group"} = $item{num} }
|
| 12 | 229 |
| "channel-group" num "mode" keyword |
|
21
6669e636dfa2
cisco.grammar: channel-group, bridge-group
"Tomas Zeman <tzeman@volny.cz>"
parents:
20
diff
changeset
|
230 |
{ $arg{ctx}->{"channel-group"} = $item{num} }
|
| 12 | 231 |
| "ip" "vrf" "forwarding" word |
232 |
{ $arg{ctx}->{"ip-vrf-fwd"} = $item{word} }
|
|
|
21
6669e636dfa2
cisco.grammar: channel-group, bridge-group
"Tomas Zeman <tzeman@volny.cz>"
parents:
20
diff
changeset
|
233 |
| "bridge-group" num |
|
6669e636dfa2
cisco.grammar: channel-group, bridge-group
"Tomas Zeman <tzeman@volny.cz>"
parents:
20
diff
changeset
|
234 |
{ $arg{ctx}->{"bridge-group"} = $item{num} }
|
| 12 | 235 |
|
236 |
# vrf section |
|
237 |
s_vrf: "0" "ip" "vrf" keyword eol s_vrf_l[ctx => ctx("vrf", $item{keyword}) ](s) "0" "!" eol
|
|
238 |
||
239 |
s_vrf_l: "1" s_vrf_content[ctx => $arg{ctx}] eol
|
|
240 |
| l_section |
|
241 |
||
242 |
rd_val: /\d+:\d+/ |
|
243 |
{ $item[1] }
|
|
244 |
||
245 |
s_vrf_content: l_description[ctx => $arg{ctx}]
|
|
246 |
| "rd" rd_val |
|
247 |
{ $arg{ctx}->{rd} = $item{rd_val} }
|
|
248 |
| "export" "map" keyword |
|
249 |
{ $arg{ctx}->{"export-map"} = $item{keyword} }
|
|
250 |
| "route-target" /export|import/ rd_val |
|
251 |
{
|
|
252 |
$arg{ctx}->{"route-target"}->{$item[2]} = []
|
|
253 |
unless exists $arg{ctx}->{"route-target"}->{$item[2]};
|
|
254 |
push @{$arg{ctx}->{"route-target"}->{$item[2]}}, $item{rd_val};
|
|
| 13 | 255 |
} |
| 12 | 256 |
|
| 14 | 257 |
# vtp |
258 |
vtp_line: "0" "vtp" /mode|domain/ identifier eol |
|
259 |
{ $::res->{vtp}->{$item[3]} = $item{identifier} }
|