]> git.proxmox.com Git - mirror_frr.git/blame - lib/grammar_sandbox_main.c
Merge pull request #5628 from donaldsharp/rtm_getneigh
[mirror_frr.git] / lib / grammar_sandbox_main.c
CommitLineData
af2567b6
DL
1/*
2 * Testing shim and API examples for the new CLI backend.
3 *
4 * Minimal main() to run grammar_sandbox standalone.
5 * [split off grammar_sandbox.c 2017-01-23]
6 * --
7 * Copyright (C) 2016 Cumulus Networks, Inc.
8 * Copyright (C) 2017 David Lamparter for NetDEF, Inc.
9 *
10 * This file is part of FreeRangeRouting (FRR).
11 *
12 * FRR is free software; you can redistribute it and/or modify it under the
13 * terms of the GNU General Public License as published by the Free Software
14 * Foundation; either version 2, or (at your option) any later version.
15 *
16 * FRR is distributed in the hope that it will be useful, but WITHOUT ANY
17 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 * details.
20 *
21 * You should have received a copy of the GNU General Public License along
896014f4
DL
22 * with this program; see the file COPYING; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
af2567b6
DL
24 */
25
b45ac5f5
DL
26#ifdef HAVE_CONFIG_H
27#include "config.h"
28#endif
29
af2567b6 30#include "command.h"
1c0d8808 31#include "lib_vty.h"
af2567b6 32
154b9e8f 33static void vty_do_exit(int isexit)
af2567b6 34{
d62a17ae 35 printf("\nend.\n");
154b9e8f
DL
36 if (!isexit)
37 exit(0);
af2567b6
DL
38}
39
40struct thread_master *master;
41
42int main(int argc, char **argv)
43{
d62a17ae 44 struct thread thread;
af2567b6 45
d62a17ae 46 master = thread_master_create(NULL);
af2567b6 47
d62a17ae 48 openzlog("grammar_sandbox", "NONE", 0, LOG_CONS | LOG_NDELAY | LOG_PID,
49 LOG_DAEMON);
50 zlog_set_level(ZLOG_DEST_SYSLOG, ZLOG_DISABLED);
51 zlog_set_level(ZLOG_DEST_STDOUT, LOG_DEBUG);
52 zlog_set_level(ZLOG_DEST_MONITOR, ZLOG_DISABLED);
af2567b6 53
d62a17ae 54 /* Library inits. */
55 cmd_init(1);
56 host.name = strdup("test");
419cd5a0 57 host.domainname = strdup("testdomainname");
af2567b6 58
2950f5da 59 vty_init(master, true);
1c0d8808 60 lib_cmd_init();
8d0d8637
RW
61 yang_init();
62 nb_init(master, NULL, 0);
af2567b6 63
d62a17ae 64 vty_stdio(vty_do_exit);
af2567b6 65
d62a17ae 66 /* Fetch next active thread. */
67 while (thread_fetch(master, &thread))
68 thread_call(&thread);
af2567b6 69
d62a17ae 70 /* Not reached. */
71 exit(0);
af2567b6 72}