@@ -1069,11 +1069,9 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
1069
1069
pi = pi -> next ) {
1070
1070
total_count ++ ;
1071
1071
if (type == bgp_show_type_neighbor ) {
1072
- union sockunion * su = output_arg ;
1072
+ struct peer * peer = output_arg ;
1073
1073
1074
- if (pi -> peer -> su_remote == NULL
1075
- || !sockunion_same (
1076
- pi -> peer -> su_remote , su ))
1074
+ if (peer_cmp (peer , pi -> peer ) != 0 )
1077
1075
continue ;
1078
1076
}
1079
1077
if (header ) {
@@ -1292,29 +1290,41 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_tags,
1292
1290
0 );
1293
1291
}
1294
1292
1295
- DEFUN (show_ip_bgp_l2vpn_evpn_all_neighbor_routes ,
1296
- show_ip_bgp_l2vpn_evpn_all_neighbor_routes_cmd ,
1297
- "show [ip] bgp l2vpn evpn all neighbors A.B.C.D routes [json]" ,
1293
+ DEFUN (show_ip_bgp_l2vpn_evpn_neighbor_routes ,
1294
+ show_ip_bgp_l2vpn_evpn_neighbor_routes_cmd ,
1295
+ "show [ip] bgp l2vpn evpn neighbors < A.B.C.D|X:X::X:X|WORD> routes [json]" ,
1298
1296
SHOW_STR
1299
1297
IP_STR
1300
1298
BGP_STR
1301
1299
L2VPN_HELP_STR
1302
1300
EVPN_HELP_STR
1303
- "Display information about all EVPN NLRIs\n"
1304
1301
"Detailed information on TCP and BGP neighbor connections\n"
1305
- "Neighbor to display information about\n"
1302
+ "IPv4 Neighbor to display information about\n"
1303
+ "IPv6 Neighbor to display information about\n"
1304
+ "Neighbor on BGP configured interface\n"
1306
1305
"Display routes learned from neighbor\n" JSON_STR )
1307
1306
{
1308
- int idx_ipv4 = 0 ;
1309
- union sockunion su ;
1307
+ int idx = 0 ;
1310
1308
struct peer * peer ;
1311
- int ret ;
1309
+ char * peerstr = NULL ;
1312
1310
bool uj = use_json (argc , argv );
1311
+ afi_t afi = AFI_L2VPN ;
1312
+ safi_t safi = SAFI_EVPN ;
1313
+ struct bgp * bgp = NULL ;
1313
1314
1314
- argv_find (argv , argc , "A.B.C.D" , & idx_ipv4 );
1315
+ bgp_vty_find_and_parse_afi_safi_bgp (vty , argv , argc , & idx , & afi , & safi ,
1316
+ & bgp , uj );
1317
+ if (!idx ) {
1318
+ vty_out (vty , "No index\n" );
1319
+ return CMD_WARNING ;
1320
+ }
1321
+
1322
+ /* neighbors <A.B.C.D|X:X::X:X|WORD> */
1323
+ argv_find (argv , argc , "neighbors" , & idx );
1324
+ peerstr = argv [++ idx ]-> arg ;
1315
1325
1316
- ret = str2sockunion ( argv [ idx_ipv4 ] -> arg , & su );
1317
- if (ret < 0 ) {
1326
+ peer = peer_lookup_in_view ( vty , bgp , peerstr , uj );
1327
+ if (! peer ) {
1318
1328
if (uj ) {
1319
1329
json_object * json_no = NULL ;
1320
1330
json_no = json_object_new_object ();
@@ -1325,11 +1335,9 @@ DEFUN(show_ip_bgp_l2vpn_evpn_all_neighbor_routes,
1325
1335
json_object_free (json_no );
1326
1336
} else
1327
1337
vty_out (vty , "Malformed address: %s\n" ,
1328
- argv [idx_ipv4 ]-> arg );
1338
+ argv [idx ]-> arg );
1329
1339
return CMD_WARNING ;
1330
1340
}
1331
-
1332
- peer = peer_lookup (NULL , & su );
1333
1341
if (!peer || !peer -> afc [AFI_L2VPN ][SAFI_EVPN ]) {
1334
1342
if (uj ) {
1335
1343
json_object * json_no = NULL ;
@@ -1345,13 +1353,13 @@ DEFUN(show_ip_bgp_l2vpn_evpn_all_neighbor_routes,
1345
1353
return CMD_WARNING ;
1346
1354
}
1347
1355
1348
- return bgp_show_ethernet_vpn (vty , NULL , bgp_show_type_neighbor , & su , 0 ,
1356
+ return bgp_show_ethernet_vpn (vty , NULL , bgp_show_type_neighbor , peer , 0 ,
1349
1357
uj );
1350
1358
}
1351
1359
1352
1360
DEFUN (show_ip_bgp_l2vpn_evpn_rd_neighbor_routes ,
1353
1361
show_ip_bgp_l2vpn_evpn_rd_neighbor_routes_cmd ,
1354
- "show [ip] bgp l2vpn evpn rd ASN:NN_OR_IP-ADDRESS:NN neighbors A.B.C.D routes [json]" ,
1362
+ "show [ip] bgp l2vpn evpn rd ASN:NN_OR_IP-ADDRESS:NN neighbors < A.B.C.D|X:X::X:X|WORD> routes [json]" ,
1355
1363
SHOW_STR
1356
1364
IP_STR
1357
1365
BGP_STR
@@ -1360,20 +1368,30 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_neighbor_routes,
1360
1368
"Display information for a route distinguisher\n"
1361
1369
"VPN Route Distinguisher\n"
1362
1370
"Detailed information on TCP and BGP neighbor connections\n"
1363
- "Neighbor to display information about\n"
1371
+ "IPv4 Neighbor to display information about\n"
1372
+ "IPv6 Neighbor to display information about\n"
1373
+ "Neighbor on BGP configured interface\n"
1364
1374
"Display routes learned from neighbor\n" JSON_STR )
1365
1375
{
1366
1376
int idx_ext_community = 0 ;
1367
- int idx_ipv4 = 0 ;
1377
+ int idx = 0 ;
1368
1378
int ret ;
1369
- union sockunion su ;
1370
1379
struct peer * peer ;
1380
+ char * peerstr = NULL ;
1371
1381
struct prefix_rd prd ;
1372
1382
bool uj = use_json (argc , argv );
1383
+ afi_t afi = AFI_L2VPN ;
1384
+ safi_t safi = SAFI_EVPN ;
1385
+ struct bgp * bgp = NULL ;
1373
1386
1374
- argv_find (argv , argc , "ASN:NN_OR_IP-ADDRESS:NN" , & idx_ext_community );
1375
- argv_find (argv , argc , "A.B.C.D" , & idx_ipv4 );
1387
+ bgp_vty_find_and_parse_afi_safi_bgp (vty , argv , argc , & idx , & afi , & safi ,
1388
+ & bgp , uj );
1389
+ if (!idx ) {
1390
+ vty_out (vty , "No index\n" );
1391
+ return CMD_WARNING ;
1392
+ }
1376
1393
1394
+ argv_find (argv , argc , "ASN:NN_OR_IP-ADDRESS:NN" , & idx_ext_community );
1377
1395
ret = str2prefix_rd (argv [idx_ext_community ]-> arg , & prd );
1378
1396
if (!ret ) {
1379
1397
if (uj ) {
@@ -1389,8 +1407,12 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_neighbor_routes,
1389
1407
return CMD_WARNING ;
1390
1408
}
1391
1409
1392
- ret = str2sockunion (argv [idx_ipv4 ]-> arg , & su );
1393
- if (ret < 0 ) {
1410
+ /* neighbors <A.B.C.D|X:X::X:X|WORD> */
1411
+ argv_find (argv , argc , "neighbors" , & idx );
1412
+ peerstr = argv [++ idx ]-> arg ;
1413
+
1414
+ peer = peer_lookup_in_view (vty , bgp , peerstr , uj );
1415
+ if (!peer ) {
1394
1416
if (uj ) {
1395
1417
json_object * json_no = NULL ;
1396
1418
json_no = json_object_new_object ();
@@ -1401,11 +1423,9 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_neighbor_routes,
1401
1423
json_object_free (json_no );
1402
1424
} else
1403
1425
vty_out (vty , "Malformed address: %s\n" ,
1404
- argv [idx_ext_community ]-> arg );
1426
+ argv [idx ]-> arg );
1405
1427
return CMD_WARNING ;
1406
1428
}
1407
-
1408
- peer = peer_lookup (NULL , & su );
1409
1429
if (!peer || !peer -> afc [AFI_L2VPN ][SAFI_EVPN ]) {
1410
1430
if (uj ) {
1411
1431
json_object * json_no = NULL ;
@@ -1421,33 +1441,48 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_neighbor_routes,
1421
1441
return CMD_WARNING ;
1422
1442
}
1423
1443
1424
- return bgp_show_ethernet_vpn (vty , & prd , bgp_show_type_neighbor , & su , 0 ,
1444
+ return bgp_show_ethernet_vpn (vty , & prd , bgp_show_type_neighbor , peer , 0 ,
1425
1445
uj );
1426
1446
}
1427
1447
1428
- DEFUN (show_ip_bgp_l2vpn_evpn_all_neighbor_advertised_routes ,
1429
- show_ip_bgp_l2vpn_evpn_all_neighbor_advertised_routes_cmd ,
1430
- "show [ip] bgp l2vpn evpn all neighbors A.B.C.D advertised-routes [json]" ,
1448
+ DEFUN (show_ip_bgp_l2vpn_evpn_neighbor_advertised_routes ,
1449
+ show_ip_bgp_l2vpn_evpn_neighbor_advertised_routes_cmd ,
1450
+ "show [ip] bgp l2vpn evpn neighbors < A.B.C.D|X:X::X:X|WORD> advertised-routes [json]" ,
1431
1451
SHOW_STR
1432
1452
IP_STR
1433
1453
BGP_STR
1434
1454
L2VPN_HELP_STR
1435
1455
EVPN_HELP_STR
1436
- "Display information about all EVPN NLRIs\n"
1437
1456
"Detailed information on TCP and BGP neighbor connections\n"
1438
- "Neighbor to display information about\n"
1457
+ "IPv4 Neighbor to display information about\n"
1458
+ "IPv6 Neighbor to display information about\n"
1459
+ "Neighbor on BGP configured interface\n"
1439
1460
"Display the routes advertised to a BGP neighbor\n" JSON_STR )
1440
1461
{
1441
- int idx_ipv4 = 0 ;
1442
- int ret ;
1462
+ int idx = 0 ;
1443
1463
struct peer * peer ;
1444
- union sockunion su ;
1445
1464
bool uj = use_json (argc , argv );
1465
+ struct bgp * bgp = NULL ;
1466
+ afi_t afi = AFI_L2VPN ;
1467
+ safi_t safi = SAFI_EVPN ;
1468
+ char * peerstr = NULL ;
1469
+
1470
+ if (uj )
1471
+ argc -- ;
1446
1472
1447
- argv_find (argv , argc , "A.B.C.D" , & idx_ipv4 );
1473
+ bgp_vty_find_and_parse_afi_safi_bgp (vty , argv , argc , & idx , & afi , & safi ,
1474
+ & bgp , uj );
1475
+ if (!idx ) {
1476
+ vty_out (vty , "No index\n" );
1477
+ return CMD_WARNING ;
1478
+ }
1479
+
1480
+ /* neighbors <A.B.C.D|X:X::X:X|WORD> */
1481
+ argv_find (argv , argc , "neighbors" , & idx );
1482
+ peerstr = argv [++ idx ]-> arg ;
1448
1483
1449
- ret = str2sockunion ( argv [ idx_ipv4 ] -> arg , & su );
1450
- if (ret < 0 ) {
1484
+ peer = peer_lookup_in_view ( vty , bgp , peerstr , uj );
1485
+ if (! peer ) {
1451
1486
if (uj ) {
1452
1487
json_object * json_no = NULL ;
1453
1488
json_no = json_object_new_object ();
@@ -1458,10 +1493,9 @@ DEFUN(show_ip_bgp_l2vpn_evpn_all_neighbor_advertised_routes,
1458
1493
json_object_free (json_no );
1459
1494
} else
1460
1495
vty_out (vty , "Malformed address: %s\n" ,
1461
- argv [idx_ipv4 ]-> arg );
1496
+ argv [idx ]-> arg );
1462
1497
return CMD_WARNING ;
1463
1498
}
1464
- peer = peer_lookup (NULL , & su );
1465
1499
if (!peer || !peer -> afc [AFI_L2VPN ][SAFI_EVPN ]) {
1466
1500
if (uj ) {
1467
1501
json_object * json_no = NULL ;
@@ -1482,7 +1516,7 @@ DEFUN(show_ip_bgp_l2vpn_evpn_all_neighbor_advertised_routes,
1482
1516
1483
1517
DEFUN (show_ip_bgp_l2vpn_evpn_rd_neighbor_advertised_routes ,
1484
1518
show_ip_bgp_l2vpn_evpn_rd_neighbor_advertised_routes_cmd ,
1485
- "show [ip] bgp l2vpn evpn rd ASN:NN_OR_IP-ADDRESS:NN neighbors A.B.C.D advertised-routes [json]" ,
1519
+ "show [ip] bgp l2vpn evpn rd ASN:NN_OR_IP-ADDRESS:NN neighbors < A.B.C.D|X:X::X:X|WORD> advertised-routes [json]" ,
1486
1520
SHOW_STR
1487
1521
IP_STR
1488
1522
BGP_STR
@@ -1491,22 +1525,43 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_neighbor_advertised_routes,
1491
1525
"Display information for a route distinguisher\n"
1492
1526
"VPN Route Distinguisher\n"
1493
1527
"Detailed information on TCP and BGP neighbor connections\n"
1494
- "Neighbor to display information about\n"
1528
+ "IPv4 Neighbor to display information about\n"
1529
+ "IPv6 Neighbor to display information about\n"
1530
+ "Neighbor on BGP configured interface\n"
1495
1531
"Display the routes advertised to a BGP neighbor\n" JSON_STR )
1496
1532
{
1497
1533
int idx_ext_community = 0 ;
1498
- int idx_ipv4 = 0 ;
1534
+ int idx = 0 ;
1499
1535
int ret ;
1500
1536
struct peer * peer ;
1501
1537
struct prefix_rd prd ;
1502
- union sockunion su ;
1538
+ struct bgp * bgp = NULL ;
1503
1539
bool uj = use_json (argc , argv );
1540
+ char * peerstr = NULL ;
1541
+ afi_t afi = AFI_L2VPN ;
1542
+ safi_t safi = SAFI_EVPN ;
1543
+
1544
+ if (uj )
1545
+ argc -- ;
1546
+
1547
+ if (uj )
1548
+ argc -- ;
1549
+
1550
+ bgp_vty_find_and_parse_afi_safi_bgp (vty , argv , argc , & idx , & afi , & safi ,
1551
+ & bgp , uj );
1552
+ if (!idx ) {
1553
+ vty_out (vty , "No index\n" );
1554
+ return CMD_WARNING ;
1555
+ }
1504
1556
1505
1557
argv_find (argv , argc , "ASN:NN_OR_IP-ADDRESS:NN" , & idx_ext_community );
1506
- argv_find (argv , argc , "A.B.C.D" , & idx_ipv4 );
1507
1558
1508
- ret = str2sockunion (argv [idx_ipv4 ]-> arg , & su );
1509
- if (ret < 0 ) {
1559
+ /* neighbors <A.B.C.D|X:X::X:X|WORD> */
1560
+ argv_find (argv , argc , "neighbors" , & idx );
1561
+ peerstr = argv [++ idx ]-> arg ;
1562
+
1563
+ peer = peer_lookup_in_view (vty , bgp , peerstr , uj );
1564
+ if (!peer ) {
1510
1565
if (uj ) {
1511
1566
json_object * json_no = NULL ;
1512
1567
json_no = json_object_new_object ();
@@ -1517,10 +1572,9 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_neighbor_advertised_routes,
1517
1572
json_object_free (json_no );
1518
1573
} else
1519
1574
vty_out (vty , "Malformed address: %s\n" ,
1520
- argv [idx_ext_community ]-> arg );
1575
+ argv [idx ]-> arg );
1521
1576
return CMD_WARNING ;
1522
1577
}
1523
- peer = peer_lookup (NULL , & su );
1524
1578
if (!peer || !peer -> afc [AFI_L2VPN ][SAFI_EVPN ]) {
1525
1579
if (uj ) {
1526
1580
json_object * json_no = NULL ;
@@ -1599,7 +1653,7 @@ DEFUN(show_ip_bgp_evpn_rd_overlay,
1599
1653
use_json (argc , argv ));
1600
1654
}
1601
1655
1602
- /* For testing purpose, static route of MPLS-VPN . */
1656
+ /* For testing purpose, static route of EVPN RT-5 . */
1603
1657
DEFUN (evpnrt5_network ,
1604
1658
evpnrt5_network_cmd ,
1605
1659
"network <A.B.C.D/M|X:X::X:X/M> rd ASN:NN_OR_IP-ADDRESS:NN ethtag WORD label WORD esi WORD gwip <A.B.C.D|X:X::X:X> routermac WORD [route-map WORD]" ,
@@ -1638,7 +1692,7 @@ DEFUN(evpnrt5_network,
1638
1692
argv [idx_routermac ]-> arg );
1639
1693
}
1640
1694
1641
- /* For testing purpose, static route of MPLS-VPN . */
1695
+ /* For testing purpose, static route of EVPN RT-5 . */
1642
1696
DEFUN (no_evpnrt5_network ,
1643
1697
no_evpnrt5_network_cmd ,
1644
1698
"no network <A.B.C.D/M|X:X::X:X/M> rd ASN:NN_OR_IP-ADDRESS:NN ethtag WORD label WORD esi WORD gwip <A.B.C.D|X:X::X:X>" ,
@@ -5323,12 +5377,12 @@ void bgp_ethernetvpn_init(void)
5323
5377
install_element (VIEW_NODE , & show_ip_bgp_l2vpn_evpn_all_tags_cmd );
5324
5378
install_element (VIEW_NODE , & show_ip_bgp_l2vpn_evpn_rd_tags_cmd );
5325
5379
install_element (VIEW_NODE ,
5326
- & show_ip_bgp_l2vpn_evpn_all_neighbor_routes_cmd );
5380
+ & show_ip_bgp_l2vpn_evpn_neighbor_routes_cmd );
5327
5381
install_element (VIEW_NODE ,
5328
5382
& show_ip_bgp_l2vpn_evpn_rd_neighbor_routes_cmd );
5329
5383
install_element (
5330
5384
VIEW_NODE ,
5331
- & show_ip_bgp_l2vpn_evpn_all_neighbor_advertised_routes_cmd );
5385
+ & show_ip_bgp_l2vpn_evpn_neighbor_advertised_routes_cmd );
5332
5386
install_element (
5333
5387
VIEW_NODE ,
5334
5388
& show_ip_bgp_l2vpn_evpn_rd_neighbor_advertised_routes_cmd );
0 commit comments