]>
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 #ifndef VTYSH_EXTRACT_PL
33 #include "sharpd/sharp_vty_clippy.c"
36 extern uint32_t total_routes
;
37 extern uint32_t installed_routes
;
38 extern uint32_t removed_routes
;
40 DEFPY (install_routes
,
42 "install routes A.B.C.D$start nexthop A.B.C.D$nexthop (1-1000000)$routes",
43 "install some routes\n"
45 "Address to start /32 generation at\n"
48 "How many to create\n")
55 total_routes
= routes
;
58 memset(&p
, 0, sizeof(p
));
59 memset(&nhop
, 0, sizeof(nhop
));
65 nhop
.gate
.ipv4
= nexthop
;
66 nhop
.type
= NEXTHOP_TYPE_IPV4
;
68 zlog_debug("Inserting %ld routes", routes
);
70 temp
= ntohl(p
.u
.prefix4
.s_addr
);
71 for (i
= 0 ; i
< routes
; i
++) {
73 p
.u
.prefix4
.s_addr
= htonl(++temp
);
81 "remove routes A.B.C.D$start (1-1000000)$routes",
82 "Remove some routes\n"
85 "Routes to uniinstall\n")
91 total_routes
= routes
;
94 memset(&p
, 0, sizeof(p
));
100 zlog_debug("Removing %ld routes", routes
);
102 temp
= ntohl(p
.u
.prefix4
.s_addr
);
103 for (i
= 0; i
< routes
; i
++) {
105 p
.u
.prefix4
.s_addr
= htonl(++temp
);
111 void sharp_vty_init(void)
113 install_element(ENABLE_NODE
, &install_routes_cmd
);
114 install_element(ENABLE_NODE
, &remove_routes_cmd
);