Esempio n. 1
0
    def test_keepalived_failover(self):
        ha_router_id = self.ha_stack.network_stack.gateway_id
        self.agents = [self.wait_for_active_ha_l3_agent()]
        keepalived_pids = self.get_cmd_pids('keepalived',
                                            ha_router_id,
                                            min_pids_per_host=2)
        ping.ping_until_received(self.ha_stack.ip_address).assert_replied()
        active_agent_host = self.agents[0]['host']

        # Need to make sure that 'keepalived-state-change' process is UP
        # before we will kill 'keepalived' process as it can break the agent
        # status otherwise. So will check that keepalived pids are equal for
        # two attemts of listing them
        ka_state_cmd = f'neutron-keepalived-state-change.*{ha_router_id}'
        ka_state_pids = {}
        for _ in tobiko.retry(timeout=120., interval=5.):
            new_ka_state_pids = self.get_cmd_pids('/usr/bin/python',
                                                  ka_state_cmd,
                                                  min_pids_per_host=1)
            if ka_state_pids == new_ka_state_pids:
                break
            else:
                ka_state_pids = new_ka_state_pids

        self.kill_pids(active_agent_host, keepalived_pids[active_agent_host])
        ping.ping_until_received(self.ha_stack.ip_address).assert_replied()

        # Need to make sure that 'keepalived' is spawned back after it has
        # been killed
        self.assertNotEqual(keepalived_pids,
                            self.get_cmd_pids('keepalived',
                                              ha_router_id,
                                              min_pids_per_host=2))
Esempio n. 2
0
    def test_dhcp_lease_served_when_dhcp_agent_down(self):
        '''Test that DHCP lease is correctly served when DHCP agent is down

        Make sure that the VM will receive IP address after the reboot.
        DHCP agent should be down during the VM reboot. VM should receive
        the same IP address that was assigned to it before the reboot.
        '''
        ping.ping_until_received(self.stack.ip_address).assert_replied()

        self.agents = neutron.list_dhcp_agent_hosting_network(
            self.stack.network)
        self.assertNotEqual(
            [], self.agents, "No DHCP agent found serving network "
            f"'{self.stack.network}'")
        pids = self.get_cmd_pids("dnsmasq", self.stack.network)
        self.stop_agent()

        nova.shutoff_server(self.stack.server_id)
        nova.activate_server(self.stack.server_id)
        ping.ping_until_received(self.stack.ip_address).assert_replied()

        self.start_agent()
        self.wait_processes_destroyed(self.stack.network, pids)
        new_pids = self.get_cmd_pids("dnsmasq", self.stack.network)
        self.assertNotEqual(pids, new_pids)
Esempio n. 3
0
    def test_restart_ovn_controller(self):
        '''Test that OVN controller agents can be restarted successfully
        '''
        self.stop_agent()
        ping.ping_until_received(self.stack.ip_address).assert_replied()

        self.start_agent()
        ping.ping_until_received(self.stack.ip_address).assert_replied()
Esempio n. 4
0
    def test_vm_reachability_during_stop_ovs_agent(self):
        # Check if vm is reachable before stopping service
        self.start_agent()
        ping.ping_until_received(self.stack.ip_address).assert_replied()

        # Check if vm is reachable after stopping service
        self.stop_agent(hosts=[self.stack.hypervisor_host])
        ping.ping_until_received(self.stack.ip_address).assert_replied()
Esempio n. 5
0
    def migrate_server(self, server, **params):
        self.assertEqual('ACTIVE', server.status)
        nova.migrate_server(server, **params)

        server = nova.wait_for_server_status(server, 'VERIFY_RESIZE')
        self.assertEqual('VERIFY_RESIZE', server.status)
        nova.confirm_resize(server)

        server = nova.wait_for_server_status(
            server, 'ACTIVE', transient_status={'VERIFY_RESIZE'})
        self.assertEqual('ACTIVE', server.status)

        ping.ping_until_received(self.stack.ip_address).assert_replied()
        return server
Esempio n. 6
0
    def test_recreate_physical_bridge(self):
        # Check if vm is reachable before test
        ip_add = self.stack.ip_address
        ping.ping_until_received(ip_add).assert_replied()

        network_l3_agents = neutron.list_l3_agent_hosting_routers(
            self.router_id)
        for agent in network_l3_agents:
            # Get neutron-ovs-agent bridge mappings
            ovs_agent = self._get_agent_from_host(agent['host'])
            self._delete_bridges(
                agent['host'],
                ovs_agent['configurations']['bridge_mappings'].values())

        ping.ping_until_unreceived(ip_add).assert_not_replied()
        self._create_bridges()
        ping.ping_until_received(ip_add).assert_replied()
Esempio n. 7
0
 def test_ping_until_received(self):
     result = ping.ping_until_received('127.0.0.1',
                                       count=3,
                                       **self.execute_params)
     self.assertIsNone(result.source)
     self.assertEqual(netaddr.IPAddress('127.0.0.1'), result.destination)
     result.assert_transmitted()
     result.assert_replied()
Esempio n. 8
0
 def test_vm_reachability_when_metadata_agent_is_down(self):
     self.stop_agent()
     self.wait_for_metadata_status(is_reachable=False)
     ping.ping_until_received(self.stack.ip_address).assert_replied()
     self.start_agent()
     self.wait_for_metadata_status(is_reachable=True)
Esempio n. 9
0
 def setUp(self):
     super(OvnControllerTest, self).setUp()
     self.get_ovn_agents_from_containers()
     # Ensure that stack is really created to avoid VM error due to dead
     # agents
     ping.ping_until_received(self.stack.ip_address).assert_replied()
Esempio n. 10
0
 def test_ping(self):
     """Test connectivity to floating IP address"""
     ping.ping_until_received(
         self.stack.floating_ip_address).assert_replied()
Esempio n. 11
0
def check_ping_vm_fip(fip):
    ping.ping_until_received(fip).assert_replied()
Esempio n. 12
0
 def test_ping(self):
     """Test ICMP connectivity to floating IP address"""
     ping.ping_until_received(
         self.stack.ip_address,
         ssh_client=self.stack.peer_stack.ssh_client).assert_replied()