diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/scenario_test/flow_spec_test.py | 9 | ||||
-rw-r--r-- | test/scenario_test/lib/exabgp.py | 5 | ||||
-rw-r--r-- | test/scenario_test/lib/gobgp.py | 5 |
3 files changed, 15 insertions, 4 deletions
diff --git a/test/scenario_test/flow_spec_test.py b/test/scenario_test/flow_spec_test.py index e29f9c91..bba92e1e 100644 --- a/test/scenario_test/flow_spec_test.py +++ b/test/scenario_test/flow_spec_test.py @@ -47,6 +47,12 @@ class GoBGPTestBase(unittest.TestCase): matchs2 = ['tcp-flags syn', 'protocol tcp udp', "packet-length '>1000&<2000'"] thens2 = ['rate-limit 9600', 'redirect 0.10:100', 'mark 20', 'action sample'] g1.add_route(route='flow1', rf='ipv4-flowspec', matchs=matchs2, thens=thens2) + matchs3 = ['destination 2001::/24/10', 'source 2002::/24/15'] + thens3 = ['discard'] + e1.add_route(route='flow2', rf='ipv6-flowspec', matchs=matchs3, thens=thens3) + matchs4 = ['destination 2001::/24 10', "label '=100'"] + thens4 = ['discard'] + g1.add_route(route='flow2', rf='ipv6-flowspec', matchs=matchs4, thens=thens4) initial_wait_time = max(ctn.run() for ctn in ctns) @@ -71,6 +77,9 @@ class GoBGPTestBase(unittest.TestCase): def test_02_check_gobgp_global_rib(self): self.assertTrue(len(self.gobgp.get_global_rib(rf='ipv4-flowspec')) == 2) + def test_03_check_gobgp_global_rib(self): + self.assertTrue(len(self.gobgp.get_global_rib(rf='ipv6-flowspec')) == 2) + if __name__ == '__main__': if os.geteuid() is not 0: diff --git a/test/scenario_test/lib/exabgp.py b/test/scenario_test/lib/exabgp.py index a3be012b..af310530 100644 --- a/test/scenario_test/lib/exabgp.py +++ b/test/scenario_test/lib/exabgp.py @@ -14,7 +14,7 @@ # limitations under the License. from base import * - +from itertools import chain class ExaBGPContainer(BGPContainer): @@ -101,8 +101,7 @@ class ExaBGPContainer(BGPContainer): cmd << '{0};'.format(str(r)) cmd << ' }' - routes = [r for r in self.routes.values() if r['rf'] == 'ipv4-flowspec'] - + routes = [r for r in self.routes.itervalues() if 'flowspec' in r['rf']] if len(routes) > 0: cmd << ' flow {' for route in routes: diff --git a/test/scenario_test/lib/gobgp.py b/test/scenario_test/lib/gobgp.py index f969ca14..2c48c179 100644 --- a/test/scenario_test/lib/gobgp.py +++ b/test/scenario_test/lib/gobgp.py @@ -189,6 +189,9 @@ class GoBGPContainer(BGPContainer): if info['flowspec']: afi_safi_list.append({'AfiSafiName': 'ipv4-flowspec'}) + afi_safi_list.append({'AfiSafiName': 'l3vpn-ipv4-flowspec'}) + afi_safi_list.append({'AfiSafiName': 'ipv6-flowspec'}) + afi_safi_list.append({'AfiSafiName': 'l3vpn-ipv6-flowspec'}) n = {'NeighborConfig': {'NeighborAddress': info['neigh_addr'].split('/')[0], @@ -301,7 +304,7 @@ class GoBGPContainer(BGPContainer): if v['rf'] == 'ipv4' or v['rf'] == 'ipv6': cmd = 'gobgp global '\ 'rib add {0} -a {1}'.format(v['prefix'], v['rf']) - elif v['rf']== 'ipv4-flowspec': + elif v['rf'] == 'ipv4-flowspec' or v['rf'] == 'ipv6-flowspec': cmd = 'gobgp global '\ 'rib add match {0} then {1} -a {2}'.format(' '.join(v['matchs']), ' '.join(v['thens']), v['rf']) else: |