117 Commits
Author SHA1 Message Date
Maxime Peim 9fbc03765a send-max: respect configuration 2024-04-29 17:29:42 +09:00
Pavel Odintsov 9f2b64779a Reworked gobgp test to use collections.abc.Mapping to fix compatibility with Python 3.10 2023-07-15 18:35:19 +01:00
Yuya Kusakabe 1f024afaa0 test: add scenario test for BGP-MUP SAFI and Extended Community 2022-08-31 20:59:52 +09:00
Jakub Chábek 7014234253 Add SIGINT as shutdown signal 2021-11-24 21:46:50 +09:00
FUJITA Tomonori 3d51923e3c make CI faster
Build GoBGP binaries of a pull request locally and copy them to the
container to be tested instead of copying the code into the container
and building the binaries inside.

Signed-off-by: FUJITA Tomonori <[email protected]>
2020-11-09 22:47:14 +09:00
FUJITA Tomonori 19e99002f5 test: rm pipework functions
not used anymore.

Signed-off-by: FUJITA Tomonori <[email protected]>
2019-10-21 13:21:10 +09:00
mageshgv 29412028a7 Fix adj-out display with add path enabled 2019-10-18 07:28:10 +09:00
mageshgv 0235f7c675 Support vrfs in zapi multipath 2019-10-15 20:58:16 +09:00
Franza Cavalcante 8c90684b27 Python3 support to gobgp tests
This PR removes dependencies on old Fabric version, as it's not
supported by Python3.

The current Fabric versions don't support the colors and indent
used previously, so we found substitute methods from other
libraries and defined these in the library files.

The local function from fabric is now just a wrapper to invoke's
run function. All the files were processed through 2to3 command.

All the tests were executed and we don't see any difference on
the outputs when running Python2 or Python3.

The creation of gobgp container is removed from base.py into
fabfile.py, in order to comply with Fabric2 changes and simplify
dependencies.
2019-06-22 19:53:11 +09:00
FUJITA Tomonori 2203e7640b test: switch to module from dep completely
Signed-off-by: FUJITA Tomonori <[email protected]>
2019-04-04 21:33:20 +09:00
FUJITA Tomonori d50f1fe374 test: fix get_reachability()
the output of ping command changed?

Signed-off-by: FUJITA Tomonori <[email protected]>
2018-08-31 21:17:13 +09:00
Nasato Goto 23ac6ebb86 test/lib: Enable static IP address
This patch enable us to give test containers a static IP address
by passing 'ip_addr' argument to addif method.
In addition, 'v6=True' argument is needed when we specify static IPv6 address.

Usage:
  br01 = Bridge(name='br01', subnet='192.168.0.0/24', self_ip=False)
  g1 = GoBGPContainer(name='g1', asn=64512 router_id='10.0.0.1')
  br01.addif(g1, ip_addr='192.168.0.11')
2018-08-28 08:49:11 +09:00
Nasato Goto e792901691 test: Fix bridge methos and relative scenario test
This patch fix the logic of addif methos of Bridge class.
IP address information will be registerd according to the
IP version of bridge.
This change lead the fixing of one of scenario test, "bgp_zebra_test.py".
2018-08-28 08:49:11 +09:00
Nasato Goto 7e07240b29 test/lib: Fix pkill command syntax for BusyBox
Fix syntax of pkill in order to make use of it for BusyBox Linux based container available.
This change is compatible with use of pkill for usual Linux.
2018-08-21 19:29:22 +09:00
Nasato Goto b45e3fa588 test/lib: Change shell for init script
Change shell of start.sh from /bin/bash to /bin/sh in order to
make BusyBox Linux based container available for scenario test.
2018-08-21 19:01:25 +09:00
FUJITA Tomonori 71e56c542e rpc cleanup
- clean up RPC function names
- rewrite gobgp command to use the api instead of config package
- delete unused client package

Signed-off-by: FUJITA Tomonori <[email protected]>
2018-08-08 21:24:48 +09:00
FUJITA Tomonori c4775c4251 follow Standard Go Project Layout
https://github.com/golang-standards/project-layout

Now you can see clearly what are private and public library code.

Signed-off-by: FUJITA Tomonori <[email protected]>
2018-07-07 20:44:25 +09:00
IWASE Yusuke a9584e6eb3 scenario_test: Extend Graceful Restart time
The current Graceful Restart time is 20 sec, but this value is not
enough long and can be exceeded unexpectedly while waiting for
re-establishing peer connections. Then the stale paths on a receiving
router are dropped before the paths successfully synced, and some test
cases on "graceful_restart_test.py" will be passed unexpectedly.

This patch extends the Graceful Restart time to 30 sec and introduces
the constants for Graceful Restart time and Long-Lived Graceful Restart
time.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-05-30 11:33:02 +09:00
IWASE Yusuke ccb4f8cdf0 test/lib/quagga: Minimize advertisement-interval
Quagga seems to advertise routes to neighbors by intervals of 30 seconds
(eBGP) or 5 seconds (iBGP) by default. Because of this delay, timer in
"bgp_confederation_test.py", 60 seconds, can be exceeded when the UPDATE
messages need to go through multi ASs.

This patch fixes to use minimum advertisement-interval and reduces the
time of test cases.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-05-21 16:33:05 +09:00
IWASE Yusuke 2c388e0757 scenario_test: Wait for GoBGP starting up
For the stability of some scenario tests, this patch fixes to wait for
GoBGP starting up after restarting GoBGP daemon. Currently, there are
cases that CLI command can be called without checking whether GoBGP
daemon is surely started or not.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-05-15 09:46:16 +09:00
IWASE Yusuke 3fc524a5f5 test/lib/gobgp: Rename graceful_restart() to stop_gobgp()
GoBGPContainer.graceful_restart() does not "restart" GoBGP daemon, but
just stops (kills) GoBGP daemon. Then this patch renames
graceful_restart() to stop_gobgp() to avoid confusion.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-05-15 09:43:29 +09:00
IWASE Yusuke 8bd028f5ff test/lib/exabgp: Enable to get adj-RIB-{in,out}
"exabgpcli" supports to show adj-RIB-in and adj-RIB-out, this patch
enables ExaBGPContainer to get these RIBs information.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-02-10 21:48:23 +09:00
IWASE Yusuke aae35319a8 test/lib/exabgp: Use exabgpcli to add/del routes
Currently, to advertise or withdraw routes with ExaBGPContainer, we need
to configure static routes via config file and restart ExaBGP daemon.
In other words, we can NOT send withdrawing advertisement with
ExaBGPContainer. Also, restating ExaBGP daemon frequently can make
scenario test unstable, and it should be avoided.

On the other hand, with ExaBGP version 4.0.5 or later(*), we can
advertise or withdraw routes using "exabgpcli" without restating ExaBGP
daemon (or writing application which calls ExaBGP's APIs).

This patch fixes to use "exabgpcli" and reduces the number of restating
ExaBGP daemon.

Note: According to this change, adding routes into ExaBGP should be
called after adding neighbor.

(*): "exabgpcli" is introduced at version 4.0.2, but has some bugs
related to Python 3 compatibility and FlowSpec rules combinations, then
we need to use version 4.0.5 or later.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-02-10 21:47:38 +09:00
IWASE Yusuke af61e847ce scenario_test: Enable to try assertion several times
Some times, on Travis-CI, some test cases fail unexpectedly in checking
paths in RIBs due to advertisements are not yet received from other
routers.
Currently, in order to avoid this unexpected result, "time.sleep" is
inserted after adding new routes, but it is not enough.

This patch introduces a new function to enable to do assertion several
times and avoid failure with the first assertion.

Note: This patch does not introduces this change into all test cases, do
only into some test cases which fail relatively frequently.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-01-27 20:48:42 +09:00
IWASE Yusuke f5b79f8474 test/lib/gobgp: Adding routes without reloading
With the current implementation, when adding routes on GoBGPContainer,
we re-configure and reload daemon, then add routes using CLI command.
Differ from QuaggaBGPContainer, when deletion of routes, reloading is
not required, but if reloading daemon frequently, we need to wait for
the daemon restarting, it causes testing time longer and unstable.

This patch enables to add routes without reloading daemon.

Note: According to this change, adding routes should be called after
starting daemons.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-01-27 20:48:42 +09:00
IWASE Yusuke 5ea3cbdd9d test/lib/Quagga: Use vtysh to add/del routes
Currently, to advertise or withdraw routes on QuaggaBGPContainer, we
need to configure static routes in configure file and restart Quagga
daemons.
In other words, we can NOT send withdrawing advertisement from Quagga
side.
Also, restating Quagga daemons frequently can make scenario test
unstable, and it should be avoided.

This patch fixes to use "vtysh" and reduces the number of restating
Quagga daemons.

Note: According to this change, adding routes on Quagga should be called
after starting daemons.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-01-27 20:48:42 +09:00
IWASE Yusuke be7e6206bc test/lib/{bird,gobgp,quagga,yabgp}: Wait for daemon boot
Currently, scenario test library does not wait for the daemons boot in
containers at starting up or after sending SIGHUP for reloading new
configurations.
So some test cases (e.g., graceful_restart_test.py) fails occasionally
to insert static routes into GoBGP after reloading new configurations.

This patch fixes to wait for the daemons boot and improves the stability
of scenario tests.

Note: This patch does not introduce these improvements to
BagpipeContainer and ExaBGPContainer, because;
- Docker image for BaGPipe, which used in scenario test library, is too
  old and BagpipeContainer does not seem to be used in the current test
  cases.
- The version of ExaBGP in "osrg/exabgp" Docker image has no way to ask
  the daemon status other than "ps" command ("ps" is already done, but
  not enough). If "exabgpcli" is available on ExaBGP container, which is
  required the next release of 4.0.2 or 3.4.21, we can use it to check
  whether ExaBGP is started up or not.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-01-19 13:28:26 +09:00
IWASE Yusuke f3a6c3519a test/lib: Add YABGP container
Note: This implementation supposes the YABGP version 0.4.0.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-01-19 13:25:19 +09:00
IWASE Yusuke 3707b5aedf test/lib/base: Delete FlowSpec routes with keyword
Currently, in case of the FlowSpec routes, "prefix" value which stored
on each container instance is just a keyword and not valid NLRI
arguments for adding or deleting routes.
So when deleting routes with "route" keyword, it is required to
construct the NLRI arguments using "matchs" value.

This patch enables to construct the valid NLIR arguments as "prefix"
value when adding the FlowSpec routes and enables to delete the FlowSpec
routes with "route" keyword.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-01-19 13:25:19 +09:00
IWASE Yusuke 14a6bf184e test/lib/base: Fix typos
Signed-off-by: IWASE Yusuke <[email protected]>
2018-01-09 16:15:11 +09:00
IWASE Yusuke 53df6493e1 test/lib/{gobgp,quagga}: IPv6 forwarding in zebra.conf
With this patch, it is not required to enable IPv6 forwarding by using
"sysctl" explicitly in Quagga or GoBGP(Zebra enabled) containers.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-01-09 16:15:11 +09:00
IWASE Yusuke 4e993174e3 test/lib/base: Removes redundant routes from host
When creating a new Docker network (Linux Bridge), some routes to its
subnet will be installed in to the container host's routing table.
This routes enable containers to communicate each other through the
container host's rouging table, then causes the unexpected success of
scenario tests (e.g., ping between containers).

This patch removes the unexpected routes from the container host and
avoid this problem.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-01-09 15:52:42 +09:00
Imcom Jin 7b4ebf9be4 use label for containers and networks in order to avoid colliding with others 2017-12-16 20:00:38 +09:00
Satoshi Fujimoto 5440f32fcd test/lib: Allow unconfigured peer-as for Unnumbered BGP
For Unnumbered BGP, neighbor AS number isn't needed
to be specified, so 'peer-as' should not be specified
in the scenario test for Unnumbered BGP.
However, currently 'peer-as' is always specified
in test/lib/gobgp.py

This commit solves this by not specifying `peer-as`
if 'neighbor-interface' is configured.

Signed-off-by: Satoshi Fujimoto <[email protected]>
2017-11-27 14:19:58 +09:00
Satoshi Fujimoto 88862a1017 test/lib: Add bgp config structure for GoBGP/Quagga containers
This commit introduces 'bgp_config' attribute for
GoBGP/Quagga containers to configure complex settings.

Adding to this, this commit enables to configure
BGP confederation settings to GoBGP/Quagga conrainers.

Signed-off-by: Satoshi Fujimoto <[email protected]>
2017-11-07 21:53:46 +09:00
Satoshi Fujimoto 002dca7e3b test/lib: Enhancement on Get Rib library on Quagga
For Quagga containers, currently, when we use get_global_rib()
without specifying prefix, we cannot get AS_PATH and other attributes.
And when we use get_global_rib() with prefix,
we can get only one path even if there is multiple paths for a destination.

This commit fixes these problems by refining test/lib/quagga.py.

Signed-off-by: Satoshi Fujimoto <[email protected]>
2017-11-07 21:53:46 +09:00
Satoshi Fujimoto e637c746e9 test: Add Scenario tests for Revised Error Handling
Signed-off-by: Satoshi Fujimoto <[email protected]>
2017-09-29 15:05:43 +09:00
IWASE Yusuke ce258f05d2 test/lib/base: Reduce redundant build steps
Currently, the build steps of "go get" and removing the downloaded
directory are not effective steps.
For example, "go get" for downloading dependencies can be replaced
with "dep ensure".

Signed-off-by: IWASE Yusuke <[email protected]>
2017-09-24 17:57:35 +09:00
IWASE Yusuke ea2067ac1c test/lib/gobgp,quagga: Adopt to Debian 9 based osrg/quagga:v1.0
Signed-off-by: IWASE Yusuke <[email protected]>
2017-09-14 14:58:33 +09:00
IWASE Yusuke 8dd72278af test/lib/gobgp: Add shared volume for Quagga
Currently, daemons of Quagga will fails to output their logs, because
those daemons (quagga user) does not have the permission to access to
the GoBGP config directory (owned by root user).
This patch prepares the volume for quagga user and enables daemons of
Quagga to output logs.
With this patch, those logs will be output into
"TEST_BASE_DIR/TEST_PREFIX/<CONTAINER_NAME>/quagga/" directory.
(default: /tmp/gobgp/<CONTAINER_NAME>/quagga/")

Signed-off-by: IWASE Yusuke <[email protected]>
2017-09-14 14:58:33 +09:00
FUJITA Tomonori 97063ee76d update travis-ci for dep
libraries are installed into vendor directory so we can't build go code outside.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-08-04 06:13:04 +09:00
IWASE Yusuke b43809e46a test/lib/gobgp: Get community/identifier via get_*_rib()
This patch enables GoBGPContainer to get community and identifier for
each route via get_global_rib() and get_local_rib() methods.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-07-30 15:18:35 +09:00
IWASE Yusuke c355eb1368 test/lib/gobgp: Add route with identifier and community
This patch enables GoBGPContainer to add routes with "identifier" and
"community" via add_route() method.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-07-30 15:18:35 +09:00
IWASE Yusuke 5d78e89e5e test/lib/gobgp: Enable GoBGPContainer to del a route
Signed-off-by: IWASE Yusuke <[email protected]>
2017-07-30 15:18:35 +09:00
IWASE Yusuke 22254096fb test/lib/base: Avoid to del all routes without identifier specified
Currently, del_route() with "identifier=None" deletes all routes even if
some installed routes have the valid identifier.
This patch fixes to delete only route which exactly matches against the
given identifier.

Signed-off-by: IWASE Yusuke <[email protected]>
2017-07-30 15:18:35 +09:00
IWASE Yusuke 51a84fe36c test/lib/base/BGPContainer: Enable to delete route
Signed-off-by: IWASE Yusuke <[email protected]>
2017-07-20 14:49:51 +09:00
ISHIDA Wataru f48c4deaa1 test: add addpath_test.py
Signed-off-by: ISHIDA Wataru <[email protected]>
2017-07-05 04:57:27 +09:00
FUJITA Tomonori 7a34c7c0ed test: ignore the failure of caching dependeny with building docker image
`go get -d github.com/osrg/gobgp/...` could fail (e.g., an imported
library has gone). After that, we build a docker image from modified
source code.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-06-07 21:06:57 +09:00
Wataru Ishida 9b9a65d410 *: support replace-peer-as (aka as-override)
we use the term replace-peer-as instead of as-override
since openconfig is using it.

cli

```
$ gobgp n add <neighbor-addr> as <asn> replace-peer-as
```

config

```
neighbor:
  config:
    peer-as: <asn>
    neighbor-address: <neighbor-addr>
  as-path-options:
    config:
      replace-peer-as: true
```

Signed-off-by: Wataru Ishida <[email protected]>
2017-05-10 08:15:00 +00:00
Wataru Ishida 1f053c25c4 *: support remove private as
cli

```
$ gobgp n add <neighbor-addr> as <asn> remove-private-as (all|replace)
```

config

```
neighbor:
  config:
    peer-as: <asn>
    neighbor-address: <neighbor-addr>
    remove-private-as: all
```

Signed-off-by: Wataru Ishida <[email protected]>
2017-05-10 08:05:47 +00:00