Commit Graph

340 Commits

Author SHA1 Message Date
FUJITA Tomonori 2203e7640b test: switch to module from dep completely
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
2019-04-04 21:33:20 +09:00
FUJITA Tomonori 301b48532d support received, accepted, and advertised counters per family
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2018-11-26 17:49:48 +09:00
Carl Baldwin 8bccb4278a Use assertEqual in python tests
In trying to run the local tests, I found that changing these
assertTrue calls to assertEqual helped me out. With this, a failure
shows the actual and expected values rather than just saying "True is
not False" which is less helpful.
2018-10-29 20:10:19 +00:00
FUJITA Tomonori d50f1fe374 test: fix get_reachability()
the output of ping command changed?

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
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
FUJITA Tomonori 008c961ecd policy cleanup
- remove ReplaceDefinedSet and ReplaceStatement APIs; not intutive and
  should create a new one instead of modifying the existing.

- Rename ReplacePolicyAssignment to SetPolicyAssignment API; we use
  internally SetPolicy() name from the beginning.

- Rename UpdatePolicy() to SetPolicies() API; It doesn't update
  anything so the name is confusing. It discards the all policies and
  create policies from the argument.

- Changes some member names in structures for policy.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2018-08-23 10:05:19 +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 <fujita.tomonori@lab.ntt.co.jp>
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 <fujita.tomonori@lab.ntt.co.jp>
2018-07-07 20:44:25 +09:00
Jeff Bean 72bbb96783 potential - Found a bug in the python tests 2018-06-23 18:38:23 -07:00
Marcin Ptaszyński 5fbd0cb243 table: support AfiSafiIn Policy Condition match 2018-06-13 20:53:17 -07:00
IWASE Yusuke e84ed701c0 graceful_restart_test: Confirm stale paths removed
This patch adds checks to confirm the stale paths are also removed from
the adj-RIB-in table.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-05-30 12:58:07 +09:00
IWASE Yusuke 57e87d41a8 graceful_restart_test: Assert timer not expired
This patch fixes to assert the Graceful Restart time is not expired
while waiting for re-establishing peer connection.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-05-30 12:57:30 +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 <iwase.yusuke0@gmail.com>
2018-05-30 11:33:02 +09:00
IWASE Yusuke b31ab93fb4 bgp_zebra_nht_test: Test case to sync nexthop states
This patch adds a test case to test if the path, which came after the
NEXTHOP_UPDATE message was received from Zebra, is updated by reflecting
the nexthop cache.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-05-29 11:15:20 +09:00
FUJITA Tomonori df6c998bc1 table: update accepted number in adj-in rib after softreset-in
update accepted number in adj-in rib after AllowOwnAs has changed.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2018-05-28 23:20:59 +09:00
FUJITA Tomonori aef984c85c test/aspath: check accepted and received numbers
make sure that an adj-rib return the accepted and received numbers
when it has an as-looped path.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2018-05-28 22:25:52 +09:00
IWASE Yusuke 503d043c62 rtc_test: Test cases for infinite RTC UPDATE loop
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-05-28 15:47:17 +09:00
IWASE Yusuke ee80298806 rtc_test: Test cases for inter-AS
This patch adds test cases for the Route Target Constraint of the
inter-AS route distribution and combination of the inter-AS and intra-AS
route distribution.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-05-28 10:50:13 +09:00
IWASE Yusuke d9ed5fcc11 rtc_test: Enhance test cases for intra-AS RTC
This patch adds assertion points for the counts of advertised and
received routes. Also adds comments for the states of VRFs and routes.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-05-28 09:30:05 +09:00
IWASE Yusuke eb568b68d2 server: Withdraw routes when received RTM withdrawal
Because the RTM is removed from adj-RIB-in before collecting the
candidate routes to be withdrawn, the candidates are unexpectedly
filtered before sending withdraw messages. Then on the peers, the VPN
routes are left on.

This patch fixes to selects candidates from the filtered paths and send
withdraw messages as expected. Also resolves the TODO in
"test/scenario_test/rtc_test.py".

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-05-24 08:41:35 +09:00
Satoshi Fujimoto a7ecbaac46 test/rtc: Add test for conflict RTC config
Add test for the issue reported on #1682
(https://github.com/osrg/gobgp/issues/1682).

Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
2018-05-24 08:32:03 +09:00
IWASE Yusuke 87245b488b bgp_zebra_nht_test: Test cases when nexthop unreachable
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-05-23 13:00:33 +09:00
IWASE Yusuke 34f74cd314 bgp_zebra_nht_test: Improve pylint result
Also removes a debug print.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-05-23 13:00:33 +09:00
IWASE Yusuke 2c5f27f7cf bgp_zebra_nht_test: Use utility functions of test/lib
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-05-23 13:00:33 +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 <iwase.yusuke0@gmail.com>
2018-05-21 16:33:05 +09:00
IWASE Yusuke 107095db19 bgp_confederation_test: Improve pylint result
Also removes a debug print

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-05-21 16:33:05 +09:00
IWASE Yusuke 8efeb17ba5 bgp_router_test: Retry assertions of RIB for stability
To improve the stability of "bgp_router_test.py", this patch fixes to
retry assertions of RIB on a Quagga router after shutting down a
neighbor.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-05-21 16:31:54 +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 <iwase.yusuke0@gmail.com>
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 <iwase.yusuke0@gmail.com>
2018-05-15 09:43:29 +09:00
IWASE Yusuke efd215d814 graceful_restart_test: Remove redundant parentheses
Improves pylint result.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-05-15 09:39:55 +09:00
FUJITA Tomonori 5fc0ac2731 test: avoid fabric version 2.0
Seems that fabric v2 doesn't work with the current files. Let's keep
using v1.X for now.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2018-05-10 22:22:01 +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 <fujita.tomonori@lab.ntt.co.jp>
2018-05-07 21:18:04 +09:00
IWASE Yusuke 34728dece3 rtc_test: Add a TODO comment
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-04-18 09:17:44 +09:00
IWASE Yusuke 4da87c2877 rtc_test: Add description for topologies
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-04-13 15:05:14 +09:00
IWASE Yusuke 329707d523 test_rtc: Use assertEqual for better log message
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-04-13 15:05:14 +09:00
IWASE Yusuke 008f34053c *.md: Improvements for markdownlint
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-04-02 16:16:01 +09:00
FUJITA Tomonori 1b88fa78d9 table: fix handleMacMobility()
needs to find a diffrent ESI with the same mac address.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2018-02-21 17:51:21 +09:00
IWASE Yusuke f2e2c6e415 flow_spec_test: Enhance test cases with ExaBGP
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-02-10 21:48:23 +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 <iwase.yusuke0@gmail.com>
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 <iwase.yusuke0@gmail.com>
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 <iwase.yusuke0@gmail.com>
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 <iwase.yusuke0@gmail.com>
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 <iwase.yusuke0@gmail.com>
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 <iwase.yusuke0@gmail.com>
2018-01-19 13:28:26 +09:00
IWASE Yusuke 4c51cdedf7 flow_spec_test: Enhance test cases with YABGP
This patch extends test cases using YABGP;
 - Test "gobgp" command outputs representations with IPv4/IPv6
 - IPv4 FlowSpec rules advertisements and withdraws

TODO: Supports test cases for the IPv6 FlowSpec rules withdraws when
YABGP supports the IPv6 FlowSpec or when ExaBGP fixes issues(*) of
logging the received FlowSpec rules.

(*): ExaBGP (v4.0.2 or v3.4.21) will failed to log the received FlowSpec
rules which contains some specific operators/operands (e.g., "!=" or
empty operator). Then, we need to wait for the next release to implement
more test cases.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
2018-01-19 13:25:19 +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 <iwase.yusuke0@gmail.com>
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 <iwase.yusuke0@gmail.com>
2018-01-19 13:25:19 +09:00