]>
git.proxmox.com Git - mirror_frr.git/blob - tools/gen_yang_deviations.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2018 NetDEF, Inc.
7 #define REALLY_NEED_PLAIN_GETOPT 1
14 #include "northbound.h"
16 static void __attribute__((noreturn
)) usage(int status
)
18 fprintf(stderr
, "usage: gen_yang_deviations [-h] MODULE\n");
22 static int generate_yang_deviation(const struct lysc_node
*snode
, void *arg
)
24 char xpath
[XPATH_MAXLEN
];
26 yang_snode_get_path(snode
, YANG_PATH_SCHEMA
, xpath
, sizeof(xpath
));
28 printf(" deviation \"%s\" {\n", xpath
);
29 printf(" deviate not-supported;\n");
32 return YANG_ITER_CONTINUE
;
35 int main(int argc
, char *argv
[])
37 struct yang_module
*module
;
40 while ((opt
= getopt(argc
, argv
, "h")) != -1) {
55 yang_init(false, false);
57 /* Load YANG module. */
58 module
= yang_module_load(argv
[0]);
60 /* Generate deviations. */
61 yang_snodes_iterate(module
->info
, generate_yang_deviation
, 0, NULL
);
63 /* Cleanup and exit. */