Skip to content

Commit cc3519f

Browse files
authored
Merge pull request FRRouting#16182 from pguibert6WIND/isis_show_route_paths_json
Isis show route paths json
2 parents aeeceef + 611f83f commit cc3519f

16 files changed

+3761
-3447
lines changed

isisd/isis_spf.c

+206-56
Large diffs are not rendered by default.

isisd/isis_spf.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ struct isis_lsp *isis_root_system_lsp(struct lspdb_head *lspdb,
6161
__FILE__, __LINE__)
6262
int _isis_spf_schedule(struct isis_area *area, int level,
6363
const char *func, const char *file, int line);
64-
void isis_print_spftree(struct vty *vty, struct isis_spftree *spftree);
64+
void isis_print_spftree(struct vty *vty, struct isis_spftree *spftree,
65+
struct json_object **json);
6566
void isis_print_routes(struct vty *vty, struct isis_spftree *spftree,
6667
json_object **json, bool prefix_sid, bool backup);
6768
void isis_spf_init(void);

tests/isisd/test_isis_spf.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static void test_run_spf(struct vty *vty, const struct isis_topology *topology,
5555
isis_run_spf(spftree);
5656

5757
/* Print the SPT and the corresponding routing table. */
58-
isis_print_spftree(vty, spftree);
58+
isis_print_spftree(vty, spftree, NULL);
5959
isis_print_routes(vty, spftree, NULL, false, false);
6060

6161
/* Cleanup SPF tree. */
@@ -85,7 +85,7 @@ static void test_run_lfa(struct vty *vty, const struct isis_topology *topology,
8585
isis_lfa_compute(area, NULL, spftree_self, protected_resource);
8686

8787
/* Print the SPT and the corresponding main/backup routing tables. */
88-
isis_print_spftree(vty, spftree_self);
88+
isis_print_spftree(vty, spftree_self, NULL);
8989
vty_out(vty, "Main:\n");
9090
isis_print_routes(vty, spftree_self, NULL, false, false);
9191
vty_out(vty, "Backup:\n");
@@ -148,7 +148,7 @@ static void test_run_rlfa(struct vty *vty, const struct isis_topology *topology,
148148
vty_out(vty, "\n");
149149

150150
/* Print the post-convergence SPT. */
151-
isis_print_spftree(vty, spftree_pc);
151+
isis_print_spftree(vty, spftree_pc, NULL);
152152

153153
/*
154154
* Activate the computed RLFAs (if any) using artificial LDP labels for
@@ -164,7 +164,7 @@ static void test_run_rlfa(struct vty *vty, const struct isis_topology *topology,
164164
}
165165

166166
/* Print the SPT and the corresponding main/backup routing tables. */
167-
isis_print_spftree(vty, spftree_self);
167+
isis_print_spftree(vty, spftree_self, NULL);
168168
vty_out(vty, "Main:\n");
169169
isis_print_routes(vty, spftree_self, NULL, false, false);
170170
vty_out(vty, "Backup:\n");
@@ -228,7 +228,7 @@ static void test_run_ti_lfa(struct vty *vty,
228228
/*
229229
* Print the post-convergence SPT and the corresponding routing table.
230230
*/
231-
isis_print_spftree(vty, spftree_pc);
231+
isis_print_spftree(vty, spftree_pc, NULL);
232232
isis_print_routes(vty, spftree_self, NULL, false, true);
233233

234234
/* Cleanup everything. */

tests/isisd/test_isis_spf.refout

+2,246-2,020
Large diffs are not rendered by default.
+95-93
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,98 @@
1-
{
2-
"1": {
3-
"level-1": {
4-
"ipv4": [
5-
{
6-
"vertex": "r1"
7-
}
8-
],
9-
"ipv6": [
10-
{
11-
"vertex": "r1"
12-
}
13-
]
14-
},
15-
"level-2": {
16-
"ipv4": [
17-
{
18-
"vertex": "r1"
19-
},
20-
{
21-
"metric": "0",
22-
"parent": "r1(4)",
23-
"type": "IP internal",
24-
"vertex": "10.0.20.0/24"
25-
},
26-
{
27-
"interface": "r1-eth0",
28-
"metric": "10",
29-
"next-hop": "r3",
30-
"parent": "r1(4)",
31-
"type": "TE-IS",
32-
"vertex": "r3"
33-
},
34-
{
35-
"interface": "r1-eth0",
36-
"metric": "10",
37-
"next-hop": "r3",
38-
"parent": "r3(4)",
39-
"type": "IP TE",
40-
"vertex": "10.0.10.0/24"
41-
},
42-
{
43-
"interface": "r1-eth0",
44-
"metric": "10",
45-
"next-hop": "r3",
46-
"parent": "r3(4)",
47-
"type": "IP TE",
48-
"vertex": "10.0.20.0/24"
49-
},
50-
{
51-
"interface": "r1-eth0",
52-
"metric": "10",
53-
"next-hop": "r3",
54-
"parent": "r3(4)",
55-
"type": "IP TE",
56-
"vertex": "10.254.0.3/32"
57-
}
58-
],
59-
"ipv6": [
60-
{
61-
"vertex": "r1"
62-
},
63-
{
64-
"metric": "0",
65-
"parent": "r1(4)",
66-
"type": "IP6 internal",
67-
"vertex": "2001:db8:1:1::/64"
68-
},
69-
{
70-
"interface": "r1-eth0",
71-
"metric": "10",
72-
"next-hop": "r3",
73-
"parent": "r1(4)",
74-
"type": "TE-IS",
75-
"vertex": "r3"
76-
},
77-
{
78-
"metric": "10",
79-
"interface": "r1-eth0",
80-
"next-hop": "r3",
81-
"parent": "r3(4)",
82-
"type": "IP6 internal",
83-
"vertex": "2001:db8:2:1::/64"
1+
[
2+
{
3+
"area": "1",
4+
"algorithm": 0,
5+
"level-1": {
6+
"ipv4-paths": [
7+
{
8+
"vertex": "r1"
9+
}
10+
],
11+
"ipv6-paths": [
12+
{
13+
"vertex": "r1"
14+
}
15+
]
8416
},
85-
{
86-
"metric": "10",
87-
"interface": "r1-eth0",
88-
"next-hop": "r3",
89-
"parent": "r3(4)",
90-
"type": "IP6 internal",
91-
"vertex": "2001:db8:f::3/128"
17+
"level-2": {
18+
"ipv4-paths": [
19+
{
20+
"vertex": "r1"
21+
},
22+
{
23+
"metric": 0,
24+
"parent": "r1(4)",
25+
"type": "IP internal",
26+
"vertex": "10.0.20.0/24"
27+
},
28+
{
29+
"interface": "r1-eth0",
30+
"metric": 10,
31+
"nextHop": "r3",
32+
"parent": "r1(4)",
33+
"type": "TE-IS",
34+
"vertex": "r3"
35+
},
36+
{
37+
"interface": "r1-eth0",
38+
"metric": 10,
39+
"nextHop": "r3",
40+
"parent": "r3(4)",
41+
"type": "IP TE",
42+
"vertex": "10.0.10.0/24"
43+
},
44+
{
45+
"interface": "r1-eth0",
46+
"metric": 10,
47+
"nextHop": "r3",
48+
"parent": "r3(4)",
49+
"type": "IP TE",
50+
"vertex": "10.0.20.0/24"
51+
},
52+
{
53+
"interface": "r1-eth0",
54+
"metric": 10,
55+
"nextHop": "r3",
56+
"parent": "r3(4)",
57+
"type": "IP TE",
58+
"vertex": "10.254.0.3/32"
59+
}
60+
],
61+
"ipv6-paths": [
62+
{
63+
"vertex": "r1"
64+
},
65+
{
66+
"metric": 0,
67+
"parent": "r1(4)",
68+
"type": "IP6 internal",
69+
"vertex": "2001:db8:1:1::/64"
70+
},
71+
{
72+
"interface": "r1-eth0",
73+
"metric": 10,
74+
"nextHop": "r3",
75+
"parent": "r1(4)",
76+
"type": "TE-IS",
77+
"vertex": "r3"
78+
},
79+
{
80+
"metric": 10,
81+
"interface": "r1-eth0",
82+
"nextHop": "r3",
83+
"parent": "r3(4)",
84+
"type": "IP6 internal",
85+
"vertex": "2001:db8:2:1::/64"
86+
},
87+
{
88+
"metric": 10,
89+
"interface": "r1-eth0",
90+
"nextHop": "r3",
91+
"parent": "r3(4)",
92+
"type": "IP6 internal",
93+
"vertex": "2001:db8:f::3/128"
94+
}
95+
]
9296
}
93-
]
9497
}
95-
}
96-
}
98+
]

0 commit comments

Comments
 (0)