Beispiel #1
0
    def test_filter_agents_pair_single_room_with_overrides(self):
        agents = {
            'UU1D_master_0': {
                'id': 'UU1D_master_0',
                'mode': 'master',
                'node': 'uno',
                'slave_id': 'UU1D_slave_0'},
            'UU1D_slave_0': {
                'id': 'UU1D_slave_0',
                'master_id': 'UU1D_master_0',
                'mode': 'slave',
                'node': 'dos'},
        }
        ips = {
            'UU1D_master_0': '10.0.0.2',
            'UU1D_slave_0': '10.0.0.4',
        }
        stack_outputs = {}
        expected = {'UU1D_master_0': agents['UU1D_master_0'],
                    'UU1D_slave_0': agents['UU1D_slave_0']}

        def override(agent):
            return dict(ip=ips[agent['id']])

        filtered = deploy.filter_agents(agents, stack_outputs,
                                        override=override)
        self.assertEqual(expected, filtered)
        self.assertEqual(filtered['UU1D_master_0']['ip'], ips['UU1D_master_0'])
Beispiel #2
0
    def test_filter_agents_pair_single_room_with_overrides(self):
        agents = {
            'UU1D_master_0': {
                'id': 'UU1D_master_0',
                'mode': 'master',
                'node': 'uno',
                'slave_id': 'UU1D_slave_0'
            },
            'UU1D_slave_0': {
                'id': 'UU1D_slave_0',
                'master_id': 'UU1D_master_0',
                'mode': 'slave',
                'node': 'dos'
            },
        }
        ips = {
            'UU1D_master_0': '10.0.0.2',
            'UU1D_slave_0': '10.0.0.4',
        }
        stack_outputs = {}
        expected = {
            'UU1D_master_0': agents['UU1D_master_0'],
            'UU1D_slave_0': agents['UU1D_slave_0']
        }

        def override(agent):
            return dict(ip=ips[agent['id']])

        filtered = deploy.filter_agents(agents,
                                        stack_outputs,
                                        override=override)
        self.assertEqual(expected, filtered)
        self.assertEqual(filtered['UU1D_master_0']['ip'], ips['UU1D_master_0'])
Beispiel #3
0
    def test_filter_agents_pair_single_room(self):
        agents = {
            'UU1D_master_0': {
                'id': 'UU1D_master_0',
                'mode': 'master',
                'node': 'uno',
                'slave_id': 'UU1D_slave_0'
            },
            'UU1D_slave_0': {
                'id': 'UU1D_slave_0',
                'master_id': 'UU1D_master_0',
                'mode': 'slave',
                'node': 'dos'
            },
        }
        stack_outputs = {
            'UU1D_master_0_ip': '10.0.0.1',
            'UU1D_master_0_instance_name': 'i-000001',
            'UU1D_slave_0_ip': '10.0.0.2',
            'UU1D_slave_0_instance_name': 'i-000002',
        }
        expected = {
            'UU1D_master_0': agents['UU1D_master_0'],
            'UU1D_slave_0': agents['UU1D_slave_0']
        }

        filtered = deploy.filter_agents(agents, stack_outputs)
        self.assertEqual(expected, filtered)
Beispiel #4
0
 def test_filter_agents_partial_deployed(self):
     agents = {
         'UU1D_agent_0': {
             'id': 'UU1D_agent_0',
             'mode': 'alone',
             'node': 'uno'},
         'UU1D_agent_1': {
             'id': 'UU1D_agent_1',
             'mode': 'alone',
             'node': 'dos'},
     }
     stack_outputs = {
         'UU1D_agent_0_ip': '10.0.0.1',
         'UU1D_agent_0_instance_name': 'i-000001',
     }
     expected = {'UU1D_agent_0': agents['UU1D_agent_0']}
     filtered = deploy.filter_agents(agents, stack_outputs)
     self.assertEqual(expected, filtered)
Beispiel #5
0
    def test_filter_agents_pair_double_room_partially_deployed(self):
        agents = {
            'UU1D_primary_0': {
                'id': 'UU1D_primary_0',
                'mode': 'primary',
                'node': 'uno',
                'minion_id': 'UU1D_minion_0'
            },
            'UU1D_minion_0': {
                'id': 'UU1D_minion_0',
                'primary_id': 'UU1D_primary_0',
                'mode': 'minion',
                'node': 'uno'
            },
            'UU1D_primary_1': {
                'id': 'UU1D_primary_1',
                'mode': 'primary',
                'node': 'dos',
                'minion_id': 'UU1D_minion_1'
            },
            'UU1D_minion_1': {
                'id': 'UU1D_minion_1',
                'primary_id': 'UU1D_primary_1',
                'mode': 'minion',
                'node': 'dos'
            },
        }
        stack_outputs = {
            'UU1D_primary_0_ip': '10.0.0.1',
            'UU1D_primary_0_instance_name': 'i-000001',
            'UU1D_minion_0_ip': '10.0.0.2',
            'UU1D_minion_0_instance_name': 'i-000002',
            'UU1D_primary_1_ip': '10.0.0.3',
            'UU1D_primary_1_instance_name': 'i-000003',
            'UU1D_minion_1_instance_name': 'i-000004',
        }
        expected = {
            'UU1D_primary_0': agents['UU1D_primary_0'],
            'UU1D_minion_0': agents['UU1D_minion_0'],
        }

        filtered = deploy.filter_agents(agents, stack_outputs)
        self.assertEqual(expected, filtered)
Beispiel #6
0
    def test_filter_agents_pair_double_room_partially_deployed(self):
        agents = {
            'UU1D_master_0': {
                'id': 'UU1D_master_0',
                'mode': 'master',
                'node': 'uno',
                'slave_id': 'UU1D_slave_0'},
            'UU1D_slave_0': {
                'id': 'UU1D_slave_0',
                'master_id': 'UU1D_master_0',
                'mode': 'slave',
                'node': 'uno'},
            'UU1D_master_1': {
                'id': 'UU1D_master_1',
                'mode': 'master',
                'node': 'dos',
                'slave_id': 'UU1D_slave_1'},
            'UU1D_slave_1': {
                'id': 'UU1D_slave_1',
                'master_id': 'UU1D_master_1',
                'mode': 'slave',
                'node': 'dos'},
        }
        stack_outputs = {
            'UU1D_master_0_ip': '10.0.0.1',
            'UU1D_master_0_instance_name': 'i-000001',
            'UU1D_slave_0_ip': '10.0.0.2',
            'UU1D_slave_0_instance_name': 'i-000002',
            'UU1D_master_1_ip': '10.0.0.3',
            'UU1D_master_1_instance_name': 'i-000003',
            'UU1D_slave_1_instance_name': 'i-000004',
        }
        expected = {'UU1D_master_0': agents['UU1D_master_0'],
                    'UU1D_slave_0': agents['UU1D_slave_0'], }

        filtered = deploy.filter_agents(agents, stack_outputs)
        self.assertEqual(expected, filtered)