def resource_setup_container(cls): cls.brdc = ctn_base.Bridge(name='br-docker', subnet='192.168.10.0/24', start_ip='192.168.10.128', end_ip='192.168.10.254', self_ip=True, fixed_ip=cls.public_gw + '/24', br_type=base.BRIDGE_TYPE) cls.bridges.append(cls.brdc) # This is dummy container object for a dr service. # This keeps data which passes to a quagga container. cls.dr = ctn_base.BGPContainer(name='dr', asn=int(cls.L_AS.asn), router_id=cls.L_AS.router_id) cls.dr.set_addr_info(bridge='br-docker', ipv4=cls.public_gw) # quagga container cls.dockerimg = ctn_base.DockerImage() cls.q_img = cls.dockerimg.create_quagga(check_exist=True) cls.images.append(cls.q_img) for i in range(cls.RAS_MAX): qg = quagga.QuaggaBGPContainer(name='q' + str(i + 1), asn=int(cls.ras_l[i].asn), router_id=cls.ras_l[i].router_id, ctn_image_name=cls.q_img) cls.containers.append(qg) cls.r_ass.append(qg) qg.add_route(cls.ras_l[i].adv_net) qg.run(wait=True) cls.r_as_ip.append(cls.brdc.addif(qg)) qg.add_peer(cls.dr, bridge=cls.brdc.name, peer_info={'passive': True}) cls.tnet_gen = cls.get_subnet(start='10.10.1.0', end='10.10.255.0', step=256)
def setUpClass(cls): cls.images = [] cls.containers = [] cls.bridges = [] cls.brdc1 = ctn_base.Bridge(name='brip6dc1', subnet='2001:10::/32') cls.bridges.append(cls.brdc1) cls.dockerimg = ctn_base.DockerImage() cls.r_img = cls.dockerimg.create_ryu(image='osrg/ryu', check_exist=True) cls.images.append(cls.r_img) cls.q_img = 'osrg/quagga' cls.images.append(cls.q_img) cls.r1 = ryubgp.RyuBGPContainer(name='r1', asn=64512, router_id='192.168.0.1', ctn_image_name=cls.r_img) cls.containers.append(cls.r1) cls.r1.add_route('fc00:10::/64', route_info={'rf': 'ipv6'}) cls.r1.run(wait=True) cls.r1_ip_cidr = cls.brdc1.addif(cls.r1) cls.r1_ip = cls.r1_ip_cidr.split('/')[0] cls.q1 = quagga.QuaggaBGPContainer(name='q1', asn=64522, router_id='192.168.0.2', ctn_image_name=cls.q_img) cls.containers.append(cls.q1) cls.q1.add_route('fc00:100::/64', route_info={'rf': 'ipv6'}) cls.q1.run(wait=True) cls.q1_ip_cidr = cls.brdc1.addif(cls.q1) cls.q1_ip = cls.q1_ip_cidr.split('/')[0] cls.r1.add_peer(cls.q1, bridge=cls.brdc1.name, v6=True) cls.q1.add_peer(cls.r1, bridge=cls.brdc1.name, v6=True) super(BgpSpeakerTestBase, cls).setUpClass()
def setUpClass(cls): cls.brdc1 = ctn_base.Bridge(name='brdc1', subnet='192.168.10.0/24') cls.bridges.append(cls.brdc1) cls.dockerimg = ctn_base.DockerImage() image = 'python:%d.%d' % (sys.version_info.major, sys.version_info.minor) cls.r_img = cls.dockerimg.create_ryu(image=image, check_exist=True) cls.images.append(cls.r_img) cls.q_img = 'osrg/quagga' cls.images.append(cls.q_img) cls.r1 = ryubgp.RyuBGPContainer(name='r1', asn=64512, router_id='192.168.0.1', ctn_image_name=cls.r_img) cls.containers.append(cls.r1) cls.r1.add_route('10.10.0.0/28') cls.r1.run(wait=True) cls.r1_ip_cidr = cls.brdc1.addif(cls.r1) cls.r1_ip = cls.r1_ip_cidr.split('/')[0] cls.q1 = quagga.QuaggaBGPContainer(name='q1', asn=64522, router_id='192.168.0.2', ctn_image_name=cls.q_img) cls.containers.append(cls.q1) cls.q1.add_route('192.168.160.0/24') cls.q1.run(wait=True) cls.q1_ip_cidr = cls.brdc1.addif(cls.q1) cls.q1_ip = cls.q1_ip_cidr.split('/')[0] cls.r1.add_peer(cls.q1, bridge=cls.brdc1.name) cls.q1.add_peer(cls.r1, bridge=cls.brdc1.name) super(BgpSpeakerTestBase, cls).setUpClass()