Commit Graph

270 Commits

Author SHA1 Message Date
Anuradha Karuppiah
74e2bd891d bgpd: support for DF election in EVPN-MH
DF (Designated forwarder) election is used for picking a single
BUM-traffic forwarded per-ES. RFC7432 specifies a mechanism called
service carving for DF election. However that mechanism has many
disadvantages -
1. LBs poorly.
2. Doesn't allow for a controlled failover needed in upgrade
scenarios.
3. Not easy to hw accelerate.

To fix the poor performance of service carving alternate DF mechanisms
have been proposed via the following drafts -
draft-ietf-bess-evpn-df-election-framework
draft-ietf-bess-evpn-pref-df

This commit adds support for the pref-df election mechanism which
is used as the default. Other mechanisms including service-carving
may be added later.

In this mechanism one switch on an ES is elected as DF based on the
preference value; higher preference wins with IP address acting
as the tie-breaker (lower-IP wins if pref value is the same).

Sample output
=============
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es 03:00:00:00:00:01:11:00:00:01
ESI: 03:00:00:00:00:01:11:00:00:01
 Type: LR
 RD: 27.0.0.15:6
 Originator-IP: 27.0.0.15
 Local ES DF preference: 100
 VNI Count: 10
 Remote VNI Count: 10
 Inconsistent VNI VTEP Count: 0
 Inconsistencies: -
 VTEPs:
  27.0.0.16 flags: EA df_alg: preference df_pref: 32767
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route esi 03:00:00:00:00:01:11:00:00:01
*> [4]:[03:00:00:00:00:01:11:00:00:01]:[32]:[27.0.0.15]
                    27.0.0.15                          32768 i
                    ET:8 ES-Import-Rt:00:00:00:00:01:11 DF: (alg: 2, pref: 100)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-10-26 10:26:21 -07:00
Donald Sharp
cd7f9b1711
Merge pull request #7323 from ton31337/fix/inet_ntoa_to_pFX_master
bgpd: Convert inet_ntoa to %pI4
2020-10-20 09:10:24 -04:00
Patrick Ruddy
cecc76cdc5
Merge pull request #7300 from sworleys/EVPN-RType-NUMs
lib,bgpd: more evpn route-type numerical command versions
2020-10-20 11:05:31 +01:00
Donatas Abraitis
23d0a75356 bgpd: Convert inet_ntoa to %pI4/inet_ntop
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-10-18 11:22:30 +03:00
Pat Ruddy
f137734bb4 bgpd: replace bgp_evpn_route2str with prefix2str
Remove bgp_evpn_route2str and replace calls with prefix2str

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-10-16 11:54:30 +01:00
Stephen Worley
15dc08a600 bgpd: numerical evpn type support to debug commands
Add number evpn route type support for debug commands.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-10-13 16:13:16 -04:00
Stephen Worley
2b1364e1b7 bgpd: numerical evpn type support to more show cmds
Add numberical evpn route type support to some more
show commands.

Also, simplify some of the code there to call common type parsing
function. Some of the bounds checking there is also unncessary given
how our cli node matching works.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-10-13 16:13:16 -04:00
Donatas Abraitis
7563bd3fd8
Merge pull request #7252 from sworleys/EVPN-RType-Help
lib,bgpd: EVPN help string cleanup
2020-10-09 09:19:18 +03:00
Stephen Worley
f5dc0b1a42 bgpd: re-use HELP_STR evpn macros
Re-use some of the HELP_STR macros rather than copypastaing
strings everywhere.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-10-08 16:01:56 -04:00
Igor Ryzhov
1673a90dd3 bgpd: hide test commands
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-10-08 11:03:25 +03:00
Rafael Zalamena
28673973b7 bgpd: fix missing doc string in evpn
Add the missing EVPN doc string in the show command.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-08-07 14:32:58 -03:00
Anuradha Karuppiah
b5e140c85c bgpd: CLI changes for EAD routes and ES/ES-EVI display
1. Sample ES display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es
ES Flags: L local, R remote, I inconsistent
VTEP Flags: E ESR/Type-4, A active nexthop
ESI                            Flags RD                    #VNIs    VTEPs
03:00:00:00:00:01:11:00:00:01  LR    27.0.0.15:15          10       27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:02  LR    27.0.0.15:16          10       27.0.0.16(EA)
03:00:00:00:00:01:22:00:00:03  LR    27.0.0.15:17          10       27.0.0.16(EA)
03:00:00:00:00:02:11:00:00:01  R     -                     10       27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:02  R     -                     10       27.0.0.17(A),27.0.0.18(A)
03:00:00:00:00:02:22:00:00:03  R     -                     10       27.0.0.17(A),27.0.0.18(A)
torm-11#

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

2. Sample ES-EVI display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn es-evi
Flags: L local, R remote, I inconsistent
VTEP-Flags: E EAD-per-ES, V EAD-per-EVI
VNI      ESI                            Flags VTEPs
1005     03:00:00:00:00:01:11:00:00:01  LR    27.0.0.16(EV)
1005     03:00:00:00:00:01:22:00:00:02  LR    27.0.0.16(EV)
1005     03:00:00:00:00:01:22:00:00:03  LR    27.0.0.16(EV)
1005     03:00:00:00:00:02:11:00:00:01  R     27.0.0.17(EV),27.0.0.18(EV)
1005     03:00:00:00:00:02:22:00:00:02  R     27.0.0.17(EV),27.0.0.18(EV)
1005     03:00:00:00:00:02:22:00:00:03  R     27.0.0.17(EV),27.0.0.18(EV)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

3. Sample EAD route display
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh bgp l2vpn evpn route type ead
BGP table version is 19, local router ID is 27.0.0.15
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
EVPN type-1 prefix: [4]:[ESI]:[EthTag]:[IPlen]:[VTEP-IP]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]:[IPlen]:[IP]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]

   Network          Next Hop            Metric LocPrf Weight Path
                    Extended Community
Route Distinguisher: 27.0.0.15:5
*> [1]:[0]:[03:00:00:00:00:01:11:00:00:01]:[128]:[0.0.0.0]
                    27.0.0.15                          32768 i
                    ET:8 RT:5550:1009
*> [1]:[0]:[03:00:00:00:00:01:22:00:00:02]:[128]:[0.0.0.0]
                    27.0.0.15                          32768 i
                    ET:8 RT:5550:1009
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-08-05 06:46:12 -07:00
Anuradha Karuppiah
185fb14a41 bgpd: pull the multihoming code out to a separate file
Re-org only; no other code changes. This is being done to make maintanence
of MH functionality (which will have more code added to it) easy.

The code moved here was originally committed via -
'commit 50f74cf131 ("*: support for evpn type-4 route")'

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-08-05 06:46:12 -07:00
Donald Sharp
5f140efeef bgpd: Deref after null check in bgp_evpn_vty.c
Coverity has noticed that we are using bgp_evpn after
we have already NULL checked it one time.  Add an assert
to make Coverity happy here, if we get to this point
something terrible has happened.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-07-27 07:10:41 -04:00
Madhuri Kuruganti
ae2488324e bgpd: wide option
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-07-23 19:18:11 +05:30
David Lamparter
3efd0893d0 *: un-split strings across lines
Remove mid-string line breaks, cf. workflow doc:

  .. [#tool_style_conflicts] For example, lines over 80 characters are allowed
     for text strings to make it possible to search the code for them: please
     see `Linux kernel style (breaking long lines and strings)
     <https://www.kernel.org/doc/html/v4.10/process/coding-style.html#breaking-long-lines-and-strings>`_
     and `Issue #1794 <https://github.com/FRRouting/frr/issues/1794>`_.

Scripted commit, idempotent to running:
```
python3 tools/stringmangle.py --unwrap `git ls-files | egrep '\.[ch]$'`
```

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-07-14 10:37:25 +02:00
Donatas Abraitis
10b49f1450 bgpd: Add command to show only established sessions
```
exit1-debian-9# show bgp summary

IPv4 Unicast Summary:
BGP router identifier 192.168.0.1, local AS number 100 vrf-id 0
BGP table version 8
RIB entries 15, using 2880 bytes of memory
Peers 2, using 43 KiB of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
192.168.0.2     4        200        10         6        0    0    0 00:00:35            8        8
2a02:4780::2    4          0         0         1        0    0    0    never       Active        0

Total number of neighbors 2
exit1-debian-9# show bgp summary established

IPv4 Unicast Summary:
BGP router identifier 192.168.0.1, local AS number 100 vrf-id 0
BGP table version 8
RIB entries 15, using 2880 bytes of memory
Peers 2, using 43 KiB of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
192.168.0.2     4        200        10         6        0    0    0 00:00:39            8        8

Total number of neighbors 2
exit1-debian-9# show bgp summary failed

IPv4 Unicast Summary:
BGP router identifier 192.168.0.1, local AS number 100 vrf-id 0
BGP table version 8
RIB entries 15, using 2880 bytes of memory
Peers 2, using 43 KiB of memory

Neighbor        EstdCnt DropCnt ResetTime Reason
2a02:4780::2          0       0     never Waiting for peer OPEN

Total number of neighbors 2
exit1-debian-9#
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-07-09 16:10:20 +03:00
Donald Sharp
9bcb3eef54 bgp: rename bgp_node to bgp_dest
This is the bulk part extracted from "bgpd: Convert from `struct
bgp_node` to `struct bgp_dest`".  It should not result in any functional
change.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-06-23 17:32:52 +02:00
Chirag Shah
e67df34d25 bgpd: move advertise-vni-all above vni config
Move config 'advertise-vni-all' above all evpn
configuration as vni specific confi commands
have check for advertise-vni-all enabled first.

Ticket: CM-29312
Reviewed By:
Testing Done:

router bgp 5650
...
advertise-all-vni
vni 1002
 route-target import 55500:10002
 route-target export 55500:10002
exit-vni
...

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-06-01 23:18:09 -07:00
Quentin Young
772270f3b6 *: sprintf -> snprintf
Replace sprintf with snprintf where straightforward to do so.

- sprintf's into local scope buffers of known size are replaced with the
  equivalent snprintf call
- snprintf's into local scope buffers of known size that use the buffer
  size expression now use sizeof(buffer)
- sprintf(buf + strlen(buf), ...) replaced with snprintf() into temp
  buffer followed by strlcat

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-20 19:14:33 -04:00
Trey Aspelund
8937a1e613 bgpd: Add int args to show bgp evpn route type
This adds numeric keywords to 'show bgp l2vpn evpn route type'.

Signed-off-by: Trey Aspelund <taspelund@cumulusnetworks.com>
2020-04-14 20:36:12 -04:00
Trey Aspelund
f2562d3ac1 bgpd: Fix typos in show bgp evpn route type
This fixes unnecessary whitespaces and makes capitalization
match for route type help strings.

Signed-off-by: Trey Aspelund <taspelund@cumulusnetworks.com>
2020-04-14 19:06:01 -04:00
Donatas Abraitis
c4efd0f423 *: Do not cast to the same type
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-04-08 17:15:06 +03:00
Donald Sharp
b54892e0ea bgpd: Convert users of rn->p to use accessor function
Add new function `bgp_node_get_prefix()` and modify
the bgp code base to use it.

This is prep work for the struct bgp_dest rework.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-26 16:25:16 -04:00
Donald Sharp
1be1693edf bgpd, lib: More constification of various code
More second order effects of cleaning up rn usage
in bgp.  Sprinkle the fairy const's all over the place.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-23 08:41:17 -04:00
Donatas Abraitis
3dc339cdc2 bgpd: Convert lots of int type functions to bool/void
Some were converted to bool, where true/false status is needed.
Converted to void only those, where the return status was only false or true.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-21 14:59:18 +02:00
Chirag Shah
0b509723a0 bgpd: change evpn vni json field format
Change advertiseSviMacip to advertiseSviMacIp in
json output.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-11 11:38:26 -08:00
Chirag Shah
37ae1adbfa bgpd: readjust fields in evpn vni json cmd
1) Keep consistant field name, such as
"inKernel".
2) Keep fields order same for both outputs.

Testing Done:

TORS1# show bgp l2vpn evpn vni json
{
  "advertiseGatewayMacip":"Disabled",
  "advertiseSviMacip":"Disabled",
  "advertiseAllVnis":"Enabled",
  "flooding":"Head-end replication",
  "numVnis":8,
  "numL2Vnis":5,
  "numL3Vnis":3,
  "1002":{
    "vni":1002,
    "type":"L2",
    "inKernel":"True",
    "rd":"27.0.0.15:8",
    "originatorIp":"27.0.0.15",
    "mcastGroup":"0.0.0.0",
    "advertiseGatewayMacip":"Disabled",
    "advertiseSviMacip":"Disabled",
    "importRTs":[
      "5550:1002"
    ],
    "exportRTs":[
      "5550:1002"
    ]
  },
}

TORS1# show bgp l2vpn evpn vni 1002 json
{
  "vni":1002,
  "type":"L2",
  "inKernel":"True",
  "rd":"27.0.0.15:8",
  "originatorIp":"27.0.0.15",
  "mcastGroup":"0.0.0.0",
  "advertiseGatewayMacip":"Disabled",
  "advertiseSviMacip":"Disabled",
  "importRts":[
    "5550:1002"
  ],
  "exportRts":[
    "5550:1002"
  ]
}

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-11 11:11:28 -08:00
Chirag Shah
7c9cb387ff bgpd: add fields to bgp evpn vni json cmd
Bring 'show bgp l2vpn evpn vni json' inline
with 'show bgp l2vpn evpn vni <id> json' in
terms of fields.

Ticket:CM-28328
Reviewed By:
Testing Done:

TORS1# show bgp l2vpn evpn vni json
{
  "advertiseGatewayMacip":"Disabled",
  "advertiseSviMacip":"Disabled",
  "advertiseAllVnis":"Enabled",
  "flooding":"Head-end replication",
  "numVnis":8,
  "numL2Vnis":5,
  "numL3Vnis":3,
  "1002":{
    "vni":1002,
    "type":"L2",
    "inKernel":"True",
    "originatorIp":"27.0.0.15",
    "rd":"27.0.0.15:8",
    "mcastGroup":"0.0.0.0",
    "advertiseGatewayMacip":"Disabled",
    "advertiseSviMacip":"Disabled",
    "importRTs":[
      "5550:1002"
    ],
    "exportRTs":[
      "5550:1002"
    ]
  },
}

TORS1# show bgp l2vpn evpn vni 1002 json
{
  "vni":1002,
  "type":"L2",
  "kernelFlag":"Yes",
  "rd":"27.0.0.15:8",
  "originatorIp":"27.0.0.15",
  "mcastGroup":"0.0.0.0",
  "advertiseGatewayMacip":"Disabled",
  "advertiseSviMacip":"Disabled",
  "importRts":[
    "5550:1002"
  ],
  "exportRts":[
    "5550:1002"
  ]
}

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-11 11:11:28 -08:00
Donatas Abraitis
975a328e2e *: Replace s_addr 0 => INADDR_ANY
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-06 09:00:12 +02:00
Chirag Shah
24882500ff bgpd: fix memory leak in evpn json outpus II
Two of the evpn show commands with json option has memory leak.
1) show bgp l2vpn evpn route vni all json
2) show bgp l2vpn evpn route esi json

Before fix:
----------
Executed 'show bgp l2vpn evpn route vni all json' multiple times
used ordinary blocks continue to increase.

Note at the time of show command capture there were 22 evpn routes
in vni evpn route table.

Memory statistics for bgpd:
System allocator statistics:
  Total heap allocated:  9152 KiB
  Holding block headers: 0 bytes
  Used small blocks:     0 bytes
  Used ordinary blocks:  7300 KiB
  Free small blocks:     1760 bytes
  Free ordinary blocks:  1852 KiB
  Ordinary blocks:       880
  Small blocks:          51
  Holding blocks:        0

Ticket:CM-27920
Reviewed By:
Testing Done:

After fix:
---------
Executed 'show bgp l2vpn evpn route vni all json' multiple times
Used ordinary blocks remains low.

Memory statistics for bgpd:
System allocator statistics:
  Total heap allocated:  8356 KiB
  Holding block headers: 0 bytes
  Used small blocks:     0 bytes
  Used ordinary blocks:  6492 KiB
  Free small blocks:     1840 bytes
  Free ordinary blocks:  1864 KiB
  Ordinary blocks:       939
  Small blocks:          52
  Holding blocks:        0

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-01-27 11:07:02 -08:00
Chirag Shah
a1df2ac599 bgpd: fix memory leak in evpn json outputs
Found memory leak in json output of evpn's route
commands.

After executing 'show bgp l2vpn evpn route type prefix json'
and 'show bgp l2vpn evpn route type macip json' few times
(6 times) with more than 600 routes in total seeing
memory footprint for bgpd continue to grow.

Memory statistics for bgpd:
System allocator statistics:
  Total heap allocated:  12 MiB
  Holding block headers: 0 bytes
  Used small blocks:     0 bytes
  Used ordinary blocks:  8390 KiB
  Free small blocks:     1760 bytes
  Free ordinary blocks:  3762 KiB
  Ordinary blocks:       1161
  Small blocks:          51
  Holding blocks:        0

Ticket:CM-27920
Testing Done:

After fix:
excute few times,
'show bgp l2vpn evpn route type prefix json'
and 'show bgp l2vpn evpn route type macip json'
commands where used ordinary blocks (uordblks) is
in steady state.

Memory statistics for bgpd:
System allocator statistics:
  Total heap allocated:  9968 KiB
  Holding block headers: 0 bytes
  Used small blocks:     0 bytes
  Used ordinary blocks:  6486 KiB
  Free small blocks:     1984 bytes
  Free ordinary blocks:  3482 KiB
  Ordinary blocks:       1110
  Small blocks:          54
  Holding blocks:        0

Memory statistics for bgpd:
System allocator statistics:
  Total heap allocated:  10100 KiB
  Holding block headers: 0 bytes
  Used small blocks:     0 bytes
  Used ordinary blocks:  6488 KiB
  Free small blocks:     1984 bytes
  Free ordinary blocks:  3612 KiB
  Ordinary blocks:       1113
  Small blocks:          54
  Holding blocks:        0

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-01-24 12:17:17 -08:00
Chirag Shah
0137a3d874 bgpd: fix advertise pip running config
advertise pip running configuration should
display ip followed by mac parameters value as defined
in cli signature.

advertise-pip is enabled by default, when displaying the
running configuration, there is '\n' added after
ip and mac parameters which was not guarded around
the non-default parameters.

Currently, for every bgp vrf instance it ends up
displaying l2vpn address-family section due to
unguarded newline.

running config:
router bgp 6004 vrf vrf1
 !
 address-family l2vpn evpn
 exit-address-family
!

Ticket:CM-26964
Testing Done:

With fix when only 'router bgp 6004 vrf vrf1' configured,
running config looks like:

!
router bgp 6004 vrf vrf1
!

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-01-06 17:00:00 -08:00
Chirag Shah
a6e7677e63 bgpd: adv pip to throw warning under default vrf
Instead of CMD_WARNING, use CMD_WARNING_CONFIG_FAILED
for any mis-configuration scenario.

Testing Done:

TOR(config)# router bgp 5548
TOR(config-router)# address-family l2vpn evpn
TOR(config-router-af)# no advertise-pip
This command is supported under L3VNI BGP EVPN VRF

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-22 07:53:40 -08:00
Chirag Shah
1c97c9fd23 bgpd: evpn pip convert ntoa to ntop
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-22 07:53:36 -08:00
Chirag Shah
23c7421d4d bgpd: evpn pip display pip values
Display pip system mac and ip values
in per vni detail output.

Ticket:CM-26190
Reviewed By:
Testing Done:

Following new values add to the below output
for L3vni:

  System-IP: 27.0.0.11
  System-MAC: 00:02:00:00:00:2e
  Router-MAC: 44:38:39:ff:ff:01

TORC11# show bgp l2vpn evpn vni 4002
VNI: 4002 (known to the kernel)
  Type: L3
  Tenant VRF: vrf2
  RD: 141.2.1.2:2
  Originator IP: 36.0.0.11
  Advertise-gw-macip : n/a
  Advertise-pip: Yes
  System-IP: 27.0.0.11
  System-MAC: 00:02:00:00:00:2e
  Router-MAC: 44:38:39:ff:ff:01
  Import Route Target:
    5546:4002
  Export Route Target:
    5546:4002

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-22 07:53:33 -08:00
Chirag Shah
0ca1058096 bgpd: evpn pip handle svi ip route
By default announct Self Type-2 routes with
system IP as nexthop and system MAC as
nexthop.

An API to check type-2 is self route via
checking ipv4/ipv6 address from connected interfaces list.

An API to extract RMAC and nexthop for type-2
routes based on advertise-svi-ip knob is enabled.

When advertise-pip is enabled/disabled, trigger type-2
route update. For self type-2 routes to use
anycast or individual (rmac, nexthop) addresses.

Ticket:CM-26190
Reviewed By:
Testing Done:

Enable 'advertise-svi-ip' knob in bgp default instance.
the vrf instance svi ip is advertised with nexthop
as default instance router-id and RMAC as system MAC.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-22 07:53:32 -08:00
Chirag Shah
5394a27663 bgpd: evpn pip data struct and cli
Evpn Primary IP advertisement feature uses
individual system IP and system MAC for prefix (type-5)
and self type-2 routes.

The PIP knob is enabled by default for bgp vrf instance.

Configuration CLI for enable/disable PIP feature knob.
User can configure PIP system IP and MAC to retain as
permanent values.

For the PIP IP, the default behavior is to accept bgp default
instance's router-id. When the default instance router-id change,
reflect PIP IP assignment.

Reflect type-5 to use system-IP and system MAC as nexthop and RMAC
values.

Ticket:CM-26190

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-22 07:53:28 -08:00
Chirag Shah
90c31d7190 bgpd: fix json output for show cmd for evpn routes
Fix json output where show command displayed
"Route Distinguisher: " string in json output because
NULL json object passed to bgp_evpn_show_route_rd_header()

Testing Done:
Route Distinguisher: ip 27.0.0.11:3
Route Distinguisher: ip 27.0.0.11:4
Route Distinguisher: ip 27.0.0.16:3
Route Distinguisher: ip 27.0.0.16:5
Route Distinguisher: ip 27.0.0.16:9
{
  "27.0.0.11:3":{
    "rd":"27.0.0.11:3",
    "[2]:[0]:[48]:[00:02:00:00:00:02]":{
      "prefix":"[2]:[0]:[48]:[00:02:00:00:00:02]",
      "prefixLen":288,
 ...
}

Post fix:
{
  "27.0.0.11:3":{
    "rd":"27.0.0.11:3",
    "[2]:[0]:[48]:[00:02:00:00:00:02]":{
      "prefix":"[2]:[0]:[48]:[00:02:00:00:00:02]",
      "prefixLen":288,
  ...
}
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-11 07:57:57 -08:00
Chirag Shah
527fd6dee5 bgpd: fix rd printing in show commands for evpn rts
PR 5118 introduce additional (prepend) keywords
like 'ip' to Route Distinguisher output which
breaks existing evpn route show commands parsing.

Restore to original behavior.

Testing Done:

vtysh -c 'show bgp l2vpn evpn route'

Before fix:
Route Distinguisher: ip 27.0.0.15:44

Post fix:
Route Distinguisher: 27.0.0.15:44

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-11 07:57:37 -08:00
Russ White
b42d15054d
Merge pull request #5118 from lkrishnamoor/routes_json
bgpd: Fix in "show bgp l2vpn evpn neighbors X.X.X.X routes json"
2019-10-16 15:01:13 -04:00
Russ White
218f11515b
Merge pull request #5022 from chiragshah6/mdev
bgpd: evpn fix advertise-svi-ip display in show commands
2019-10-15 11:34:22 -04:00
Lakshman Krishnamoorthy
7f433a5e4d bgpd: Implement "sh bgp l2vpn evpn community|large-community X"
Full output here: https://github.com/FRRouting/frr/pull/5119

Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-10-15 00:43:41 -07:00
Lakshman Krishnamoorthy
c69e79f1d1 bgpd: Bug fix in "show bgp l2vpn evpn neighbors X.X.X.X routes json"
Fixed memory leak and  incorrect json output. Check the full output in the PR:
https://github.com/FRRouting/frr/pull/5118

Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-10-07 14:33:29 -07:00
Chirag Shah
2c4654a183 bgpd: fix global and per vni knobs display
Not just per vni knobs but when the global
knobs are enabled, display
per vni advertise-svi-ip and advertise-gw-macip
as active.

Ticket:CM-26381
Reviewed By:
Testing Done:

TOR1#show running-config bgpd
router bgp 5587
 ...
 address-family l2vpn evpn
  advertise-all-vni
  advertise-svi-ip
...

TORC11# show bgp l2vpn evpn vni 1004 json
{
  "vni":1004,
  "type":"L2",
  "kernelFlag":"Yes",
  "rd":"27.0.0.11:7",
  "originatorIp":"36.0.0.11",
  "mcastGroup":"0.0.0.0",
  "advertiseGatewayMacip":"Disabled",
  "advertiseSviMacip":"Active",
  "importRts":[
    "5546:1004"
  ],
  "exportRts":[
    "5546:1004"
  ]
}

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-09-24 14:25:38 -07:00
Chirag Shah
cbdbb1cafc bgpd: add advertise-svi-ip in json output
Ticket:CM-26404
Reviewed By:
Testing Done:

TORC1# show bgp l2vpn evpn vni 1004 json
{
  "vni":1004,
  "type":"L2",
  "kernelFlag":"Yes",
  "rd":"37.0.1.11:7",
  "originatorIp":"37.0.1.11",
  "mcastGroup":"0.0.0.0",
  "advertiseGatewayMacip":"No",
  "advertiseSviMacip":"No",
  "importRts":[
    "5546:1004"
  ],
  "exportRts":[
    "5546:1004"
  ]
}

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-09-24 14:25:38 -07:00
Kishore Aramalla
0afbd728ed bgpd: Fixed 'show bgp l2vpn evpn json' to display all routes
Fixed the following:
1. Print the complete header for 'show bgp l2vpn evpn' command
2. Print the Route Distinguisher header
3. Print all relevant routes in json (some were being skipped)

Signed-off-by: Kishore Aramalla <karamalla@vmware.com>
2019-09-18 20:47:50 -07:00
Dinesh G Dutt
3577f1c54f bgpd: Add a new command to only show failed peerings
In a data center, having 32-128 peers is not uncommon. In such a situation, to find a
peer that has failed and why is several commands. This hinders both the automatability of
failure detection and the ease/speed with which the reason can be found. To simplify this
process of catching a failure and its cause quicker, this patch does the following:

1. Created a new function, bgp_show_failed_summary to display the
   failed summary output for JSON and vty
2. Created a new function to display the reset code/subcode. This is now used in the
   failed summary code and in the show neighbors code
3. Added a new variable failedPeers in all the JSON outputs, including the vanilla
   "show bgp summary" family. This lists the failed session count.
4. Display peer, dropped count, estd count, uptime and the reason for failure as the
   output of "show bgp summary failed" family of commands
5. Added three resset codes for the case where we're waiting for NHT, waiting for peer
   IPv6 addr, waiting for VRF to init.

This also counts the case where only one peer has advertised an AFI/SAFI.

The new command has the optional keyword "failed" added to the classical summary command.

The changes affect only one existing output, that of "show [ip] bgp neighbors <nbr>". As
we track the lack of NHT resolution for a peer or the lack of knowing a peer IPv6 addr,
the output of that command will show a "waiting for NHT" etc. as the last reset reason.

This patch includes update to the documentation too.

Signed-off-by: Dinesh G Dutt <5016467+ddutt@users.noreply.github.com>
2019-09-02 14:21:44 +00:00
Donald Sharp
dde42c9b95 bgpd: Allow shortened input for show bgp l2vpn evpn route type e|p
The `show bgp l2vpn evpn route type <es|prefix>` commands
only accepted 2 letters.  You could not type `show bgp l2vpn evpn route type e`
or `show bgp l2vpn evpn route type p` although both are technically legal
since nothing overlaps with them.

Ticket: CM-25988
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-23 15:44:32 -04:00
Dinesh Dutt
dcc1615e1b bgpd: Display received and advertised EVPN routes from neighbors
"show bgp l2vpn evpn neighbors <neighbor> [advertised-routes|routes]' did
not work due to various bugs. First, the command only accepted IPv4
addresses as valid neighbor ID, thereby rejecting unnumbered BGP and IPv6
neighbor address. Second, the SAFI was hardcoded to MPLS_VPN even though
we were passing the safi. Third, "all" made no sense in the command context
and to make the command uniform across all address families, I removed the
"all" keyword from the command.

Signed-off-by: Dinesh G Dutt <ddps4u@gmail.com>
2019-08-08 04:17:26 +00:00
Chirag Shah
c684d47726 bgpd: fix show bgp l2vpn evpn route json
PR-4544 has introduced a new filed extended community
in show bgp l2vpn evpn route command.
The header has missed checking json is enabled.

Ticket:CM-25581
Reviewed By:
Testing Done:

TORS1# show bgp l2vpn evpn route json
{
  "27.0.0.15:8":{
    "rd":"27.0.0.15:8",
    "[2]:[0]:[48]:[00:02:00:00:00:0a]":{
      "prefix":"[2]:[0]:[48]:[00:02:00:00:00:0a]",
      "prefixLen":288,
      "paths":[
        [
          {
            "valid":true,
            "bestpath":true,
            "pathFrom":"external",
            "routeType":2,
            "ethTag":0,
            "macLen":48,
            "mac":"00:02:00:00:00:0a",
            "weight":32768,
            "peerId":"(unspec)",
            "aspath":"",
            "path":"",
            "origin":"IGP",
            "extendedCommunity":{
              "string":"ET:8 RT:5550:1002"
            },
            "nexthops":[
              {
                "ip":"27.0.0.15",
                "afi":"ipv4",
                "used":true
              }
            ]
          }
        ]
      ]
    },
   ...
  },
  "numPrefix":187,
  "numPaths":343
}

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-07-09 12:17:45 -07:00
Chirag Shah
6f214dd377 bgpd: print ecom in evpn route output
EVPN route's extended community include
important informations like Mobility sequence,
router mac, and RT values, include the ecomm
in evpn brief output.

Ticket:CM-25353
Testing Done:

Validated in evpn deployment with routes.

TOR#show bgp l2vpn evpn route
...
   Network          Next Hop            Metric LocPrf Weight Path
                    Extended Community

Route Distinguisher: 27.0.0.11:3
*> [2]:[0]:[0]:[48]:[00:02:00:00:00:04]:[128]:[fe80::202:ff:fe00:4]
                    36.0.0.11                              0 4435 5546 i
                    RT:5546:1008 ET:8 ND:Router Flag
*  [2]:[0]:[0]:[48]:[00:02:00:00:00:36]
                    36.0.0.11                              0 4435 5546 i
                    RT:5546:1008 RT:5546:4003 ET:8 MM:0, sticky MAC Rmac:44:38:39:ff:ff:01
*> [2]:[0]:[0]:[48]:[00:02:00:00:00:36]
                    36.0.0.11                              0 4435 5546 i
                    RT:5546:1008 RT:5546:4003 ET:8 MM:0, sticky MAC Rmac:44:38:39:ff:ff:01
*  [3]:[0]:[32]:[36.0.0.11]
                    36.0.0.11                              0 4435 5546 i
                    RT:5546:1008 ET:8
*> [3]:[0]:[32]:[36.0.0.11]
                    36.0.0.11                              0 4435 5546 i
                    RT:5546:1008 ET:8

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-06-21 14:21:38 -07:00
Donald Sharp
76c1403df2 bgpd: Fix crash when rd has no data
There exists a state where we may have a rd node but no individual
evpn prefix nodes in the two level table:

(gdb) bt
    at bgpd/bgp_evpn_vty.c:1190
    filter=FILTER_RELAXED) at lib/command.c:1060
    at lib/command.c:1119
    vtysh=vtysh@entry=0) at lib/command.c:1273
(gdb) f 5
    at bgpd/bgp_evpn_vty.c:1190
1190    bgpd/bgp_evpn_vty.c: No such file or directory.
(gdb) p buf
$1 = "[2]:[0]:[48]:[00:00:00:00:00:00]", '\000' <repeats 240 times>...
(gdb) p json_nroute
$2 = (json_object *) 0x0
(gdb) p rd_header
$3 = 1
(gdb) p buf
$4 = "[2]:[0]:[48]:[00:00:00:00:00:00]", '\000' <repeats 240 times>...
(gdb)

I'm not entirely sure that this is not a `different` problem in that the
rd node should have been removed.  But I think preventing the crash
in a show command is probably the right thing to do here.

Fixes: #4501
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-18 09:11:15 -04:00
Sri Mohana Singamsetty
02f4c3ab5b
Merge pull request #4349 from donaldsharp/bgp_reason
Bgp reason
2019-05-17 09:51:17 -07:00
Russ White
a371084c04
Merge pull request #4313 from lkrishnamoor/overlay_json_cli
bgpd: json cli output for bgp evpn overlay
2019-05-16 10:09:36 -04:00
Donald Sharp
f08b5ca0d9 bgpd: Switch data structure passing to route_vty_out_detail
Instead of just passing in the prefix, pass in the particular
bgp_node we are using.

This is setup for a future commit to use this data.
The long term goal is to collect data about why
a particular bgp_path_info was selected as best and
to display that reason.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-15 21:17:52 -04:00
Lakshman Krishnamoorthy
14f51ebaac bgpd: json cli output for bgp evpn overlay
This diff provides implementation for the cli:
"show bgp l2vpn evpn all overlay json"

Sample output after this change:
leaf-1# sh bgp l2vpn evpn all overlay json
{
  "bgpTableVersion":1,
  "bgpLocalRouterId":"10.100.0.1",
  "defaultLocPrf":100,
  "localAS":65000,
  "10.101.1.4:5":{
    "rd":"10.101.1.4:5",
    "[5]:[0]:[32]:[101.101.101.101]":{
      "prefix":"[5]:[0]:[32]:[101.101.101.101]",
      "prefixLen":288,
      "paths":[
        {
          "valid":true,
          "bestpath":true,
          "pathFrom":"external",
          "nexthop":{
            "ip":"10.100.0.2",
            "afi":"ipv4"
          },
          "overlay":{
            "esi":"00:00:00:00:00:00:00:00:00:00",
            "gw":"0.0.0.0",
            "rmac":"ea:47:79:75:22:1b"
          }
        },
        {
          "valid":true,
          "pathFrom":"external",
          "nexthop":{
            "ip":"10.100.0.2",
            "afi":"ipv4"
          },
          "overlay":{
            "esi":"00:00:00:00:00:00:00:00:00:00",
            "gw":"0.0.0.0",
            "rmac":"ea:47:79:75:22:1b"
          }
        }
      ]
    }
  },

...
...
}

Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-05-11 09:47:10 -07:00
Lakshman Krishnamoorthy
0ac811af60 bgpd: evpn json cli bug fix
Bug: If there are 2 different prefixes under an rd, the
output of "show bgp l2vpn evpn json" would print only one of the
prefixes.

RCA: prefix info was added to the json_object once per rd. Hence,
prefix and rd were added just once, as the loop iterated over all
the prefixes and paths.

This is related to my earlier commit that went in via PR 4283:
https://github.com/FRRouting/frr/pull/4283

Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-05-11 09:33:10 -07:00
Lakshman Krishnamoorthy
597f4b1a9a bgpd: Evpn json cli output missing
Issue1: The following json cli commands are broken (they dont display
anything):
1. show [ip] bgp l2vpn evpn json
2. show [ip] bgp l2vpn evpn all neighbors <IP> routes json
3. show [ip] bgp l2vpn evpn rd <RD> json
4. show [ip] bgp l2vpn evpn rd <RD> neighbors <IP> routes json

RCA1: The existing json_object was partially filled.
Some fields like "prefix", "prefixLen", etc were not
filled in the json_object.
RCA2: Code missing to display the constructed json_object.

Issue2: Column header not shown on bgp evpn commands.
Fix: turned on the flag to display header

Output after fix:
The above commands have been made to follow the existing output style of
"show bgp l2vpn evpn routes json"
leaf-1# sh bgp l2vpn evpn json
{
  "bgpTableVersion":1,
  "bgpLocalRouterId":"10.100.0.1",
  "defaultLocPrf":100,
  "localAS":65000,
  "10.100.0.1:3":{
    "rd":"10.100.0.1:3",
    "[3]:[0]:[32]:[10.100.0.1]":{
      "prefix":"[3]:[0]:[32]:[10.100.0.1]",
      "prefixLen":288,
      "paths":[
        {
          "valid":true,
          "bestpath":true,
          "pathFrom":"external",
          "routeType":3,
          "ethTag":0,
          "ipLen":32,
          "ip":"10.100.0.1",
          "weight":32768,
          "peerId":"(unspec)",
          "aspath":"",
          "path":"",
          "origin":"IGP",
          "nexthops":[
            {
              "ip":"10.100.0.1",
              "afi":"ipv4",
              "used":true
            }
          ]
        }
      ]
    }
  },
..........
..........
  "10.100.0.2:2":{
    "rd":"10.100.0.2:2",
    "[3]:[0]:[32]:[10.100.0.2]":{
      "prefix":"[3]:[0]:[32]:[10.100.0.2]",
      "prefixLen":288,
      "paths":[
        {
          "valid":true,
          "bestpath":true,
          "pathFrom":"external",
          "routeType":3,
          "ethTag":0,
          "ipLen":32,
          "ip":"10.100.0.2",
          "weight":0,
          "peerId":"205.0.113.2",
          "aspath":"65002",
          "path":"65002",
          "origin":"IGP",
          "nexthops":[
            {
              "ip":"10.100.0.2",
              "afi":"ipv4",
              "used":true
            }
          ]
        },
        {
          "valid":true,
          "pathFrom":"external",
          "routeType":3,
          "ethTag":0,
          "ipLen":32,
          "ip":"10.100.0.2",
          "weight":0,
          "peerId":"203.0.113.4",
          "aspath":"65001 65002",
          "path":"65001 65002",
          "origin":"IGP",
          "nexthops":[
            {
              "ip":"10.100.0.2",
              "afi":"ipv4",
              "used":true
            }
          ]
        }
      ]
    }
  },
....
....
  "numPrefix":10,
  "totalPrefix":10
}
leaf-1# sh bgp l2vpn evpn
BGP table version is 1, local router ID is 10.100.0.1
Status codes:s suppressed, d damped, h history, * valid, > best, i - int
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: ip 10.100.0.1:3

*> [3]:[0]:[32]:[10.100.0.1]
                    10.100.0.1                         32768 i
Route Distinguisher: ip 10.100.0.1:4

*> [3]:[0]:[32]:[10.100.0.1]
                    10.100.0.1                         32768 i
Route Distinguisher: ip 10.100.0.1:5

*> [3]:[0]:[32]:[10.100.0.1]
                    10.100.0.1                         32768 i
Route Distinguisher: ip 10.100.0.1:6

*> [3]:[0]:[32]:[10.100.0.1]
                    10.100.0.1                         32768 i
Route Distinguisher: ip 10.100.0.2:2

*> [3]:[0]:[32]:[10.100.0.2]
                    10.100.0.2                             0 65002 i
*  [3]:[0]:[32]:[10.100.0.2]
                    10.100.0.2                             0 65001 65002
Route Distinguisher: ip 10.100.0.2:3

*> [3]:[0]:[32]:[10.100.0.2]
                    10.100.0.2                             0 65002 i
*  [3]:[0]:[32]:[10.100.0.2]
                    10.100.0.2                             0 65001 65002
Route Distinguisher: ip 10.100.0.2:4

*> [3]:[0]:[32]:[10.100.0.2]
                    10.100.0.2                             0 65002 i
*  [3]:[0]:[32]:[10.100.0.2]
                    10.100.0.2                             0 65001 65002

Displayed 10 out of 10 total prefixes

Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-05-08 11:32:38 -07:00
Donald Sharp
2613754b2e bgpd: The vpn variable must be non-null
The vpn variable in bgp_evpn_advertise_svi_ip_vni must
be non-null as such it is impossible to ever need the
!vpn test case.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-03 05:05:19 -04:00
Anuradha Karuppiah
76d07c7aa1 bgpd: maintain flood mcast group per-l2-vni
If PIM-SM if used for BUM flooding the multicast group address can be
configured per-vxlan-device. BGP receives this config from zebra via
the L2 VNI add/update.

Sample output -
root@TORS1:~# vtysh -c "show bgp l2vpn evpn vni 1000" |grep Mcast
  Mcast group: 239.1.1.100
root@TORS1:~#

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-20 08:33:20 -07:00
Sri Mohana Singamsetty
fd5c2ea54c
Merge pull request #4116 from nitinsoniism/show_l2vpn_evpn_route_detail
bgpd: new show cmd - bgp l2vpn evpn route detail
2019-04-18 08:22:50 -10:00
Nitin Soni
21f3551ed5 bgpd: new show cmd - bgp l2vpn evpn route detail
This command is added to provide detailed information. It will be
useful in troubleshooting as we will be able to dump all detailed info
using a single command.
"show bgp l2vpn evpn route [detail] ...". Additional filtering
can be done by providing type of the route.

Command will display the detailed content for all rd and macs-ip as
displayed by "show bgp l2vpn evpn route rd <> mac <>" for a single
rd, mac, ip from the global bgp routing table.

Ticket: CM-24397
Signed-off-by: Nitin Soni <nsoni@cumulusnetworks.com>
Reviewed-by:
Testing-Done:
2019-04-10 23:11:02 -07:00
Nitin Soni
c7ef6cf297 bgpd: new show cmd - bgp l2vpn evpn route vni all detail
This command is added to provide detailed information. It will be
useful in troubleshooting as we will be able to dump all detailed info
using a single command.
"net show bgp evpn route vni <all|id> [detail]". Additional filtering
can be done by providing vtep ip.

Command will display the detailed content for all vni and macs as
displayed by "net show bgp evpn route vni <> mac <> ip <>" for a single
vni, mac, ip.

Ticket: CM-24397
Signed-off-by: Nitin Soni <nsoni@cumulusnetworks.com>
Reviewed-by:
Testing-Done:
2019-04-09 08:35:15 -07:00
Tuetuopay
d074383c62
Merge branch 'master' into evpn-session-vrf 2019-03-28 18:41:38 +01:00
Tuetuopay
f920dd6dc9 bgpd, zebra: Redo checks to advertise_all_vni
This replaces manual checks of the flag with a wrapper macro to convey
the meaning "is evpn enabled on this vrf?"

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-22 13:37:06 +01:00
Chirag Shah
9e97ff0308 bgpd: l3vni add-del handle non-defualt rd
During L3VNI add, non-default RD value is not replayed
correctly. Instead of picking non-default value it picks
up auto RD value which is derived based on router-id.

Indentation issue: Remove additional space from
L3VNI running config output.

Ticket:CM-24320
Reviewed By:CCR-8437
Testing Done:

Bring up evpn configuration with L3vni up with non-default
RD value, perform peerlink flap, l3vni flap which removes
all VNIS and readds with RD and RT values.
The configured RD and RTs are replayed.

Post L3VNI flap
router bgp 5546 vrf vrf2
 !
 address-family l2vpn evpn
  rd 45.0.66.2:6
  route-target import 20001:1
  route-target export 20001:1
 exit-address-family

TORC11# show bgp l2vpn evpn vni 4002
VNI: 4002 (known to the kernel)
  Type: L3
  Tenant VRF: vrf2
  RD: 45.0.66.2:6
  Originator IP: 36.0.0.11
  Advertise-gw-macip : n/a
  Import Route Target:
    20001:1
  Export Route Target:
    20001:1

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-03-19 21:57:00 -07:00
Tuetuopay
5e53dce31e bgpd, zebra: Rename variables of EVPN instance
Rename {bgp,zvrf}_def{ault} to {bgp,zvrf}_evpn where it makes sense,
i.e. when they contain the EVPN instance.

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-19 11:56:25 +01:00
Tuetuopay
530db8dc03 bgpd, zebra: Scope EVPN commands to EVPN VRF
If the EVPN VRF is not the default one (i.e. with advertise-all-vni),
this allows showing its information with `show bgp l2evpn evpn ...`
commands. They do not require adding `vrf VRFNAME` since we only
support a single EVPN VRF. The same is true for zebra-specific commands
(e.g. `show evpn ...`).

Configuration commands are not restricted to the default VRF but to
the EVPN one, that is to the one bearing `advertise-all-vni`.

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-19 11:56:25 +01:00
Tuetuopay
e2f3a930c5 bgpd: Allow non-default instance to be EVPN one
This makes the instance bearing the advertise-all-vni config option
register to zebra as the EVPN one, forwarding it the option.

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-19 11:56:14 +01:00
Anuradha Karuppiah
456a4697e5 bgpd: prevent type-5 route creation if bgp_vrf->l3_vni is 0
After a router reboot the L3 network via it converges before the L2
network. This is because MLAG intentionally holds down bridge-access
and vxlan-network ports for some time (MLAG init-delay) to prevent traffic
from switching to a router that is not fully ready. This also means that
routes (from vrf-peering sessions) that qualify for evpn type-5
advertisments are available long before the L3-VNI is available for that
tenant VRF. In these windows bgpd was adding these evpn-type-5 routes with
a L3-VNI of 0 (which was not fixed up after the L3-VNI became available) -

BGP routing table entry for 100.0.0.1:2:[5]:[0]:[0]:[32]:[200.1.1.1]
Paths: (1 available, best #1)
  Advertised to non peer-group peers:
  MSP1(uplink-1) MSP2(uplink-2)
  Route [5]:[0]:[0]:[32]:[200.1.1.1] VNI 0 >>>>>>>>
  65001 65535
    36.0.0.9 from 0.0.0.0 (27.0.0.9)
      Origin incomplete, metric 0, valid, sourced, local, bestpath-from-AS 65001, best
      Extended Community: ET:8 RT:5544:4001 Rmac:44:38:39:ff:ff:01
      AddPath ID: RX 0, TX 327
      Last update: Wed Feb 27 18:37:10 2019

Fix is to defer creating type-5 routes till the L3-VNI is available for
that tenant VRF (this was already being done for most cases; fixup takes
care of some that missed the check).

Ticket: CM-24022

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-03-05 10:40:26 -08:00
Tim Bray
e3b78da875 *: Rename backet to bucket
Presume typo from original author

Signed-off-by: Tim Bray <tim@kooky.org>
2019-02-25 16:22:36 +00:00
Chirag Shah
24864e4497 bgpd: advertise svi ip as macip config cmd
Ticket:CM-23782

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-02-06 19:57:47 -08:00
rgirada
b4897fa524 bgpd: Added changes to track route-map usage
Made changes and updated the routemap applied counter in the following flows.
1.Increment when route map attached to a list.
2.Decrement when route map removed / modified from a  list.
3.Increment/decrement when route map create/delete callback triggered.
4.Besides ,This counter need not be updated when a route map is got updated.
  i.e changing/adding a match value to the existing routemap.

In BGP , same update api called for all three add/delete/update operation .
But this counter have to be updated only for routemap addition.
Addressed this specific change by identifying the routemap operation based
on routemap pointer.

Signed-off-by: RajeshGirada <rgirada@vmware.com>
2019-02-04 05:27:56 -08:00
Chirag Shah
7da47d6622 bgpd: evpn command to restrict to default vrf
Certain EVPN configuartions should only be applied
under DEFAULT VRF bgpd instance.

reject the cli for non default bgp instance

Ticket:CM-18950

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-12-31 15:53:46 -08:00
Sri Mohana Singamsetty
f944fe9b00
Merge pull request #3448 from chiragshah6/evpn_dev1
bgpd: l3vni add-del handle non-defualt route-target
2018-12-18 18:12:18 -08:00
Lou Berger
9bdb632c68
Merge pull request #3093 from donaldsharp/bgp_node_continued
Bgp node continued
2018-12-11 11:13:25 -05:00
Chirag Shah
530e8a6e7e bgpd: l3vni add-del handle non-defualt rt
During L3VNI add delete, configured non-default
route-target is not replayed correctly.
Non-default route-target should only be deleted
during unconfiguring under bgp vrf instance,
during delete of l3vni only unmap from the VRF.
during addition of l3vni map back to the VRF

Ticket:CM-21482
Testing Done:

Bring up evpn configuration with L3vni up with
non-default route-target.
Perform delete/add of L3vni and validated non-default
route-target is mapped back to vrf.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-12-08 09:02:54 -08:00
Kishore Aramalla
5fd9c12b70 bgpd: The default IP route not advertised with configured RD
When "default-originate ipv4" is configured, a type-5 route is installed in
the local node and advertised to the peer with auto-rd.

When the above was followed by configuring an RD in IP VRF, Type-5 are
generated for only the non-default routes.

Fixed this issue by withdrawing the default route with auto-rd and advertising
 the route with confiured RD.

Signed-off-by: Kishore Aramalla karamalla@vmware.com
2018-11-28 19:18:08 -08:00
Russ White
19e5a46591
Merge pull request #3176 from chiragshah6/evpn_dev
zebra: duplicate address detection and dampening
2018-11-25 22:17:33 -05:00
Kishore Aramalla
1b7db1df43 bgpd: BGP daemon crashed when a L2VNI is unconfigured
When a VNI is unconfigured it deletes all of its import and export
route-targets.  There is a export route-target link list and import
route-target linked list.  There are redudant loops in  the
route-target deletion code.  In the first iteration it deleted the
route-target and freed the RT node, but not list node.
In the 2nd iteration it tries to free the RT node again, resulting in
 the double free of RT node.

Signed-off-by: "Kishore Aramalla karamallavmware.com"
2018-11-20 16:15:56 -08:00
Chirag Shah
979777b2d7 bgp, zebra: address review comments
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-11-17 19:22:17 -08:00
Chirag Shah
0b9d9cd013 bgpd: dup addr detect config cli
Duplicate address detection configuration clis
under bgp l2vpn evpn config mode.
- Enabled/Disable (global knob) for feature.
- Configure cli for duplicate detection action
freeze and freze until time (auto-recovery).

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-11-17 19:22:16 -08:00
Donald Sharp
67009e2200 bgpd: Abstract bgp_table retrieving/setting from info pointer
Convert the set/get of bgp_table's from the info pointer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-16 09:43:35 -05:00
Donald Sharp
6f94b685d0 bgpd: Abstract bgp_info retrieving/setting from info pointer
The bgp_info data is stored as a void pointer in `struct bgp_node`.
Abstract retrieval of this data and setting of this data
into functions so that in the future we can move around
what is stored in bgp_node.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-16 09:43:35 -05:00
Donald Sharp
093e3f23f6 bgpd, lib, vtysh, zebra: Convert to using CMD_VNI_RANGE
For the vni range use a macro to keep track of it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-31 06:23:32 -04:00
David Lamparter
0437e10517 *: spelchek
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-25 20:10:57 +02:00
Donald Sharp
fd06964433 bgpd: Add '[no] flood <disable|head-end-replication>'
Add the '[no] flood <disable|head-end-replication>' command
to the l2vpn evpn afi/safi sub commands for bgp.  This command
when entered as 'flood disable' will turn off type 3 route
generation for the transmittal of the type 3 route necessary
for BUM replication on the remote VTEP.  Additionally it will
turn off the BUM handling via the new zebra command,
ZEBRA_VXLAN_FLOOD_CONTROL.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-11 20:27:28 -04:00
Donald Sharp
40381db785 bgpd: Rename various variable names to something more appropriate
ri -> pi
bi -> bpi
info -> path
info -> rmap_path ( for routemap applications )

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-09 14:26:30 -04:00
Donald Sharp
4b7e606625 bgpd: Convert struct bgp_info to struct bgp_path_info
Do a straight conversion of `struct bgp_info` to `struct bgp_path_info`.
This commit will setup the rename of variables as well.

This is being done because `struct bgp_info` is not descriptive
of what this data actually is.  It is path information for routes
that we keep to build the actual routes nexthops plus some extra
information.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-09 14:14:25 -04:00
David Lamparter
6a154c8812 *: list_delete_and_null() -> list_delete()
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-02 11:40:52 +02:00
Quentin Young
1c50c1c0d6 *: style for EC replacements
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 19:38:57 +00:00
Quentin Young
e50f7cfdbd bgpd: BGP_[WARN|ERR] -> EC_BGP
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 18:51:04 +00:00
Don Slice
9f049418bc bgpd/ospfd: make bgp and ospf json response a bit more consistent
Problem reported that some bgp and ospf json commands did not return
any json output at all if the bgp/ospf instance did not exist.
Additionally, some bgp and ospf json commands did not return any json
output if the instance existed but no neighbors were defined.  This
fix makes these commands more consistent in returning empty braces for
json output and issue a message if not using json output.  Additionally,
made the flag "use_json" a bool to make it consistent since previously,
it had been defined as an int, char, u_char, and bool at various places.

Ticket: CM-21040
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-08-30 12:40:18 +00:00
Chirag Shah
7df407eda8 bgpd: check existing l3vni for any l2vni creation
Scan all bgp vrf instances and respective L3VNI against the VNI which is being configured.

Ticket:CM-21859
Testing Done:
Configure l3vni,
try to configure same vni as l2vni under router bgp, address-family
l2vpn evpn.
The configuration is rejected.

show evpn vni
VNI        Type VxLAN IF              # MACs   # ARPs   # Remote VTEPs Tenant VRF
4001       L3   vx-4001               0        0        n/a vrf1

TOR(config)# router bgp 5546
TOR(config-router)# address-family l2vpn evpn
TOR(config-router-af)# vni 4001
% Failed to create VNI

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-08-22 13:15:25 -07:00
Quentin Young
af4c27286d *: rename zlog_fer -> flog_err
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Don Slice
14454c9fdd bgpd: implement zlog_ferr facility for enhance error messages in bgp
Signed-off-by: Don Slice <dslice@cumulusnetworks.com<
2018-08-14 20:02:05 +00:00
F. Aragon
06fe25f448
bgpd: dead code (Coverity 1472230 1472231 1472238)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-08-03 16:19:11 +02:00
Donald Sharp
b3a4db3dce bgpd: Add some asserts because of our linklist stuff
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-28 22:33:35 -04:00
Donald Sharp
6a527b2fc1 bgpd: Fix some build issues from removing HAVE_CUMULUS
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-28 20:57:36 -04:00