Skip to content

Commit

Permalink
Merge pull request #16698 from louis-6wind/fix-nhrp-redundancy
Browse files Browse the repository at this point in the history
nhrpd, test: fix nhrp_redundancy topotest
  • Loading branch information
ton31337 authored Sep 1, 2024
2 parents 3bf359b + 64ad1dc commit 2931b78
Show file tree
Hide file tree
Showing 43 changed files with 864 additions and 288 deletions.
2 changes: 1 addition & 1 deletion nhrpd/nhrp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ static void show_ip_nhrp_shortcut(struct nhrp_shortcut *s, void *pctx)
char buf1[PREFIX_STRLEN], buf2[SU_ADDRSTRLEN];
struct json_object *json = NULL;

if (!ctx->count) {
if (!ctx->count && !ctx->json) {
vty_out(vty, "%-8s %-24s %-24s %s\n", "Type", "Prefix", "Via",
"Identity");
}
Expand Down
4 changes: 4 additions & 0 deletions tests/topotests/nhrp_redundancy/host/zebra.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
interface host-eth0
ip address 10.4.4.7/24
!
ip route 0.0.0.0/0 10.4.4.4
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
},
"table": [
{
"interface": "r4-gre0",
"interface": "nhc1-gre0",
"type": "nhs",
"protocol": "176.16.1.2",
"protocol": "172.16.1.2",
"nbma": "192.168.1.2",
"claimed_nbma": "192.168.1.2",
"used": false,
Expand All @@ -15,9 +15,9 @@
"identity": ""
},
{
"interface": "r4-gre0",
"interface": "nhc1-gre0",
"type": "local",
"protocol": "176.16.1.4",
"protocol": "172.16.1.4",
"nbma": "192.168.2.4",
"claimed_nbma": "192.168.2.4",
"used": false,
Expand All @@ -26,9 +26,9 @@
"identity": "-"
},
{
"interface": "r4-gre0",
"interface": "nhc1-gre0",
"type": "nhs",
"protocol": "176.16.1.3",
"protocol": "172.16.1.3",
"nbma": "192.168.1.3",
"claimed_nbma": "192.168.1.3",
"used": false,
Expand All @@ -37,9 +37,9 @@
"identity": ""
},
{
"interface": "r4-gre0",
"interface": "nhc1-gre0",
"type": "nhs",
"protocol": "176.16.1.1",
"protocol": "172.16.1.1",
"nbma": "192.168.1.1",
"claimed_nbma": "192.168.1.1",
"used": false,
Expand Down
40 changes: 40 additions & 0 deletions tests/topotests/nhrp_redundancy/nhc1/nhrp_cache_nhs1_down.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"attr": {
"entriesCount": 3
},
"table": [
{
"interface": "nhc1-gre0",
"type": "nhs",
"protocol": "172.16.1.2",
"nbma": "192.168.1.2",
"claimed_nbma": "192.168.1.2",
"used": false,
"timeout": true,
"auth": false,
"identity": ""
},
{
"interface": "nhc1-gre0",
"type": "local",
"protocol": "172.16.1.4",
"nbma": "192.168.2.4",
"claimed_nbma": "192.168.2.4",
"used": false,
"timeout": false,
"auth": false,
"identity": "-"
},
{
"interface": "nhc1-gre0",
"type": "nhs",
"protocol": "172.16.1.3",
"nbma": "192.168.1.3",
"claimed_nbma": "192.168.1.3",
"used": false,
"timeout": true,
"auth": false,
"identity": ""
}
]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"176.16.1.1\/32": [
"172.16.1.1\/32": [
{
"prefix": "176.16.1.1\/32",
"prefix": "172.16.1.1\/32",
"protocol": "nhrp",
"vrfId": 0,
"vrfName": "default",
Expand All @@ -16,15 +16,15 @@
{
"fib": true,
"directlyConnected": true,
"interfaceName": "r5-gre0",
"interfaceName": "nhc1-gre0",
"active": true
}
]
}
],
"176.16.1.2\/32": [
"172.16.1.2\/32": [
{
"prefix": "176.16.1.2\/32",
"prefix": "172.16.1.2\/32",
"protocol": "nhrp",
"vrfId": 0,
"vrfName": "default",
Expand All @@ -39,15 +39,15 @@
{
"fib": true,
"directlyConnected": true,
"interfaceName": "r5-gre0",
"interfaceName": "nhc1-gre0",
"active": true
}
]
}
],
"176.16.1.3\/32": [
"172.16.1.3\/32": [
{
"prefix": "176.16.1.3\/32",
"prefix": "172.16.1.3\/32",
"protocol": "nhrp",
"vrfId": 0,
"vrfName": "default",
Expand All @@ -62,7 +62,7 @@
{
"fib": true,
"directlyConnected": true,
"interfaceName": "r5-gre0",
"interfaceName": "nhc1-gre0",
"active": true
}
]
Expand Down
49 changes: 49 additions & 0 deletions tests/topotests/nhrp_redundancy/nhc1/nhrp_route_nhs1_down.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"172.16.1.1\/32": null,
"172.16.1.2\/32": [
{
"prefix": "172.16.1.2\/32",
"protocol": "nhrp",
"vrfId": 0,
"vrfName": "default",
"selected": true,
"destSelected": true,
"distance": 10,
"metric": 0,
"installed": true,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"fib": true,
"directlyConnected": true,
"interfaceName": "nhc1-gre0",
"active": true
}
]
}
],
"172.16.1.3\/32": [
{
"prefix": "172.16.1.3\/32",
"protocol": "nhrp",
"vrfId": 0,
"vrfName": "default",
"selected": true,
"destSelected": true,
"distance": 10,
"metric": 0,
"installed": true,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"fib": true,
"directlyConnected": true,
"interfaceName": "nhc1-gre0",
"active": true
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"5.5.5.5\/32": [
"10.5.5.0\/24": [
{
"prefix": "5.5.5.5\/32",
"prefix": "10.5.5.0\/24",
"protocol": "nhrp",
"vrfId": 0,
"vrfName": "default",
Expand All @@ -15,17 +15,17 @@
"nexthops": [
{
"fib": true,
"ip": "176.16.1.5",
"ip": "172.16.1.5",
"afi": "ipv4",
"interfaceName": "r4-gre0",
"interfaceName": "nhc1-gre0",
"active": true
}
]
}
],
"176.16.1.1\/32": [
"172.16.1.1\/32": [
{
"prefix": "176.16.1.1\/32",
"prefix": "172.16.1.1\/32",
"protocol": "nhrp",
"vrfId": 0,
"vrfName": "default",
Expand All @@ -40,15 +40,15 @@
{
"fib": true,
"directlyConnected": true,
"interfaceName": "r4-gre0",
"interfaceName": "nhc1-gre0",
"active": true
}
]
}
],
"176.16.1.2\/32": [
"172.16.1.2\/32": [
{
"prefix": "176.16.1.2\/32",
"prefix": "172.16.1.2\/32",
"protocol": "nhrp",
"vrfId": 0,
"vrfName": "default",
Expand All @@ -63,15 +63,15 @@
{
"fib": true,
"directlyConnected": true,
"interfaceName": "r4-gre0",
"interfaceName": "nhc1-gre0",
"active": true
}
]
}
],
"176.16.1.3\/32": [
"172.16.1.3\/32": [
{
"prefix": "176.16.1.3\/32",
"prefix": "172.16.1.3\/32",
"protocol": "nhrp",
"vrfId": 0,
"vrfName": "default",
Expand All @@ -86,15 +86,15 @@
{
"fib": true,
"directlyConnected": true,
"interfaceName": "r4-gre0",
"interfaceName": "nhc1-gre0",
"active": true
}
]
}
],
"176.16.1.5\/32": [
"172.16.1.5\/32": [
{
"prefix": "176.16.1.5\/32",
"prefix": "172.16.1.5\/32",
"protocol": "nhrp",
"vrfId": 0,
"vrfName": "default",
Expand All @@ -109,7 +109,7 @@
{
"fib": true,
"directlyConnected": true,
"interfaceName": "r4-gre0",
"interfaceName": "nhc1-gre0",
"active": true
}
]
Expand Down
Loading

0 comments on commit 2931b78

Please sign in to comment.