equal
deleted
inserted
replaced
5 #<autotree> |
5 #<autotree> |
6 { # perl code follows |
6 { # perl code follows |
7 |
7 |
8 $::res = {}; |
8 $::res = {}; |
9 |
9 |
10 # Returns pointer to context hasref as specified by ctx stack. |
10 # Returns pointer to context hashref as specified by ctx stack. |
11 # @param ctx_path array of ctx stack. |
11 # @param ctx_path array of ctx stack. |
12 sub ctx { |
12 sub ctx { |
|
13 return ctx_rel($::res, @_); |
|
14 } |
|
15 |
|
16 # Returns pointer to context hashref as specified by ctx stack, |
|
17 # relative to the supplied ctx pointer. |
|
18 # @param ptr current ctx pointer from which ctx build starts. |
|
19 # @param ctx_path array of ctx stack. |
|
20 sub ctx_rel { |
|
21 my $ptr = shift; |
13 my @ctx_path = @_; |
22 my @ctx_path = @_; |
14 my $ptr = $::res; |
|
15 foreach my $part (@ctx_path) { |
23 foreach my $part (@ctx_path) { |
16 $ptr->{$part} = {} unless exists ($ptr->{$part}); |
24 $ptr->{$part} = {} unless exists ($ptr->{$part}); |
17 $ptr = $ptr->{$part}; |
25 $ptr = $ptr->{$part}; |
18 } |
26 } |
19 return $ptr; |
27 return $ptr; |
114 { $arg{ctx}->{"channel-group"}->{$item{num}}->{ts} = $item{range} } |
122 { $arg{ctx}->{"channel-group"}->{$item{num}}->{ts} = $item{range} } |
115 | "channel-group" num "unframed" |
123 | "channel-group" num "unframed" |
116 { $arg{ctx}->{"channel-group"}->{$item{num}}->{unframed} = 1 } |
124 { $arg{ctx}->{"channel-group"}->{$item{num}}->{unframed} = 1 } |
117 | "framing" keyword |
125 | "framing" keyword |
118 { $arg{ctx}->{framing} = $item{keyword} } |
126 { $arg{ctx}->{framing} = $item{keyword} } |
|
127 | "au-4" num "tug-3" num eol s_tug_l[ctx => ctx_rel($arg{ctx}, 'au', $item[2], 'tug', $item[4]) ](s) |
|
128 |
|
129 s_tug_l: "2" "tug-2" num "e1" num tug_content[ctx => ctx_rel($arg{ctx}, $item[3].'/'.$item[5]) ] eol |
|
130 |
|
131 tug_content: l_description[ctx => $arg{ctx}] |
|
132 | "unframed" |
|
133 { $arg{ctx}->{unframed} = 1 } |
|
134 | "channel-group" num "timeslots" range |
|
135 { $arg{ctx}->{"channel-group"}->{$item{num}}->{ts} = $item{range} } |
|
136 | word(s) |
119 |
137 |
120 # Vlan range |
138 # Vlan range |
121 vlan_s_range: /\d+/"-"/\d+/ |
139 vlan_s_range: /\d+/"-"/\d+/ |
122 { |
140 { |
123 for (my $i = $item[1]; $i <= $item[3]; $i++) { |
141 for (my $i = $item[1]; $i <= $item[3]; $i++) { |
150 |
168 |
151 s_interface_content: l_description[ctx => $arg{ctx}] |
169 s_interface_content: l_description[ctx => $arg{ctx}] |
152 | /(no)?/ "shutdown" |
170 | /(no)?/ "shutdown" |
153 { $arg{ctx}->{shutdown} = ($item[1] eq 'no') ? 0 : 1 } |
171 { $arg{ctx}->{shutdown} = ($item[1] eq 'no') ? 0 : 1 } |
154 | "ip" "address" ip ip |
172 | "ip" "address" ip ip |
155 { $arg{ctx}->{ip} = $item[3]; $arg{ctx}->{mask} = $item[3] } |
173 { $arg{ctx}->{ip} = $item[3]; $arg{ctx}->{mask} = $item[4] } |
156 | "encapsulation" keyword /\S*/ |
174 | "encapsulation" keyword /\S*/ |
157 { |
175 { |
158 $arg{ctx}->{encap} = $item[2]; |
176 $arg{ctx}->{encap} = $item[2]; |
159 $arg{ctx}->{encap_param} = $item[3] if length($item[3]) > 0 |
177 $arg{ctx}->{encap_param} = $item[3] if length($item[3]) > 0 |
160 } |
178 } |