* Support for YANG identity and identityref according to RFC 7950 Sec 7.18 and 9.10

* Previous support did no validation of values.
  * Validation of types and CLI expansion
  * Example extended with inclusion of iana-if-type RFC 7224 interface identities
This commit is contained in:
Olof hagsand 2018-06-03 15:36:05 +02:00
parent ea13727e97
commit 7e4e1d6deb
27 changed files with 2124 additions and 203 deletions

View file

@ -69,6 +69,7 @@ YANGSPECS += ietf-routing@2014-10-26.yang
YANGSPECS += ietf-ipv4-unicast-routing@2014-10-26.yang
YANGSPECS += ietf-ipv6-unicast-routing@2014-10-26.yang
YANGSPECS += ietf-ipsec@2016-03-09.yang
YANGSPECS += iana-if-type@2014-05-08.yang
# Backend plugin
BE_SRC = $(APPNAME)_backend.c

View file

@ -1,14 +1,28 @@
module example {
prefix ex;
import ietf-interfaces {
prefix if;
}
import ietf-ip {
prefix ip;
}
import ietf-routing {
prefix rt;
}
import iana-if-type {
prefix ianaift;
}
description
"Example code that includes ietf-ip and ietf-routing";
/* Example interface type for tests, local callbacks, etc */
identity eth {
base if:interface-type;
}
identity loopback {
base if:interface-type;
}
/* Translation function example - See also example_cli */
list translate{
leaf value{
type string;

View file

@ -190,7 +190,7 @@ plugin_statedata(clicon_handle h,
/* Example of (static) statedata, real code would poll state */
if (xml_parse_string("<interfaces-state><interface>"
"<name>eth0</name>"
"<type>eth</type>"
"<type>ex:eth</type>"
"<if-index>42</if-index>"
"</interface></interfaces-state>", NULL, &xstate) < 0)
goto done;
@ -221,7 +221,7 @@ plugin_reset(clicon_handle h,
cxobj *xt = NULL;
if (xml_parse_string("<config><interfaces><interface>"
"<name>lo</name><type>local</type>"
"<name>lo</name><type>ex:loopback</type>"
"</interface></interfaces></config>", NULL, &xt) < 0)
goto done;
/* Replace parent w fiorst child */

View file

@ -55,7 +55,7 @@ load("Load configuration from XML file") <filename:string>("Filename (local file
merge("Merge file with existent candidate"), load_config_file("filename", "merge");
}
example("This is a comment") <var:int32>("Just a random number"), mycallback("myarg");
rpc("fib-route rpc") <instance:string>("routing instance"), fib_route_rpc("myarg");
rpc("ex:fib-route rpc") <instance:string>("routing instance"), fib_route_rpc("myarg");
notify("Get notifications from backend"), cli_notify("ROUTING", "1", "text");
no("Negate") notify("Get notifications from backend"), cli_notify("ROUTING", "0", "xml");
lock,cli_lock("candidate");

File diff suppressed because it is too large Load diff