def test_get_advertised_routes_floating_ips(self):
     self.useFixture(fixtures.LockFixture('gateway_network_binding'))
     bgp_speaker = self.create_bgp_speaker(**self.default_bgp_speaker_args)
     bgp_speaker_id = bgp_speaker['id']
     self.bgp_adm_client.add_bgp_gateway_network(bgp_speaker_id,
                                                 self.ext_net_id)
     tenant_net = self.create_network()
     tenant_subnet = self.create_subnet(tenant_net)
     ext_gw_info = {'network_id': self.ext_net_id}
     router = self.create_router(ext_gw_info)
     self.admin_routers.append(router)
     self.admin_client.add_router_interface_with_subnet_id(
                                                    router['id'],
                                                    tenant_subnet['id'])
     self.admin_routerports.append({'router_id': router['id'],
                                    'subnet_id': tenant_subnet['id']})
     tenant_port = self.create_port(tenant_net)
     floatingip = self.create_floatingip(self.ext_net_id)
     self.admin_floatingips.append(floatingip)
     self.client.update_floatingip(floatingip['id'],
                                   port_id=tenant_port['id'])
     routes = self.bgp_adm_client.get_bgp_advertised_routes(bgp_speaker_id)
     self.assertEqual(1, len(routes['advertised_routes']))
     self.assertEqual(floatingip['floating_ip_address'] + '/32',
                      routes['advertised_routes'][0]['destination'])
 def test_get_advertised_routes_null_address_scope(self):
     self.useFixture(fixtures.LockFixture('gateway_network_binding'))
     bgp_speaker = self.create_bgp_speaker(**self.default_bgp_speaker_args)
     bgp_speaker_id = bgp_speaker['id']
     self.bgp_adm_client.add_bgp_gateway_network(bgp_speaker_id,
                                               self.ext_net_id)
     routes = self.bgp_adm_client.get_bgp_advertised_routes(bgp_speaker_id)
     self.assertEqual(0, len(routes['advertised_routes']))
    def test_add_gateway_network(self):
        self.useFixture(fixtures.LockFixture('gateway_network_binding'))
        bgp_speaker = self.create_bgp_speaker(**self.default_bgp_speaker_args)
        bgp_speaker_id = bgp_speaker['id']

        self.bgp_adm_client.add_bgp_gateway_network(bgp_speaker_id,
                                                    self.ext_net_id)
        bgp_speaker = self.get_bgp_speaker(bgp_speaker_id)
        network_list = bgp_speaker['networks']
        self.assertEqual(1, len(network_list))
        self.assertTrue(self.ext_net_id in network_list)
Exemplo n.º 4
0
    def test_update_agent_description(self):
        agents = self.admin_client.list_agents()['agents']
        dyn_agent = self._select_one_agent_for_update(agents)

        self.useFixture(tempest_fixtures.LockFixture('agent_description'))
        description = 'description for update agent.'
        agent_description = {'description': description}
        body = self.admin_client.update_agent(agent_id=dyn_agent['id'],
                                              agent_info=agent_description)
        self.addCleanup(self._restore_agent, dyn_agent)
        updated_description = body['agent']['description']
        self.assertEqual(updated_description, description)
    def test_update_agent_description(self):
        agents = self.admin_client.list_agents()['agents']
        try:
            dyn_agent = agents[1]
        except IndexError:
            raise self.skipException("This test requires at least two agents.")

        self.useFixture(tempest_fixtures.LockFixture('agent_description'))
        description = 'description for update agent.'
        agent_description = {'description': description}
        body = self.admin_client.update_agent(agent_id=dyn_agent['id'],
                                              agent_info=agent_description)
        self.addCleanup(self._restore_agent, dyn_agent)
        updated_description = body['agent']['description']
        self.assertEqual(updated_description, description)
Exemplo n.º 6
0
 def test_get_advertised_routes_tenant_networks(self):
     self.useFixture(fixtures.LockFixture('gateway_network_binding'))
     addr_scope = self.create_address_scope('my-scope', ip_version=4)
     ext_net = self.create_shared_network(**{'router:external': True})
     tenant_net = self.create_network()
     ext_subnetpool = self.create_subnetpool(
         'test-pool-ext',
         is_admin=True,
         default_prefixlen=24,
         address_scope_id=addr_scope['id'],
         prefixes=['8.0.0.0/8'])
     tenant_subnetpool = self.create_subnetpool(
         'tenant-test-pool',
         default_prefixlen=25,
         address_scope_id=addr_scope['id'],
         prefixes=['10.10.0.0/16'])
     self.create_subnet({'id': ext_net['id']},
                        cidr=netaddr.IPNetwork('8.0.0.0/24'),
                        ip_version=4,
                        client=self.admin_client,
                        subnetpool_id=ext_subnetpool['id'])
     tenant_subnet = self.create_subnet(
         {'id': tenant_net['id']},
         cidr=netaddr.IPNetwork('10.10.0.0/24'),
         ip_version=4,
         subnetpool_id=tenant_subnetpool['id'])
     ext_gw_info = {'network_id': ext_net['id']}
     router = self.admin_client.create_router(
         'my-router', external_gateway_info=ext_gw_info,
         distributed=False)['router']
     self.admin_routers.append(router)
     self.admin_client.add_router_interface_with_subnet_id(
         router['id'], tenant_subnet['id'])
     self.admin_routerports.append({
         'router_id': router['id'],
         'subnet_id': tenant_subnet['id']
     })
     bgp_speaker = self.create_bgp_speaker(**self.default_bgp_speaker_args)
     bgp_speaker_id = bgp_speaker['id']
     self.bgp_adm_client.add_bgp_gateway_network(bgp_speaker_id,
                                                 ext_net['id'])
     routes = self.bgp_adm_client.get_bgp_advertised_routes(bgp_speaker_id)
     self.assertEqual(1, len(routes['advertised_routes']))
     self.assertEqual(tenant_subnet['cidr'],
                      routes['advertised_routes'][0]['destination'])
     fixed_ip = router['external_gateway_info']['external_fixed_ips'][0]
     self.assertEqual(fixed_ip['ip_address'],
                      routes['advertised_routes'][0]['next_hop'])