[integration tests] AssertionError: There is not all networks on last agent on neutron test

Bug #1584756 reported by Georgy Dyuldin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mirantis OpenStack
Confirmed
High
MOS QA Team

Bug Description

Test result:

https://mirantis.testrail.com/index.php?/tests/view/6051451

Trace:

self = <mos_tests.neutron.python_tests.test_ban_dhcp_agent.TestBanDHCPAgentWithSettings object at 0x7f570b110c50>
net_on_dhcp_count = 3

    @pytest.mark.testrail_id('542623', params={'net_on_dhcp_count': 1})
    @pytest.mark.testrail_id('542624', params={'net_on_dhcp_count': 3})
    @pytest.mark.parametrize('net_on_dhcp_count', [1, 3])
    def test_rescheduling_with_one_or_three_dhcp_agents(self,
                                                        net_on_dhcp_count):
        """Check dhcp-agent rescheduling with
               net on dhcp-agent count not equal two.

            :param net_on_dhcp_count: count of dhcp-agents for network

            Scenario:
                1. Revert snapshot with neutron cluster
                2. Apply new config for neutron on all controllers:
                   set dhcp_agents_per_network property to 1 and restart service
                3. Create network net01, subnet net01_subnet
                4. Create router with gateway to external net and
                   interface with net01
                5. Launch instance and associate floating IP
                6. Run dhcp-client in instance's console: sudo cirros-dhcpc up eth0
                7. Look on what DHCP-agents chosen network is:
                   ``neutron dhcp-agent-list-hosting-net <network_name>``
                8. Ban DHCP-agent on which instance's net is:
                   ``pcs resource ban neutron-dhcp-agent node-x``
                9. Run dhcp-client in instance's console:
                   ``sudo cirros-dhcpc up eth0``
                10. Repeat previous 3 steps two times.
                11. Check that all networks is on last dhcp-agent:
                    ``neutron net-list-on-dhcp-agent <id_clr_agnt>``
                12. Ban last DHCP-agent on which instance's net is:
                    ``pcs resource ban neutron-dhcp-agent node-3``
                13. Clear first banned DHCP-agent
                    ``pcs resource clear neutron-dhcp-agent node-1``
                14. Check that all networks is on cleared dhcp-agent:
                    ``neutron net-list-on-dhcp-agent <id_clr_agnt>|grep net|wc -l``
                15. Run dhcp-client in instance's console:
                    ``sudo cirros-dhcpc up eth0``

            Duration 15m

            """
        self._prepare_neutron_server_and_env(net_on_dhcp_count)
        # Collect all networks on dhcp-agents
        all_agents = self.os_conn.list_all_neutron_agents(agent_type='dhcp')
        agents_mapping = {agent['host']: agent for agent in all_agents}
        agents_networks = [net['id'] for agent in all_agents
                           for net in self.os_conn.get_networks_on_dhcp_agent(
                               agent['id'])]
        # Ban first two agents
        leader_node_ip = self.env.leader_controller.data['ip']
        banned_agents = []
        for ban_counter in range(2):
            curr_agents = self.os_conn.get_node_with_dhcp_for_network(
                net_id=self.net_id)
            assert len(curr_agents) <= len(all_agents) - ban_counter
            self.ban_dhcp_agent(curr_agents[0], leader_node_ip, self.net_name,
                                wait_for_rescheduling=(net_on_dhcp_count == 1))
            banned_agents.append(curr_agents[0])
            self.check_dhcp_on_cirros_instance(vm=self.instance)

        # check that all networks are on free agent
        last_agent = (set(agents_mapping.keys()) - set(banned_agents)).pop()
        last_agent_id = agents_mapping[last_agent]['id']
        nets_on_last_dhcp_agent = [
            net['id'] for net in self.os_conn.get_networks_on_dhcp_agent(
                last_agent_id)]
        err_msg = (
            'There is not all networks on last agent: '
            'all existing networks - {0}, '
            'networks on free agent - {1}'.format(agents_networks,
                                                  nets_on_last_dhcp_agent))
> assert set(agents_networks) == set(nets_on_last_dhcp_agent), err_msg
E AssertionError: There is not all networks on last agent: all existing networks - [u'ff0d2345-7ed2-43ee-bef3-4eb8e686e8ee', u'8ad0f516-311c-4725-a1fa-19c0c52d72c2', u'ff0d2345-7ed2-43ee-bef3-4eb8e686e8ee', u'8ad0f516-311c-4725-a1fa-19c0c52d72c2', u'ff0d2345-7ed2-43ee-bef3-4eb8e686e8ee'], networks on free agent - [u'ff0d2345-7ed2-43ee-bef3-4eb8e686e8ee']
E assert set(['8ad0f51...eb8e686e8ee']) == set(['ff0d2345...eb8e686e8ee'])
E Extra items in the left set:
E '8ad0f516-311c-4725-a1fa-19c0c52d72c2'
E Full diff:
E - set([u'8ad0f516-311c-4725-a1fa-19c0c52d72c2',
E - u'ff0d2345-7ed2-43ee-bef3-4eb8e686e8ee'])
E ? ^^^^^
E + set([u'ff0d2345-7ed2-43ee-bef3-4eb8e686e8ee'])
E ? ^^^^^

mos_tests/neutron/python_tests/test_ban_dhcp_agent.py:742: AssertionError

Tags: area-qa
Changed in mos:
assignee: nobody → MOS QA Team (mos-qa)
Changed in mos:
milestone: 10.0 → 9.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.