summaryrefslogtreecommitdiffstats
path: root/tests/isisd/test_common.h
blob: 3359a893acf3e9be6b019fad27c9913f535d74b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
 * Copyright (C) 2020  NetDEF, Inc.
 *                     Renato Westphal
 *
 * This program 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 of the License, or (at your option)
 * any later version.
 *
 * This program 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
 */

#ifndef _COMMON_ISIS_H
#define _COMMON_ISIS_H

#include "isisd/isisd.h"
#include "isisd/isis_spf.h"
#include "isisd/isis_spf_private.h"

#define MAX_HOSTNAME 16
#define MAX_NETWORKS 8
#define MAX_ADJACENCIES 8
#define MAX_NODES 12

#define SRGB_DFTL_LOWER_BOUND 16000
#define SRGB_DFTL_RANGE_SIZE 8000

struct isis_test_adj {
	char hostname[MAX_HOSTNAME];
	uint8_t pseudonode_id;
	uint32_t metric;
};

struct isis_test_node {
	char hostname[MAX_HOSTNAME];
	uint8_t sysid[ISIS_SYS_ID_LEN];
	uint8_t pseudonode_id;
	int level;
	struct {
		bool ipv4;
		bool ipv6;
	} protocols;
	const char *router_id;
	struct {
		uint32_t lower_bound;
		uint32_t range_size;
	} srgb;
	const char *networks[MAX_NETWORKS + 1];
	struct isis_test_adj adjacencies[MAX_ADJACENCIES + 1];
	uint8_t flags;
};
#define F_ISIS_TEST_NODE_SR 0x01

struct isis_topology {
	uint16_t number;
	struct isis_test_node nodes[MAX_NODES + 1];
};

/* Prototypes. */
extern int isis_sock_init(struct isis_circuit *circuit);
extern const struct isis_test_node *
test_topology_find_node(const struct isis_topology *topology,
			const char *hostname, uint8_t pseudonode_id);
extern const struct isis_topology *
test_topology_find(struct isis_topology *test_topologies, uint16_t number);
extern mpls_label_t
test_topology_node_ldp_label(const struct isis_topology *topology,
			     struct in_addr router_id);
extern int test_topology_load(const struct isis_topology *topology,
			      struct isis_area *area,
			      struct lspdb_head lspdb[]);

/* Global variables. */
extern struct thread_master *master;
extern struct zebra_privs_t isisd_privs;
extern struct isis_topology test_topologies[];

#endif /* _COMMON_ISIS_H */