Debian Codegraph @

neutron_tempest_plugin/neutron_dynamic_routing/scenario/basic/base.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 os_ken.tests.integrated.common import docker_base as ctn_base
18 from os_ken.tests.integrated.common import quagga
19
20 from neutron_tempest_plugin.neutron_dynamic_routing.scenario import base
21
22
23 class BgpSpeakerBasicTestJSONBase(base.BgpSpeakerScenarioTestJSONBase):
24
25 RAS_MAX = 3
26 public_gw = '192.168.20.1'
27 MyScope = base.Scope(name='my-scope')
28 PNet = base.Net(name='', net='172.24.6.0', mask=24,
29 cidr='172.24.6.0/24', router=None)
30 PPool = base.Pool(name='test-pool-ext', prefixlen=PNet.mask,
31 prefixes=[PNet.net + '/8'])
32 PSubNet = base.SubNet(name='', cidr=PNet.cidr, mask=PNet.mask)
33 TPool = base.Pool(name='tenant-test-pool', prefixlen=28,
34 prefixes=['10.10.0.0/16'])
35 L_AS = base.AS(asn='64512', router_id='192.168.0.2', adv_net='')
36 ras_l = [
37 base.AS(asn='64522', router_id='192.168.0.12',
38 adv_net='192.168.162.0/24'),
39 base.AS(asn='64523', router_id='192.168.0.13',
40 adv_net='192.168.163.0/24'),
41 base.AS(asn='64524', router_id='192.168.0.14',
42 adv_net='192.168.164.0/24')
43 ]
44
45 bgp_speaker_args = {
46 'local_as': L_AS.asn,
47 'ip_version': 4,
48 'name': 'my-bgp-speaker1',
49 'advertise_floating_ip_host_routes': True,
50 'advertise_tenant_networks': True
51 }
52 bgp_peer_args = [
53 {'remote_as': ras_l[0].asn,
54 'name': 'my-bgp-peer1',
55 'peer_ip': None,
56 'auth_type': 'none'},
57 {'remote_as': ras_l[1].asn,
58 'name': 'my-bgp-peer2',
59 'peer_ip': None,
60 'auth_type': 'none'},
61 {'remote_as': ras_l[2].asn,
62 'name': 'my-bgp-peer3',
63 'peer_ip': None,
64 'auth_type': 'none'}
65 ]
66
67 def setUp(self):
68 super(BgpSpeakerBasicTestJSONBase, self).setUp()
69
70 @classmethod
71 def resource_setup_container(cls):
72 cls.brdc = ctn_base.Bridge(name='br-docker-basic',
73 subnet='192.168.20.0/24',
74 start_ip='192.168.20.128',
75 end_ip='192.168.20.254',
76 self_ip=True,
77 fixed_ip=cls.public_gw + '/24',
78 br_type=base.BRIDGE_TYPE)
79 cls.bridges.append(cls.brdc)
80 # This is dummy container object for a dr service.
81 # This keeps data which passes to a quagga container.
82 cls.dr = ctn_base.BGPContainer(name='dummy-dr-basic',
83 asn=int(cls.L_AS.asn),
84 router_id=cls.L_AS.router_id)
85 cls.dr.set_addr_info(bridge='br-docker-basic', ipv4=cls.public_gw)
86 # quagga container
87 cls.dockerimg = ctn_base.DockerImage(baseimage=cls.baseimage)
88 cls.q_img = cls.dockerimg.create_quagga(check_exist=True)
89 cls.images.append(cls.q_img)
90 for i in range(cls.RAS_MAX):
91 qg = quagga.QuaggaBGPContainer(name='q-basic-' + str(i + 1),
92 asn=int(cls.ras_l[i].asn),
93 router_id=cls.ras_l[i].router_id,
94 ctn_image_name=cls.q_img)
95 cls.containers.append(qg)
96 cls.r_ass.append(qg)
97 qg.add_route(cls.ras_l[i].adv_net)
98 qg.run(wait=True)
99 cls.r_as_ip.append(cls.brdc.addif(qg))
100 qg.add_peer(cls.dr, bridge=cls.brdc.name,
101 peer_info={'passive': True})
102
103 cls.tnet_gen = cls.get_subnet(start='10.10.1.0',
104 end='10.10.255.0',
105 step=256)