diff options
author | Emanuele Di Pascale <emanuele@voltanet.io> | 2019-06-28 10:01:56 +0200 |
---|---|---|
committer | Emanuele Di Pascale <emanuele@voltanet.io> | 2019-07-10 15:20:27 +0200 |
commit | ff90cc95d510a314e1741357a945a9fabc8a22fb (patch) | |
tree | 4cb1baf9ea589fe17ef6cc90d8d20114e37ae908 | |
parent | lib, zebra: handle failure in get chunk (diff) | |
download | frr-ff90cc95d510a314e1741357a945a9fabc8a22fb.tar.xz frr-ff90cc95d510a314e1741357a945a9fabc8a22fb.zip |
tests: remove test_lblmgr.c
This is not part of the make check tests and it has been broken
for a while, apparently. The way the label manager is coded makes
it very hard to code unit tests, and testing the relay of requests
to an external label manager is probably better done through
a topotest, so remove this.
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
-rw-r--r-- | tests/test_lblmgr.c | 148 |
1 files changed, 0 insertions, 148 deletions
diff --git a/tests/test_lblmgr.c b/tests/test_lblmgr.c deleted file mode 100644 index 530375823..000000000 --- a/tests/test_lblmgr.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Label Manager Test - * - * Copyright (C) 2017 by Bingen Eguzkitza, - * Volta Networks Inc. - * - * This file is part of FreeRangeRouting (FRR) - * - * FRR is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * FRR is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; see the file COPYING; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "lib/stream.h" -#include "lib/zclient.h" - -#define ZSERV_PATH "/tmp/zserv.api" // TODO!! -#define KEEP 0 /* change to 1 to avoid garbage collection */ -#define CHUNK_SIZE 32 - -struct zclient *zclient; -unsigned short instance = 1; - -const char *sequence = "GGRGGGRRG"; - -static int zebra_send_get_label_chunk(void); -static int zebra_send_release_label_chunk(uint32_t start, uint32_t end); - -static void process_next_call(uint32_t start, uint32_t end) -{ - sleep(3); - if (!*sequence) - exit(0); - if (*sequence == 'G') - zebra_send_get_label_chunk(); - else if (*sequence == 'R') - zebra_send_release_label_chunk(start, end); -} - -/* Connect to Label Manager */ - -static int zebra_send_label_manager_connect() -{ - int ret; - - printf("Connect to Label Manager\n"); - - ret = lm_label_manager_connect(zclient, 0); - printf("Label Manager connection result: %u \n", ret); - if (ret != 0) { - fprintf(stderr, "Error %d connecting to Label Manager %s\n", - ret, strerror(errno)); - exit(1); - } - - process_next_call(0, 0); -} - -/* Get Label Chunk */ - -static int zebra_send_get_label_chunk() -{ - uint32_t start; - uint32_t end; - int ret; - - printf("Ask for label chunk \n"); - - ret = lm_get_label_chunk(zclient, KEEP, MPLS_LABEL_BASE_ANY, CHUNK_SIZE, - &start, &end); - if (ret != 0) { - fprintf(stderr, "Error %d requesting label chunk %s\n", ret, - strerror(errno)); - exit(1); - } - - sequence++; - - printf("Label Chunk assign: %u - %u \n", start, end); - - process_next_call(start, end); -} - -/* Release Label Chunk */ - -static int zebra_send_release_label_chunk(uint32_t start, uint32_t end) -{ - struct stream *s; - int ret; - - printf("Release label chunk: %u - %u\n", start, end); - - ret = lm_release_label_chunk(zclient, start, end); - if (ret != 0) { - fprintf(stderr, "Error releasing label chunk\n"); - exit(1); - } - - sequence++; - - process_next_call(start - CHUNK_SIZE, end - CHUNK_SIZE); -} - - -void init_zclient(struct thread_master *master, char *lm_zserv_path) -{ - frr_zclient_addr(&zclient_addr, &zclient_addr_len, lm_zserv_path); - - zclient = zclient_new(master, &zclient_options_default); - /* zclient_init(zclient, ZEBRA_LABEL_MANAGER, 0); */ - zclient->sock = -1; - zclient->redist_default = ZEBRA_ROUTE_LDP; - zclient->instance = instance; - if (zclient_socket_connect(zclient) < 0) { - printf("Error connecting synchronous zclient!\n"); - exit(1); - } -} - -int main(int argc, char *argv[]) -{ - struct thread_master *master; - struct thread thread; - int ret; - - printf("Sequence to be tested: %s\n", sequence); - - master = thread_master_create(NULL); - init_zclient(master, ZSERV_PATH); - - zebra_send_label_manager_connect(); - - return 0; -} |