summaryrefslogtreecommitdiffstats
path: root/tests/isisd/test_common.h
blob: f0c5493c9dee8b293d4926f20e33e623395b9e66 (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
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (C) 2020  NetDEF, Inc.
 *                     Renato Westphal
 */

#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 event_loop *master;
extern struct zebra_privs_t isisd_privs;
extern struct isis_topology test_topologies[];

#endif /* _COMMON_ISIS_H */