oneaccess.gramar
changeset 42 89e94dd37556
parent 41 7a33198be930
child 43 597596f302ef
equal deleted inserted replaced
41:7a33198be930 42:89e94dd37556
   112 eol:		/\n/
   112 eol:		/\n/
   113 
   113 
   114 rest_of_line:	word(s)
   114 rest_of_line:	word(s)
   115 		| eol
   115 		| eol
   116 
   116 
       
   117 # generic attribute/value pair, handles no ... and single-param switches
       
   118 avpair: identifier word
       
   119 		{
       
   120 		if ($item[1] eq 'no') {
       
   121 			$arg{ctx}->{$item[2]} = 0;
       
   122 		} else {
       
   123 			$arg{ctx}->{$item[1]} = $item[2];
       
   124 		}
       
   125 		}
       
   126 		| identifier
       
   127 		{ $arg{ctx}->{$item[1]} = 1 }
       
   128 
   117 # section
   129 # section
   118 section:	cmdline(s) "!"
   130 section:	cmdline(s) "!"
   119 		{ print "section\n"; }
   131 		{ print "section\n"; }
   120 
   132 
   121 l_section:	/[1-9]/ word(s) eol
   133 l_section:	/[1-9]/ word(s) eol
   179 
   191 
   180 ip:		/\d+\.\d+\.\d+\.\d+/
   192 ip:		/\d+\.\d+\.\d+\.\d+/
   181 		{ $item[1] }
   193 		{ $item[1] }
   182 
   194 
   183 s_interface_l:  "1" s_interface_content[ctx => $arg{ctx}] eol
   195 s_interface_l:  "1" s_interface_content[ctx => $arg{ctx}] eol
       
   196 		| s_isdn[ctx => $arg{ctx}]
   184 		| l_section
   197 		| l_section
   185 
   198 
   186 s_interface_content: l_description[ctx => $arg{ctx}]
   199 s_interface_content: l_description[ctx => $arg{ctx}]
   187 		| /(no)?/ "shutdown"
   200 		| /(no)?/ "shutdown"
   188 		{ $arg{ctx}->{shutdown} = ($item[1] eq 'no') ? 0 : 1 }
   201 		{ $arg{ctx}->{shutdown} = ($item[1] eq 'no') ? 0 : 1 }
   208 		| "service-policy" /input|output/ identifier
   221 		| "service-policy" /input|output/ identifier
   209 		{ $arg{ctx}->{'service-policy'}->{$item[2]} = $item{identifier} }
   222 		{ $arg{ctx}->{'service-policy'}->{$item[2]} = $item{identifier} }
   210 		| "ip" "access-group" identifier /in|out/
   223 		| "ip" "access-group" identifier /in|out/
   211 		{ $arg{ctx}->{'access-group'}->{$item[4]} = $item{identifier} }
   224 		{ $arg{ctx}->{'access-group'}->{$item[4]} = $item{identifier} }
   212 
   225 
       
   226 s_isdn:		"1" "isdn" eol s_isdn_l[ctx => ctx_rel($arg{ctx}, 'isdn')](s) "1" "exit" eol
       
   227 
       
   228 s_isdn_l:	"2" avpair[ctx => $arg{ctx}] eol
       
   229 
   213 # vrf
   230 # vrf
   214 l_vrf:		"0" "ip" "vrf" keyword eol
   231 l_vrf:		"0" "ip" "vrf" keyword eol
   215 		{ $::res->{"ip-vrf"} = $item{keyword} }
   232 		{ $::res->{"ip-vrf"} = $item{keyword} }
   216 
   233 
   217 via_iface:	iface_type iface_num
   234 via_iface:	iface_type iface_num
   244 		{ $arg{ctx}->{$item[1]}->{$item{identifier}} = $item[3] }
   261 		{ $arg{ctx}->{$item[1]}->{$item{identifier}} = $item[3] }
   245 
   262 
   246 # dial peers
   263 # dial peers
   247 s_dial_peer:	"0" "dial-peer" "voice" word num eol s_dial_peer_l[ctx => ctx('dial-peer', $item{word}.":".$item{num}), type => $item{word}, num => $item{num} ](s) "0" "exit" eol
   264 s_dial_peer:	"0" "dial-peer" "voice" word num eol s_dial_peer_l[ctx => ctx('dial-peer', $item{word}.":".$item{num}), type => $item{word}, num => $item{num} ](s) "0" "exit" eol
   248 
   265 
   249 s_dial_peer_l:	"1" s_dial_peer_content[ctx => $arg{ctx}] eol
   266 s_dial_peer_l:	"1" avpair[ctx => $arg{ctx}] eol
   250 		{
   267 		{
   251 		$arg{ctx}->{type} = $arg{type};
   268 		$arg{ctx}->{type} = $arg{type};
   252 		$arg{ctx}->{num} = $arg{num}
   269 		$arg{ctx}->{num} = $arg{num}
   253 		}
   270 		}
   254 		| l_section
   271 		| l_section
   255 
   272 
   256 s_dial_peer_content: identifier word
       
   257 		{
       
   258 		if ($item[1] eq 'no') {
       
   259 			$arg{ctx}->{$item[2]} = 0;
       
   260 		} else {
       
   261 			$arg{ctx}->{$item[1]} = $item[2];
       
   262 		}
       
   263 		}
       
   264 		| identifier
       
   265 		{ $arg{ctx}->{$item[1]} = 1 }
       
   266