2 * Copyright (C) 2018 NetDEF, Inc.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along
16 * with this program; see the file COPYING; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #define REALLY_NEED_PLAIN_GETOPT 1
27 #include "northbound.h"
29 static void __attribute__((noreturn
)) usage(int status
)
31 fprintf(stderr
, "usage: gen_yang_deviations [-h] MODULE\n");
35 static int generate_yang_deviation(const struct lys_node
*snode
, void *arg
)
37 char xpath
[XPATH_MAXLEN
];
39 yang_snode_get_path(snode
, YANG_PATH_SCHEMA
, xpath
, sizeof(xpath
));
41 printf(" deviation \"%s\" {\n", xpath
);
42 printf(" deviate not-supported;\n");
45 return YANG_ITER_CONTINUE
;
48 int main(int argc
, char *argv
[])
50 struct yang_module
*module
;
53 while ((opt
= getopt(argc
, argv
, "h")) != -1) {
70 /* Load YANG module. */
71 module
= yang_module_load(argv
[0]);
73 /* Generate deviations. */
74 yang_snodes_iterate(module
->info
, generate_yang_deviation
,
75 YANG_ITER_FILTER_IMPLICIT
, NULL
);
77 /* Cleanup and exit. */