]>
git.proxmox.com Git - mirror_frr.git/blob - sharpd/sharp_vty.c
3 * Copyright (C) Cumulus Networks, Inc.
6 * This file is part of FRR.
8 * FRR is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
13 * FRR is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 #include "sharpd/sharp_zebra.h"
31 #include "sharpd/sharp_vty.h"
32 #include "sharpd/sharp_vty_clippy.c"
34 extern uint32_t total_routes
;
35 extern uint32_t installed_routes
;
36 extern uint32_t removed_routes
;
38 DEFPY (install_routes
,
40 "install routes A.B.C.D$start nexthop A.B.C.D$nexthop (1-1000000)$routes",
41 "install some routes\n"
43 "Address to start /32 generation at\n"
46 "How many to create\n")
53 total_routes
= routes
;
56 memset(&p
, 0, sizeof(p
));
57 memset(&nhop
, 0, sizeof(nhop
));
63 nhop
.gate
.ipv4
= nexthop
;
64 nhop
.type
= NEXTHOP_TYPE_IPV4
;
66 zlog_debug("Inserting %ld routes", routes
);
68 temp
= ntohl(p
.u
.prefix4
.s_addr
);
69 for (i
= 0 ; i
< routes
; i
++) {
71 p
.u
.prefix4
.s_addr
= htonl(++temp
);
79 "remove routes A.B.C.D$start (1-1000000)$routes",
80 "Remove some routes\n"
83 "Routes to uniinstall\n")
89 total_routes
= routes
;
92 memset(&p
, 0, sizeof(p
));
98 zlog_debug("Removing %ld routes", routes
);
100 temp
= ntohl(p
.u
.prefix4
.s_addr
);
101 for (i
= 0; i
< routes
; i
++) {
103 p
.u
.prefix4
.s_addr
= htonl(++temp
);
109 void sharp_vty_init(void)
111 install_element(ENABLE_NODE
, &install_routes_cmd
);
112 install_element(ENABLE_NODE
, &remove_routes_cmd
);