Yang 1.1 action syntax added (but function is not supported)

This commit is contained in:
Olof hagsand 2018-10-10 22:27:46 +02:00
parent 52021c3856
commit 507e03742d
5 changed files with 29 additions and 2 deletions

View file

@ -53,7 +53,7 @@
* Added yang_spec_parse_file
### Minor changes
* Yang 1.1 action syntax added (but function is not supported)
* New function: clicon_conf_xml() returns configuration tree
* Obsoleted COMPAT_CLIV and COMPAT_XSL that were optional in 3.7
* Added timeout option -t for clixon_netconf - quit after max time.

View file

@ -57,7 +57,8 @@
* - Cant use the symbols in this file because yacc needs token definitions
*/
enum rfc_6020{
Y_ANYXML = 0,
Y_ACTION = 0,
Y_ANYXML,
Y_ARGUMENT,
Y_AUGMENT,
Y_BASE,

View file

@ -111,6 +111,7 @@ clixon_yang_parsewrap(void)
<KEYWORD>\} { return *yytext; }
/* RFC 6020 keywords */
<KEYWORD>action { BEGIN(ARGUMENT); return K_ACTION; }
<KEYWORD>anyxml { BEGIN(ARGUMENT); return K_ANYXML; }
<KEYWORD>argument { BEGIN(ARGUMENT); return K_ARGUMENT; }
<KEYWORD>augment { BEGIN(ARGUMENT); return K_AUGMENT; }

View file

@ -64,6 +64,7 @@
* - Dont want to expose a generated yacc file to the API
* - Cant use the symbols in this file because yacc needs token definitions
*/
%token K_ACTION
%token K_ANYXML
%token K_ARGUMENT
%token K_AUGMENT
@ -523,6 +524,7 @@ container_substmt : when_stmt { clicon_debug(2,"container-substmt -> when-
| typedef_stmt { clicon_debug(2,"container-substmt -> typedef-stmt"); }
| grouping_stmt { clicon_debug(2,"container-substmt -> grouping-stmt"); }
| data_def_stmt { clicon_debug(2,"container-substmt -> data-def-stmt");}
| action_stmt { clicon_debug(2,"container-substmt -> action-stmt");}
| notification_stmt { clicon_debug(2,"container-substmt -> notification-stmt");}
| unknown_stmt { clicon_debug(2,"container-substmt -> unknown-stmt");}
| { clicon_debug(2,"container-substmt ->");}
@ -621,6 +623,7 @@ list_substmt : when_stmt { clicon_debug(2,"list-substmt -> when-stmt
| typedef_stmt { clicon_debug(2,"list-substmt -> typedef-stmt"); }
| grouping_stmt { clicon_debug(2,"list-substmt -> grouping-stmt"); }
| data_def_stmt { clicon_debug(2,"list-substmt -> data-def-stmt"); }
| action_stmt { clicon_debug(2,"list-substmt -> action-stmt"); }
| notification_stmt { clicon_debug(2,"list-substmt -> notification-stmt"); }
| unknown_stmt { clicon_debug(2,"list-substmt -> unknown-stmt");}
| { clicon_debug(2,"list-substmt -> "); }
@ -796,6 +799,7 @@ augment_substmt : when_stmt { clicon_debug(2,"augment-substmt -> when-s
| reference_stmt { clicon_debug(2,"augment-substmt -> reference-stmt"); }
| data_def_stmt { clicon_debug(2,"augment-substmt -> data-def-stmt"); }
| case_stmt { clicon_debug(2,"augment-substmt -> case-stmt");}
| action_stmt { clicon_debug(2,"augment-substmt -> action-stmt");}
| notification_stmt { clicon_debug(2,"augment-substmt -> notification-stmt");}
| { clicon_debug(2,"augment-substmt -> "); }
;
@ -850,6 +854,17 @@ rpc_substmt : if_feature_stmt { clicon_debug(2,"rpc-substmt -> if-feature-stm
| { clicon_debug(2,"rpc-substmt -> "); }
;
/* action */
action_stmt : K_ACTION id_arg_str ';'
{ if (ysp_add(_yy, Y_ACTION, $2, NULL) == NULL) _YYERROR("39");
clicon_debug(2,"action-stmt -> ACTION id-arg-str ;"); }
| K_ACTION id_arg_str
{ if (ysp_add_push(_yy, Y_ACTION, $2) == NULL) _YYERROR("40"); }
'{' rpc_substmts '}'
{ if (ystack_pop(_yy) < 0) _YYERROR("41");
clicon_debug(2,"action-stmt -> ACTION id-arg-str { rpc-substmts }"); }
;
/* input */
input_stmt : K_INPUT
{ if (ysp_add_push(_yy, Y_INPUT, NULL) == NULL) _YYERROR("42"); }
@ -996,6 +1011,7 @@ grouping_substmt : status_stmt { clicon_debug(2,"grouping-substmt -> st
| typedef_stmt { clicon_debug(2,"grouping-substmt -> typedef-stmt"); }
| grouping_stmt { clicon_debug(2,"grouping-substmt -> grouping-stmt"); }
| data_def_stmt { clicon_debug(2,"grouping-substmt -> data-def-stmt"); }
| action_stmt { clicon_debug(2,"grouping-substmt -> action-stmt"); }
| notification_stmt { clicon_debug(2,"grouping-substmt -> notification-stmt"); }
| { clicon_debug(2,"grouping-substmt -> "); }
;

View file

@ -45,9 +45,18 @@ module example{
}
rpc empty {
}
list server {
key name;
leaf name {
type string;
}
action reset {
}
}
identity eth {
base if:interface-type;
}
rpc client-rpc {
description "Example local client-side RPC that is processed by the
the netconf/restconf and not sent to the backend.