--- a/oneaccess.gramar Tue Aug 21 13:01:44 2012 +0200
+++ b/oneaccess.gramar Tue Aug 21 13:10:37 2012 +0200
@@ -114,6 +114,18 @@
rest_of_line: word(s)
| eol
+# generic attribute/value pair, handles no ... and single-param switches
+avpair: identifier word
+ {
+ if ($item[1] eq 'no') {
+ $arg{ctx}->{$item[2]} = 0;
+ } else {
+ $arg{ctx}->{$item[1]} = $item[2];
+ }
+ }
+ | identifier
+ { $arg{ctx}->{$item[1]} = 1 }
+
# section
section: cmdline(s) "!"
{ print "section\n"; }
@@ -181,6 +193,7 @@
{ $item[1] }
s_interface_l: "1" s_interface_content[ctx => $arg{ctx}] eol
+ | s_isdn[ctx => $arg{ctx}]
| l_section
s_interface_content: l_description[ctx => $arg{ctx}]
@@ -210,6 +223,10 @@
| "ip" "access-group" identifier /in|out/
{ $arg{ctx}->{'access-group'}->{$item[4]} = $item{identifier} }
+s_isdn: "1" "isdn" eol s_isdn_l[ctx => ctx_rel($arg{ctx}, 'isdn')](s) "1" "exit" eol
+
+s_isdn_l: "2" avpair[ctx => $arg{ctx}] eol
+
# vrf
l_vrf: "0" "ip" "vrf" keyword eol
{ $::res->{"ip-vrf"} = $item{keyword} }
@@ -246,21 +263,10 @@
# dial peers
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
-s_dial_peer_l: "1" s_dial_peer_content[ctx => $arg{ctx}] eol
+s_dial_peer_l: "1" avpair[ctx => $arg{ctx}] eol
{
$arg{ctx}->{type} = $arg{type};
$arg{ctx}->{num} = $arg{num}
}
| l_section
-s_dial_peer_content: identifier word
- {
- if ($item[1] eq 'no') {
- $arg{ctx}->{$item[2]} = 0;
- } else {
- $arg{ctx}->{$item[1]} = $item[2];
- }
- }
- | identifier
- { $arg{ctx}->{$item[1]} = 1 }
-