136 Commits

Author SHA1 Message Date
wenovus aa0cf39f37 Export Generated BGP Configuration Code
Move internal/pkg/config -> pkg/config/oc

Background: #2593
2023-09-30 09:53:37 +09:00
Yuya Kusakabe d2865042cb pyang_plugins: add MUP SAFI to YANG definition 2023-02-21 13:41:55 +09:00
Donatas Abraitis c556ca4f8d Add SoftwareVersion capability
https://datatracker.ietf.org/doc/html/draft-abraitis-bgp-version-capability

Working example with FRR
```
% ./gobgp neighbor 192.168.10.124
BGP neighbor is 192.168.10.124, remote AS 65001
  BGP version 4, remote router ID 200.200.200.202
  BGP state = ESTABLISHED, up for 00:01:14
  BGP OutQ = 0, Flops = 0
  Hold time is 3, keepalive interval is 1 seconds
  Configured hold time is 90, keepalive interval is 30 seconds

  Neighbor capabilities:
    multiprotocol:
        ipv6-unicast:	advertised
        ipv4-unicast:	advertised and received
    route-refresh:	advertised and received
    extended-nexthop:	advertised
        Local:  nlri: ipv4-unicast, nexthop: ipv6
    UnknownCapability(6):	received
    UnknownCapability(9):	received
    graceful-restart:	advertised and received
        Local: restart time 10 sec
	    ipv6-unicast
	    ipv4-unicast
        Remote: restart time 120 sec, notification flag set
	    ipv4-unicast, forward flag set
    4-octet-as:	advertised and received
    add-path:	received
      Remote:
         ipv4-unicast:	receive
    enhanced-route-refresh:	received
    long-lived-graceful-restart:	advertised and received
        Local:
	    ipv6-unicast, restart time 10 sec
	    ipv4-unicast, restart time 20 sec
        Remote:
	    ipv4-unicast, restart time 0 sec, forward flag set
    fqdn:	advertised and received
      Local:
         name: donatas-pc, domain:
      Remote:
         name: spine1-debian-11, domain:
    software-version:	advertised and received
      Local:
         GoBGP/3.10.0
      Remote:
         FRRouting/8.5-dev-MyOwnFRRVersion-gdc92f44a4
    cisco-route-refresh:	received
  Message statistics:
```

FRR side:

```
root@spine1-debian-11:~# vtysh -c 'show bgp neighbor 192.168.10.17 json' | \
> jq '."192.168.10.17".neighborCapabilities.softwareVersion.receivedSoftwareVersion'
"GoBGP/3.10.0"
root@spine1-debian-11:~#
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-01-31 23:09:24 +09:00
Hitoshi Irino 157a7689e1 Support FRRouting 8.2 and introduce zebra.Software structure. 2022-05-04 07:32:58 +00:00
Arthur de Kerhor 44065abbca Add the possibility to choose the local port in the TCP
connection to a peer.

Signed-off-by: Arthur de Kerhor <arthurdekerhor@gmail.com>
2022-04-07 17:05:04 +02:00
FUJITA Tomonori 24c337268e doc: update pyang_plugins
rm GOPATH.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2021-12-09 12:52:36 +00:00
FUJITA Tomonori 67ffaf519e update v3 suffix
some minor stuff.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2021-12-09 00:12:47 +00:00
Hitoshi Irino b55c32ce65 Support of FRR7.5
This commit works with FRR7.5 when "version = 6" is specified in zebra.config
- Changes Zebra internal API commands to FRR7.5 which is incompatible with older version.
- Changes SendHello() to include AFI
- Changes SendRouteIDAdd() to include AFI
- Changes decodeFromBytes/serialize of IPRouteBody and NexthopUpdateBody, because size of MESSAGE_FALG is changed.
2020-11-29 12:23:28 +09:00
Serguei Bezverkhi 48e55b7c38 code changes
Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
2020-11-25 17:29:13 -05:00
Hitoshi Irino efeb8c51fb zebra: refactoring and fix bug and add processing messageBackupNexthop (added in frr7.4)
- Move function for checking softwareName from internal/pkg/config/default.go to internal/pkg/zebra/zapi.go.
- Delete support for frr7.1.
- Fix bug by inverse processing MessageMTU and messageTag, and add messageTableId in decodeFromBytes and serialize of IPRouteBody.
- Add processing messageBackupNexthop (which is added in frr7.4) in decodeFromBytes and serialize of IPRouteBody.
- Update document.
2020-07-26 22:37:04 +09:00
Hitoshi Irino cf572bc5fc Refactoring Zebra and supporting frr7.3
- Change const values to camel case from snake case to make zero golint's warnigns
- Introduce convert functions (toEach, toCommon) between the newest version to older versions
- Merge code about decode nexthop to reduce lines of code
- Add frr7.3 statemet in allowable software for config
- Rename and Update generated file by stringer
2020-04-26 07:43:50 +09:00
Hitoshi Irino 05a7e0e993 Supporting FRR7.2 2020-01-13 18:55:51 +09:00
FUJITA Tomonori 50df0390fa use tha standard comment for machine-generated files
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2019-07-12 17:37:05 +09:00
Hitoshi Irino 2f5a4d59cb BGP connection on a speecified interface (including which is associated VRF) using syscall SO_BINDTODEVICE 2019-07-02 11:40:22 +09:00
FUJITA Tomonori ccdc2e6277 add secondary-route feature for router server
if an export policy rejects a selected route, try the next route in
order until one that is accepted is found or all routes for the peer
are rejected.

the default is disabled. You can enable this feature in the following
way:

[neighbors.route-server.config]
  route-server-client = true
  secondary-route = true

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2019-04-02 16:01:29 +09:00
JieJhih Jhang 80ff3a325c support BMP sysName and sysDescr configuration 2019-03-25 20:11:44 +09:00
zabio3 6345fdd20a Fixed typos 2019-03-16 19:35:04 +09:00
Hitoshi Irino 3a79ad3fdc Supporting BGP/MPLS L3VPNs with Frrouting Zebra API 6
- This commit aims to solve reported problem on issues #1611, #1648 and #1912
 - Partial changes of this commit duplicate with changes on PR #1587 (not merged) and PR #1766 (not merged and already closed)
 - This commit is tested with only FRRouting version 6.0.2 (which uses Zebra API 6)
 - This commit fixes lack of LABEL_MANAGER_CONNECT_ASYNC for ZAPI6.
   (This bug is introduced on commit 2bdb76f2dc "Supporting Zebra API version 6 which is used in FRRouting version 6")
2019-03-14 21:20:31 +09:00
Artur Makutunowicz 192480fc71 Add experimental BGP-LS feature 2019-01-26 12:40:45 +09:00
FUJITA Tomonori 1d14b8ecfb silence staticcheck warnings
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2019-01-09 14:36:48 +09:00
oc 5ab45752ce api: fix regression that match set option has no default value
The commit 000589f3c "api: Implement UpdatePolicy()" introduced
a regression: if match-set-options is not defined in config file,
gobgpd starts with error: failed to get policy info: not found...

This fix set match-set-options to default when needed.
2018-11-07 15:29:59 +09:00
IWASE Yusuke 70d3ddfd66 pyang_plugins: Fix an import path
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-09-12 21:51:33 +09:00
IWASE Yusuke c33f14282c pyang_plugins: Improve pylint and pycodestyle results
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-09-12 21:51:33 +09:00
FUJITA Tomonori dec0c7d654 tools: update pyang_plugins/README.rst
Python 2 is necessary.

fixes #1801

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2018-09-04 22:07:18 +09:00
Satoshi Fujimoto 4c63ed5d87 config: Change "RedistributeRouteTypeList" to []string
RedistributeRouteTypeList is []InstallProtocolType,
but InstallProtocolType only defines limited number of protocols,

And currently, EnableZebra() in gRPC API validates its request
with the protocols defined by InstallProtocolType,
so the protocols such as "babel" or "lldp" could not be configured
to Zebra, via gRPC API.

This patch fixes RedistributeRouteTypeList to be []string,
and fixes EnableZebra() to validate with the protocols defined
in zapi.go.

Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
2018-06-13 13:10:24 +09:00
IWASE Yusuke 32f7faa8e7 config: Enable to configure VRF via config file
This patch enables to configure VRF tables by using config file. This
feature is useful when using VRF-Neighbor feature.

Example of Usage:

```toml
[[vrfs]]
  [vrfs.config]
    name = "vrf1"
    id = 1
    rd = "65000:100"
    both-rt-list = ["65000:100"]
```

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-05-10 21:12:30 +09:00
IWASE Yusuke 1fd4610372 config: Option to disable best path selection
Note: When this option is specified, no path will be redistributed to
any peer, because there is no best path.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-02-08 15:33:34 +09:00
Satoshi Fujimoto b2ca825f6d table/policy: Support prefix representation in NeighborSet
Currently, "neighbor-set" supports only IP address representation
and IP prefix representation(such as "192.168.0.0/24") is not supported.

This commit enables to accept the prefix representation for "neighbor-set"
to allow neighbors to be specified as range.

Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
2017-12-16 20:27:06 +09:00
IWASE Yusuke 6ed2c5624c config: add-paths structure per AFI-SAFI
This patch introduce "add-paths" structure per AFI-SAFI in order to
enable to store add-paths feature config/state per AFI-SAFI.

Also, this patch renames a few variables to avoid the name collisions.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2017-10-03 14:53:44 +09:00
IWASE Yusuke bb7d2f2541 config: Introduce Family field into AfiSafiState
To reduce the translations of "AfiSafiName" into "bgp.RouteFamily", this
patch introduces "Family" field into "AfiSafiState" and stores the
translated value.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2017-09-14 09:22:04 +09:00
IWASE Yusuke 10d66ebe51 config: Insert descriptions extracted from yang files
This patch fixes pyang_plugins to insert the descriptions which
extracted from yang files and helps to enrich the documentation (e.g.,
godoc).

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2017-07-26 14:37:04 +09:00
IWASE Yusuke f0ae9bd47e pyang_plugins: Refactor
This patch improves the result of pylint and pep8 checks.
For example, this patch fixes;
 - "multiple_modules" attribute of "GolangPlugin" defined in out-side of
   "__init__()".
 - "module" shadows built-in name.
 - missing whitespace around operator.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2017-07-26 14:37:04 +09:00
IWASE Yusuke 2970634bbb pyang_plugins: Replace map() with list comprehension
Mostly, using the list comprehension is more efficiently than map() with
"lambda".
This patch replaces map() + "lambda" by the list comprehension.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2017-07-26 14:37:04 +09:00
IWASE Yusuke 484bb4d0eb pyang_plugins: Use file descriptor passed to plugin
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2017-07-26 14:37:04 +09:00
IWASE Yusuke 415710f94d config: Use BmpServerConfig struct in BmpServerState
Currently, BmpServerState has empty structure and can not store any
configration information.
This patch fixes to use BmpServerConfig structure in BmpServerState to
store the same information.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2017-07-26 14:37:04 +09:00
IWASE Yusuke bc3e06a55f config: TTL value for BGP packets
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2017-06-23 18:13:19 +09:00
IWASE Yusuke 5bb427a994 config: Add parameters for TTL Security
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2017-06-23 18:13:19 +09:00
Satoshi Fujimoto 369626d222 config: Option to enable Dynamic Neighbor
Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
2017-06-16 15:53:07 +09:00
IWASE Yusuke 4bce52c3f3 config: Add counter for BMP statistics
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2017-06-09 11:23:06 +09:00
IWASE Yusuke bbf4b7c2a9 config: Option to enable BMP Route Mirroring
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2017-06-03 18:18:23 +09:00
IWASE Yusuke 449e1acb8d tools: Update usage of pyang_plugins
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2017-06-03 05:51:19 +09:00
IWASE Yusuke 76ba8fcbda server/peer: Number of filtered routes to advertise
This patch extend the "AdjTable" container to store the number of the
"filtered" routes which should not be advertised to the given neighbor.
This routes mean the filterd routes because of RTC, VRFs, policy and
other constraints.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2017-05-22 13:12:02 +09:00
IWASE Yusuke c37b50a024 config: Add interval seconds for BMP stats reports
This patch suppose the default interval of the BMP stats reports is
0 which disable this feature and the range of this interval is 15
though 65535 seconds to follow Junos OS configuration.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2017-05-22 13:12:02 +09:00
IWASE Yusuke fa1378f58b bmp: Obsolete "both" option for route-monitoring-policy
Because of the introduction of "local-rib" and "all" options for
route-monitoring-policy, this patch obsoletes "both" option.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2017-05-22 12:10:07 +09:00
IWASE Yusuke ea56b24395 bmp: Enable to specify all route monitoring policies
This patch adds the new key "all" for specifying the all BMP route
monitoring policies.

Configuration Example:
  [[bmp-servers]]
    [bmp-servers.config]
      address = "127.0.0.1"
      port=11019
      route-monitoring-policy = "all"

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2017-05-22 12:10:07 +09:00
IWASE Yusuke 0f0f13417e config/bgp_configs: Constant for Local RIB in BMP
This patch adds a constant for Local RIB routes defined in
"draft-evens-grow-bmp-local-rib".

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2017-04-17 21:57:11 +09:00
FUJITA Tomonori a2db0a7586 config: update yang file
update the yang file for the commit 59ec403de7.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2017-03-06 20:33:20 -08:00
Wataru Ishida 93d1dca70a config: simplify route-disposition configuration
before:

```yaml
actions:
    route-disposition:
        accept-route: true
        reject-route: false
```

after

```yaml
action:
    router-disposition: accept-route
```

Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
2016-11-17 23:22:55 -05:00
Wataru Ishida 1e22e529c9 config/api: create admin-state type
align with session-state

Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
2016-11-14 02:15:47 +00:00
Wataru Ishida 480eb32783 config: add json tag for config structures
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
2016-11-14 02:15:44 +00:00