Debian Codegraph @

neutron_tempest_plugin/neutron_dynamic_routing/scenario/ipv6/test_ipv6.py

raw symbols SCIP
1 # Copyright (C) 2016 VA Linux Systems Japan K.K.
2 # Copyright (C) 2016 Fumihiko Kakuma <kakuma at valinux co jp>
3 # All Rights Reserved.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License"); you may
6 # not use this file except in compliance with the License. You may obtain
7 # a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 # License for the specific language governing permissions and limitations
15 # under the License.
16
17 from tempest import config
18 from tempest.lib import decorators
19
20 from neutron_tempest_plugin.neutron_dynamic_routing.scenario import base
21 from neutron_tempest_plugin.neutron_dynamic_routing.scenario\
22 import base_test_proto as test_base
23
24 from os_ken.tests.integrated.common import docker_base as ctn_base
25 from os_ken.tests.integrated.common import quagga
26
27 CONF = config.CONF
28
29
30 class BgpSpeakerIpv6Test(test_base.BgpSpeakerProtoTestBase):
31
32 RAS_MAX = 3
33 ip_version = 6
34 public_gw = '2001:db8:a000::1'
35 MyScope = base.Scope(name='my-scope')
36 PNet = base.Net(name='', net='2001:db8::', mask=64,
37 cidr='2001:db8::/64', router=None)
38 PPool = base.Pool(name='test-pool-ext', prefixlen=PNet.mask,
39 prefixes=[PNet.net + '/8'])
40 PSubNet = base.SubNet(name='', cidr=PNet.cidr, mask=PNet.mask)
41 TPool = base.Pool(name='tenant-test-pool', prefixlen=64,
42 prefixes=['2001:db8:8000::/48'])
43 L_AS = base.AS(asn='64512', router_id='192.168.0.2', adv_net='')
44 ras_l = [
45 base.AS(asn='64522', router_id='192.168.0.12',
46 adv_net='2001:db8:9002::/48'),
47 base.AS(asn='64523', router_id='192.168.0.13',
48 adv_net='2001:db8:9003::/48'),
49 base.AS(asn='64524', router_id='192.168.0.14',
50 adv_net='2001:db8:9004::/48')
51 ]
52
53 bgp_speaker_args = {
54 'local_as': L_AS.asn,
55 'ip_version': ip_version,
56 'name': 'my-bgp-speaker1',
57 'advertise_floating_ip_host_routes': True,
58 'advertise_tenant_networks': True
59 }
60 bgp_peer_args = [
61 {'remote_as': ras_l[0].asn,
62 'name': 'my-bgp-peer1',
63 'peer_ip': None,
64 'auth_type': 'none'},
65 {'remote_as': ras_l[1].asn,
66 'name': 'my-bgp-peer2',
67 'peer_ip': None,
68 'auth_type': 'none'},
69 {'remote_as': ras_l[2].asn,
70 'name': 'my-bgp-peer3',
71 'peer_ip': None,
72 'auth_type': 'none'}
73 ]
74
75 def setUp(self):
76 super(BgpSpeakerIpv6Test, self).setUp()
77
78 @classmethod
79 def resource_setup_container(cls):
80 cls.brdc = ctn_base.Bridge(name='br-docker-ipv6',
81 subnet='2001:db8:a000::/64',
82 start_ip='2001:db8:a000::8000',
83 end_ip='2001:db8:a000::fffe',
84 self_ip=True,
85 fixed_ip=cls.public_gw + '/64',
86 br_type=base.BRIDGE_TYPE)
87 cls.bridges.append(cls.brdc)
88 # This is dummy container object for a dr service.
89 # This keeps data which passes to a quagga container.
90 cls.dr = ctn_base.BGPContainer(name='dr', asn=int(cls.L_AS.asn),
91 router_id=cls.L_AS.router_id)
92 cls.dr.set_addr_info(bridge='br-docker-ipv6', ipv6=cls.public_gw)
93 # quagga container
94 cls.dockerimg = ctn_base.DockerImage(baseimage=cls.baseimage)
95 cls.q_img = cls.dockerimg.create_quagga(check_exist=True)
96 cls.images.append(cls.q_img)
97 for i in range(cls.RAS_MAX):
98 qg = quagga.QuaggaBGPContainer(name='q' + str(i + 1),
99 asn=int(cls.ras_l[i].asn),
100 router_id=cls.ras_l[i].router_id,
101 ctn_image_name=cls.q_img)
102 cls.containers.append(qg)
103 cls.r_ass.append(qg)
104 qg.add_route(cls.ras_l[i].adv_net, route_info={'rf': 'ipv6'})
105 qg.run(wait=True)
106 cls.r_as_ip.append(cls.brdc.addif(qg))
107 qg.add_peer(cls.dr, bridge=cls.brdc.name, v6=True,
108 peer_info={'passive': True})
109 cls.tnet_gen = cls.get_subnet(start='2001:db8:8000:1::',
110 end='2001:db8:8000:ffff::',
111 step=65536 * 65536 * 65536 * 65536)
112
113 @decorators.idempotent_id('5194a8e2-95bd-49f0-872d-1e3e875ede32')
114 def test_check_neighbor_established(self):
115 self._test_check_neighbor_established(self.ip_version)
116
117 @decorators.idempotent_id('6a3483fc-8c8a-4387-bda6-c7061410e04b')
118 def test_check_advertised_tenant_network(self):
119 self._test_check_advertised_tenant_network(self.ip_version)
120
121 @decorators.idempotent_id('aca5d678-c249-4de5-921b-6b6ba621e4f7')
122 def test_check_advertised_multiple_tenant_network(self):
123 self._test_check_advertised_multiple_tenant_network(self.ip_version)
124
125 @decorators.idempotent_id('f81012f3-2f7e-4b3c-8c1d-b1778146d712')
126 def test_check_neighbor_established_with_multiple_peers(self):
127 self._test_check_neighbor_established_with_multiple_peers(
128 self.ip_version)
129
130 @decorators.idempotent_id('be710ec1-a338-44c9-8b89-31c3532aae65')
131 def test_check_advertised_tenant_network_with_multiple_peers(self):
132 self._test_check_advertised_tenant_network_with_multiple_peers(
133 self.ip_version)