cisco.grammar
changeset 16 6822d0e5df57
parent 15 fb5c38cb93a9
child 19 0f5d67d6ed04
equal deleted inserted replaced
15:fb5c38cb93a9 16:6822d0e5df57
    62 indent:		/\d+/
    62 indent:		/\d+/
    63 		{ $item[1] }
    63 		{ $item[1] }
    64 
    64 
    65 range:		/\d+/"-"/\d+/
    65 range:		/\d+/"-"/\d+/
    66 		{ { from => $item[1], to => $item[3] } } 
    66 		{ { from => $item[1], to => $item[3] } } 
       
    67 		| /\d+/
       
    68 		{ { from => $item[1], to => $item[1] } } 
    67 
    69 
    68 keyword:	/[\w-]+/
    70 keyword:	/[\w-]+/
    69 		{ $item[1] }
    71 		{ $item[1] }
    70 
    72 
    71 identifier:	/[0-9a-zA-Z:_-]+/
    73 identifier:	/[0-9a-zA-Z:_-]+/
   109 
   111 
   110 # controller section
   112 # controller section
   111 controller_num:	/\d+\/\d+/
   113 controller_num:	/\d+\/\d+/
   112 		{ $item[1] }
   114 		{ $item[1] }
   113 
   115 
       
   116 chan_grp_content: "channel-group" num "timeslots" range
       
   117 		{ $arg{ctx}->{"channel-group"}->{$item{num}}->{ts} = $item{range} }
       
   118 
   114 s_controller:	"0" "controller" type controller_num eol s_controller_l[ctx => ctx('controller', $item{controller_num}) ](s) "0" "!" eol
   119 s_controller:	"0" "controller" type controller_num eol s_controller_l[ctx => ctx('controller', $item{controller_num}) ](s) "0" "!" eol
   115 		{ $::res->{controller}->{$item{controller_num}}->{type} = $item{type} }
   120 		{ $::res->{controller}->{$item{controller_num}}->{type} = $item{type} }
   116 
   121 
   117 s_controller_l:	"1" s_controller_content[ctx => $arg{ctx}] eol
   122 s_controller_l:	"1" s_controller_content[ctx => $arg{ctx}] eol
   118 		| l_section
   123 		| l_section
   119 
   124 
   120 s_controller_content: l_description[ctx => $arg{ctx}]
   125 s_controller_content: l_description[ctx => $arg{ctx}]
   121 		| "channel-group" num "timeslots" range
   126 		| chan_grp_content[ctx => $arg{ctx}]
   122 		{ $arg{ctx}->{"channel-group"}->{$item{num}}->{ts} = $item{range} }
       
   123 		| "channel-group" num "unframed"
   127 		| "channel-group" num "unframed"
   124 		{ $arg{ctx}->{"channel-group"}->{$item{num}}->{unframed} = 1 }
   128 		{ $arg{ctx}->{"channel-group"}->{$item{num}}->{unframed} = 1 }
   125 		| "framing" keyword
   129 		| "framing" keyword
   126 		{ $arg{ctx}->{framing} = $item{keyword} }
   130 		{ $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)
   131 		| "au-4" num "tug-3" num eol s_tug_l[ctx => ctx_rel($arg{ctx}, 'au', $item[2], 'tug', $item[4]) ](s)
   128 
   132 		| s_e3_l[ctx => $arg{ctx}]
       
   133 
       
   134 # SONET controller specific
   129 s_tug_l:	"2" "tug-2" num "e1" num tug_content[ctx => ctx_rel($arg{ctx}, $item[3].'/'.$item[5]) ] eol
   135 s_tug_l:	"2" "tug-2" num "e1" num tug_content[ctx => ctx_rel($arg{ctx}, $item[3].'/'.$item[5]) ] eol
   130 
   136 
   131 tug_content:	l_description[ctx => $arg{ctx}]
   137 tug_content:	l_description[ctx => $arg{ctx}]
   132 		| "unframed"
   138 		| "unframed"
   133 		{ $arg{ctx}->{unframed} = 1 }
   139 		{ $arg{ctx}->{unframed} = 1 }
   134 		| "channel-group" num "timeslots" range
   140 		| chan_grp_content[ctx => $arg{ctx}]
   135 		{ $arg{ctx}->{"channel-group"}->{$item{num}}->{ts} = $item{range} }
       
   136 		| word(s)
   141 		| word(s)
       
   142 
       
   143 # E3 controller specific
       
   144 s_e3_l:		"e1" num chan_grp_content[ctx => ctx_rel($arg{ctx}, 'e1', $item{num})]
   137 
   145 
   138 # Vlan range
   146 # Vlan range
   139 vlan_s_range:	/\d+/"-"/\d+/
   147 vlan_s_range:	/\d+/"-"/\d+/
   140 		{
   148 		{
   141 		for (my $i = $item[1]; $i <= $item[3]; $i++) {
   149 		for (my $i = $item[1]; $i <= $item[3]; $i++) {
   178 		}
   186 		}
   179 		| "frame-relay" keyword keyword
   187 		| "frame-relay" keyword keyword
   180 		{ $arg{ctx}->{"frame-relay"} = {type => $item[2], value => $item[3]} }
   188 		{ $arg{ctx}->{"frame-relay"} = {type => $item[2], value => $item[3]} }
   181 		| "bandwidth" num
   189 		| "bandwidth" num
   182 		{ $arg{ctx}->{bandwidth} = $item{num} }
   190 		{ $arg{ctx}->{bandwidth} = $item{num} }
       
   191 		| "speed" num
       
   192 		{ $arg{ctx}->{speed} = $item{num} }
   183 		| "ip" "vrf" "forwarding" word
   193 		| "ip" "vrf" "forwarding" word
   184 		{ $arg{ctx}->{"ip-vrf-fwd"} = $item{word} }
   194 		{ $arg{ctx}->{"ip-vrf-fwd"} = $item{word} }
   185 		| "switchport" "mode" /access|trunk/
   195 		| "switchport" "mode" /access|trunk/
   186 		{ $arg{ctx}->{"switchport-mode"} = $item[3] }
   196 		{ $arg{ctx}->{"switchport-mode"} = $item[3] }
   187 		| "switchport" "access" "vlan" num
   197 		| "switchport" "access" "vlan" num