254 Commits
Author SHA1 Message Date
Jeff Bean 154650594c Fixing all megacheck errors. 2018-06-22 19:12:33 -07:00
IWASE Yusuke e2752ae0bb api: Use capability.proto in message PeerConf
The current formats of the remote/local capabilities in message PeerConf
are the binary type representation, this patch fixes to use the
structures defined in capability.proto file.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-06-21 10:40:34 +09:00
IWASE Yusuke 493d024701 api: Define protobuf for BGP Capabilities
Example of protoc command:
$ export PROTOBUF=${HOME}/protobuf/src
$ export GOBGP=${GOPATH}/src/github.com/osrg/gobgp
$ protoc \
    -I ${PROTOBUF} \
    -I ${GOBGP}/api \
    --go_out=plugins=grpc:${GOBGP}/api \
    ${GOBGP}/api/gobgp.proto \
    ${GOBGP}/api/attribute.proto \
    ${GOBGP}/api/capability.proto

Signed-off-by: IWASE Yusuke <[email protected]>
2018-06-21 10:40:25 +09:00
IWASE Yusuke b992c53865 api: Use attribute.proto struct in message Vrf
The current formats of the RD and import/export RTs in message Vrf are
the binary type representation, this patch fixes to use the structures
defined in attribute.proto file.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-06-19 12:01:48 +09:00
Jeff Bean b73933c4b2 simple staticcheck issues 2018-06-14 08:25:20 -07:00
Marcin Ptaszyński 5fbd0cb243 table: support AfiSafiIn Policy Condition match 2018-06-13 20:53:17 -07:00
Satoshi Fujimoto 964bb04e22 api: Implement Shutdonw()
Signed-off-by: Satoshi Fujimoto <[email protected]>
2018-06-13 13:57:23 +09:00
Satoshi Fujimoto 57f103ef34 api: Implement AddCollector()
Signed-off-by: Satoshi Fujimoto <[email protected]>
2018-06-13 13:57:14 +09:00
Satoshi Fujimoto 000589f3cf api: Implement UpdatePolicy()
Signed-off-by: Satoshi Fujimoto <[email protected]>
2018-06-13 13:57:04 +09:00
Satoshi Fujimoto c821cfbc8e api: Implement PeerGroup and DynamicNeighbor API
Signed-off-by: Satoshi Fujimoto <[email protected]>
2018-06-13 13:56:57 +09:00
Satoshi Fujimoto 96034c286b api: Add missing fields to Peer struct conversion functions
Signed-off-by: Satoshi Fujimoto <[email protected]>
2018-06-13 13:56:48 +09:00
Satoshi Fujimoto 222bf4433d api: Add some fields to notify Graceful Restart state
Signed-off-by: Satoshi Fujimoto <[email protected]>
2018-06-13 13:56:48 +09:00
Satoshi Fujimoto abe2efc2bf api: Fix StartServerAPI
Currently, StartServerAPI accepts few parameters
and setting such as BGP confederation and graceful restart
cannot be configured via gRPC API.

This commit fixes this API to accept all the parameters
which is configurable in a configuration file/

Signed-off-by: Satoshi Fujimoto <[email protected]>
2018-06-13 13:56:30 +09:00
Satoshi FujimotoandFUJITA Tomonori 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 <[email protected]>
2018-06-13 13:10:24 +09:00
IWASE Yusuke 417f8ba6f5 api: Use api/attribute.proto structure in gRPC API
Signed-off-by: IWASE Yusuke <[email protected]>
2018-06-13 10:54:00 +09:00
IWASE Yusuke 84987fb873 api: Define protobuf structure for BGP Path Attributes
Example of protoc command:
$ export PROTOBUF=${HOME}/protobuf/src
$ export GOBGP=${GOPATH}/src/github.com/osrg/gobgp
$ protoc \
    -I ${PROTOBUF} \
    -I ${GOBGP}/api \
    --go_out=plugins=grpc:${GOBGP}/api \
    ${GOBGP}/api/gobgp.proto \
    ${GOBGP}/api/attribute.proto

Signed-off-by: IWASE Yusuke <[email protected]>
2018-06-13 08:55:27 +09:00
IWASE YusukeandFUJITA Tomonori b285fb2475 config: Accept CLUSTER_ID as an integer value
Currently, only IPv4 address is acceptable for the CLUSTER_ID setting,
this patch enables to specify the CLUSTER_ID as a 32-bit unsigned
integer.

With this expansion, "Config.RouteReflectorClusterId" stores the raw
configured value for the CLUSTER_ID and "State.RouteReflectorClusterId"
stores the value used for construct the CLUSTER_LIST attribute.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-06-05 20:07:09 +09:00
urbanandFUJITA Tomonori 5d15b3f290 table: support nexthop match policy 2018-06-05 19:57:21 +09:00
Shintaro Kojima 5c506b6db1 Fix: ruby client failed with "Enum value '_' does not start with an uppercase letter as is required for Ruby constants" 2018-06-05 09:50:47 +09:00
IWASE YusukeandFUJITA Tomonori 0423ac05e9 cli: Implement "neighbor update" command
Signed-off-by: IWASE Yusuke <[email protected]>
2018-05-31 16:19:01 +09:00
FUJITA Tomonori ed3f7b711c api: fix rpki regression
the commit 8c453bc936 fixes
NewROAListFromApiStructList() to check an error strictly. However,
this breaks the rpki table command:

$ gobgp rpki table
invalid CIDR address: 1.0.16.0

NewROAListFromApiStructList() has a bug about getting the address
family from an IP address. The address family was not used (other
information are used though) so before the commit, the command worked.

This fixes the bug in NewROAListFromApiStructList().

Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-30 21:44:54 +09:00
Satoshi FujimotoandFUJITA Tomonori 8c453bc936 cmd: Remove uncaught error on ParseCIDR()
Signed-off-by: Satoshi Fujimoto <[email protected]>
2018-05-22 21:33:07 +09:00
FUJITA Tomonori 691d80e5d1 make Path objects in rib read-only
Now you can read Path objects in rib safely. Nobody modifies
them. GetRib() API doesn't need to clone the objects. With full
routes, this avoid allocating temporary huge memory.

Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-10 23:13:21 +09:00
FUJITA Tomonori dd85cab1ec table: remove uuid member in originInfo structure
Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-07 21:18:04 +09:00
FUJITA Tomonori 2dbca9e29a use sorted single master table for route server setup
https://github.com/osrg/gobgp/issues/1249

The IN policy was removed. The modification by the IMPORT policy are
visible to all route server peers.

This saves some dozens bytes memory per a path.

Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-07 21:18:04 +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 <[email protected]>
2018-02-08 15:33:34 +09:00
IWASE YusukeandFUJITA Tomonori 549b703738 *: Use strconv.ParseUint instead of strconv.Atoi()
For the 32-bit platform compatibility.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-01-24 08:18:50 +09:00
IWASE YusukeandFUJITA Tomonori 568c7aab62 api: Support current flag in MonitorPeerState API
This patch adds "current" flag in MonitorPeerState API and enables to
get the current (existing) neighbors when gRPC client connecting to
GoBGP daemon.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-01-12 21:36:57 +09:00
Satoshi FujimotoandFUJITA Tomonori 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 <[email protected]>
2017-12-16 20:27:06 +09:00
FUJITA Tomonori 2c2cd2bec2 table: add attribute hash value to Path structure
This is for batching paths into one bgp message.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-11-23 21:21:34 +09:00
IWASE YusukeandFUJITA Tomonori f32673bbec api: Activate address family using Peer.AfiSafis
Currently, to configure per AFI-SAFI settings when adding neighbor
via gRPC API, it is require to specify the both Peer.Families and
Peer.AfiSafis fields. If Peer.Families is omitted, settings in
Peer.AfiSafis are ignored and the given address families are not
activated.

This patch enables to configure per AFI-SAFI settings and activate
the address family with only Peer.AfiSafis (without Peer.Families).

Note: For the backward compatibility, if only Peer.Families is
specified, this patch creates per AFI-SAFI settings with the default
settings.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-11-16 09:59:45 +09:00
IWASE YusukeandFUJITA Tomonori 6c6cd6efad api: Define constants for address families
To call some gRPC APIs, it is required to specify the address family
value which is combined value of AFI and SAFI values, so users of gRPC
APIs need to calculate this value.

This patch introduces the constants for the address families for the
convenience.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-11-16 09:59:45 +09:00
IWASE Yusuke b54aa7fc46 api/grpc_server: Remove redundant loop for gRPC server
gRPC server should try to start serving only once because it send
stopped signal to the waiter if server could not start.

This patch removes redundant "for" loop to improve code inspection
result.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-11-13 11:20:07 +09:00
IWASE Yusuke e6a7cfd762 api/grpc_server: Avoid name collision "server"
To improve code inspection result, this patch renames "server"
variables in NewServer() to "s" because "server" collides the
imported package name "github.com/osrg/gobgp/server".

Signed-off-by: IWASE Yusuke <[email protected]>
2017-11-13 11:20:07 +09:00
IWASE Yusuke 9f330e6609 api/grpc_server: Use make() for an empty slice declaration
To improve code inspection result, this patch uses make() for an empty
slice declaration instead of using empty literal initializer.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-11-13 11:20:07 +09:00
IWASE Yusuke e984c6902d api/grpc_server: Avoid index error when invalid set-med value
Currently, with a invalid "set-med" value in a policy action, GoBGP will
raise panic of "index out of range" because the unmatched regular
expression is not handled.

This patch fixes to handle errors during parsing the given med value.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-11-13 11:20:07 +09:00
IWASE YusukeandFUJITA Tomonori ab8ba077e5 cli: Support address families when adding neighbor
Currently, "gobgp" command does not support to configure address families
capability when adding a new neighbor.

This patch introduces a new option field to "gobgp neighbor add" command
and enables to configure address families capability.

Example: Specify address family names in comma separated format
$ gobgp neighbor add 10.0.0.3 as 65003 family ipv4-unicast,l2vpn-evpn
$ gobgp neighbor 10.0.0.3
...(snip)...
  Neighbor capabilities:
    multiprotocol:
        ipv4-unicast:   advertised
        l2vpn-evpn:     advertised
    route-refresh:      advertised
    4-octet-as: advertised
...(snip)...

Signed-off-by: IWASE Yusuke <[email protected]>
2017-11-12 13:57:11 +09:00
IWASE YusukeandFUJITA Tomonori d8a897a0dd Fix some typos found by spell checker
Signed-off-by: IWASE Yusuke <[email protected]>
2017-11-01 21:56:21 +09:00
IWASE YusukeandFUJITA Tomonori 36786073c1 api: Enable to set/get add-paths config via gRPC
Signed-off-by: IWASE Yusuke <[email protected]>
2017-10-03 14:53:44 +09:00
IWASE Yusuke 9b278ba79b api: GetPath API alternative to GetRib
With the extremely large RIBs, GetRib gRPC API hits the limits of each
message size, because this API is using simple request/response RPC.

This patch introduces a new API GetPath which using streaming RPC and
can retrieve RIBs even if extremely large.

Note: GetRib can be replaced with GetPath and obsoleted in the future.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-09-25 15:30:16 +09:00
FUJITA Tomonori 9c61711a5c api: increase the max of grpc message size
by default, 4mb, too small, easily hit the limit:

https://github.com/osrg/gobgp/issues/1430

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-09-15 08:00:54 +09:00
IWASE Yusukeandfujita 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 <[email protected]>
2017-09-14 09:22:04 +09:00
Eiichiro WatanabeandFUJITA Tomonori d92d319931 gobgp: support local-rib/all option in command "gobgp bmp add" 2017-08-29 18:38:33 +09:00
FUJITA Tomonori 0719619767 table: allocate bitmap for path id dynamically
allocating 256 bytes per prefix isn't a good idea. Let's allocate 8
bytes by default and expand dynamically if necessary.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-08-02 00:16:33 +09:00
FUJITA Tomonori 4381055dae api: change the license of gobgp.proto from Apache to MIT
To make it easier for other projects to include gobgp.proto file,
let's use more permissive license, MIT.

[skip ci]

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-07-26 14:37:46 +09:00
FUJITA Tomonori d712de0dc6 api: add addpath support to AddPath API and cli
$gobgp global rib add 10.0.0.0/24 identifier 20

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-07-26 08:09:02 +09:00
FUJITA Tomonori 22772c0e62 add LocalPathIdentifier
add-path support needs two identifiers, remote (rx) and local
(tx). The remote identifiers are assigined by remote peers, the local
ones are assigned by gobgpd itself.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-07-26 08:09:02 +09:00
Satoshi Fujimoto c7ff8580f7 cli: get detailed RPKI information
This patch adds the feature in the neighbor subcommand
to get detailed information about RPKI validation.
The command receives a prefix in Adj-RIB-In,
and gives the detailed RPKI information for the route.
The informaton includes the validation status, the reason if it is invalid,
and matched/unmatched VRPs.

Example:
$ gobgp neighbor 172.17.0.3 adj-in 2.1.0.0/16 validation
Target Prefix: 2.1.0.0/16, AS: 65001
  This route is invalid  reason: as
  No VRP ASN matches the route origin ASN.
  Matched VRPs:
    No Entry
  Unmatched AS VRPs:
    Network            AS     MaxLen
    2.0.0.0/12         3215   16
    2.1.0.0/16         3215   16
  Unmatched Length VRPs:
    No Entry

Signed-off-by: Satoshi Fujimoto <[email protected]>
2017-07-19 09:44:20 +09:00
Satoshi Fujimoto 1aa5bf7f21 table: Include detailed information about RPKI in originInfo
Signed-off-by: Satoshi Fujimoto <[email protected]>
2017-07-19 09:44:20 +09:00
Satoshi Fujimoto 810ba2f791 api: Add RPKI detailed information structure
Signed-off-by: Satoshi Fujimoto <[email protected]>
2017-07-19 09:44:20 +09:00