Exemple #1
0
    def test_load_template_use_neutron(self):
        """This test checks Heat cluster template with Neutron enabled.
           Two NodeGroups used: 'master' with Ephemeral drive attached and
           'worker' with 2 attached volumes 10GB size each
        """

        ng1 = tu.make_ng_dict('master', 42, ['namenode'], 1,
                              floating_ip_pool='floating', image_id=None,
                              volumes_per_node=0, volumes_size=0, id=1)
        ng2 = tu.make_ng_dict('worker', 42, ['datanode'], 1,
                              floating_ip_pool='floating', image_id=None,
                              volumes_per_node=2, volumes_size=10, id=2)
        cluster = tu.create_cluster("cluster", "tenant1", "general",
                                    "1.2.1", [ng1, ng2],
                                    user_keypair_id='user_key',
                                    neutron_management_network='private_net',
                                    default_image_id='1', anti_affinity=[],
                                    image_id=None)
        heat_template = h.ClusterTemplate(cluster)
        heat_template.add_node_group_extra(ng1['id'], 1,
                                           get_ud_generator('line1\nline2'))
        heat_template.add_node_group_extra(ng2['id'], 1,
                                           get_ud_generator('line2\nline3'))

        self.override_config("use_neutron", True)
        main_template = h._load_template(
            'main.heat', {'resources':
                          heat_template._serialize_resources()})

        self.assertEqual(
            json.loads(main_template),
            json.loads(f.get_file_text(
                "tests/unit/resources/"
                "test_serialize_resources_use_neutron.heat")))
Exemple #2
0
    def test_load_template_with_anti_affinity_single_ng(self):
        """This test checks Heat cluster template with Neutron enabled
           and anti-affinity feature enabled for single node process
           in single node group.
        """

        ng1 = tu.make_ng_dict('master', 42, ['namenode'], 1,
                              floating_ip_pool='floating', image_id=None,
                              volumes_per_node=0, volumes_size=0, id=1)
        ng2 = tu.make_ng_dict('worker', 42, ['datanode'], 2,
                              floating_ip_pool='floating', image_id=None,
                              volumes_per_node=0, volumes_size=0, id=2)
        cluster = tu.create_cluster("cluster", "tenant1", "general",
                                    "1.2.1", [ng1, ng2],
                                    user_keypair_id='user_key',
                                    neutron_management_network='private_net',
                                    default_image_id='1',
                                    anti_affinity=['datanode'], image_id=None)
        aa_heat_template = h.ClusterTemplate(cluster)
        aa_heat_template.add_node_group_extra(ng1['id'], 1,
                                              get_ud_generator('line1\nline2'))
        aa_heat_template.add_node_group_extra(ng2['id'], 2,
                                              get_ud_generator('line2\nline3'))

        self.override_config("use_neutron", True)
        main_template = h._load_template(
            'main.heat', {'resources':
                          aa_heat_template._serialize_resources()})

        self.assertEqual(
            json.loads(main_template),
            json.loads(f.get_file_text(
                "tests/unit/resources/"
                "test_serialize_resources_aa.heat")))
Exemple #3
0
    def test_load_template_with_anti_affinity_single_ng(self):
        """This test checks Heat cluster template with Neutron enabled
           and anti-affinity feature enabled for single node process
           in single node group.
        """

        ng1 = tu.make_ng_dict('master', 42, ['namenode'], 1,
                              floating_ip_pool='floating', image_id=None,
                              volumes_per_node=0, volumes_size=0, id=1)
        ng2 = tu.make_ng_dict('worker', 42, ['datanode'], 2,
                              floating_ip_pool='floating', image_id=None,
                              volumes_per_node=0, volumes_size=0, id=2)
        cluster = tu.create_cluster("cluster", "tenant1", "general",
                                    "1.2.1", [ng1, ng2],
                                    user_keypair_id='user_key',
                                    neutron_management_network='private_net',
                                    default_image_id='1',
                                    anti_affinity=['datanode'], image_id=None)
        aa_heat_template = h.ClusterTemplate(cluster)
        aa_heat_template.add_node_group_extra(ng1['id'], 1,
                                              get_ud_generator('line1\nline2'))
        aa_heat_template.add_node_group_extra(ng2['id'], 2,
                                              get_ud_generator('line2\nline3'))

        self.override_config("use_neutron", True)
        main_template = h._load_template(
            'main.heat', {'resources':
                          aa_heat_template._serialize_resources()})

        self.assertEqual(
            json.loads(main_template),
            json.loads(f.get_file_text(
                "tests/unit/resources/"
                "test_serialize_resources_aa.heat")))
Exemple #4
0
    def test_load_template_with_anti_affinity_single_ng(self):
        """Checks Heat cluster template with Neutron enabled.

        Checks also anti-affinity feature enabled for single node process
        in single node group.
        """

        ng1 = tu.make_ng_dict(
            "master",
            42,
            ["namenode"],
            1,
            floating_ip_pool="floating",
            image_id=None,
            volumes_per_node=0,
            volumes_size=0,
            id=1,
        )
        ng2 = tu.make_ng_dict(
            "worker",
            42,
            ["datanode"],
            2,
            floating_ip_pool="floating",
            image_id=None,
            volumes_per_node=0,
            volumes_size=0,
            id=2,
        )
        cluster = tu.create_cluster(
            "cluster",
            "tenant1",
            "general",
            "1.2.1",
            [ng1, ng2],
            user_keypair_id="user_key",
            neutron_management_network="private_net",
            default_image_id="1",
            anti_affinity=["datanode"],
            image_id=None,
        )
        aa_heat_template = h.ClusterTemplate(cluster)
        aa_heat_template.add_node_group_extra(ng1["id"], 1, get_ud_generator("line1\nline2"))
        aa_heat_template.add_node_group_extra(ng2["id"], 2, get_ud_generator("line2\nline3"))

        self.override_config("use_neutron", True)
        main_template = h._load_template("main.heat", {"resources": aa_heat_template._serialize_resources()})

        self.assertEqual(
            json.loads(main_template),
            json.loads(f.get_file_text("tests/unit/resources/" "test_serialize_resources_aa.heat")),
        )
Exemple #5
0
    def test_load_template_use_neutron(self):
        """This test checks Heat cluster template with Neutron enabled.
           Two NodeGroups used: 'master' with Ephemeral drive attached and
           'worker' with 2 attached volumes 10GB size each
        """

        ng1 = tu.make_ng_dict(
            "master",
            42,
            ["namenode"],
            1,
            floating_ip_pool="floating",
            image_id=None,
            volumes_per_node=0,
            volumes_size=0,
            id=1,
        )
        ng2 = tu.make_ng_dict(
            "worker",
            42,
            ["datanode"],
            1,
            floating_ip_pool="floating",
            image_id=None,
            volumes_per_node=2,
            volumes_size=10,
            id=2,
        )
        cluster = tu.create_cluster(
            "cluster",
            "tenant1",
            "general",
            "1.2.1",
            [ng1, ng2],
            user_keypair_id="user_key",
            neutron_management_network="private_net",
            default_image_id="1",
            anti_affinity=[],
            image_id=None,
        )
        heat_template = h.ClusterTemplate(cluster)
        heat_template.add_node_group_extra(ng1["id"], 1, get_ud_generator("line1\nline2"))
        heat_template.add_node_group_extra(ng2["id"], 1, get_ud_generator("line2\nline3"))

        self.override_config("use_neutron", True)
        main_template = h._load_template("main.heat", {"resources": heat_template._serialize_resources()})

        self.assertEqual(
            json.loads(main_template),
            json.loads(f.get_file_text("tests/unit/resources/" "test_serialize_resources_use_neutron.heat")),
        )
Exemple #6
0
    def test_load_template_use_neutron(self):
        """Test for Heat cluster template with Neutron enabled.

        Two NodeGroups used: 'master' with Ephemeral drive attached and
        'worker' with 2 attached volumes 10GB size each
        """

        ng1, ng2 = self._make_node_groups("floating")
        cluster = self._make_cluster("private_net", ng1, ng2)
        heat_template = self._make_heat_template(cluster, ng1, ng2)
        self.override_config("use_neutron", True)
        main_template = h._load_template("main.heat", {"resources": heat_template._serialize_resources()})

        self.assertEqual(
            json.loads(main_template),
            json.loads(f.get_file_text("tests/unit/resources/" "test_serialize_resources_use_neutron.heat")),
        )
Exemple #7
0
    def test_load_template_use_neutron(self):
        """This test checks Heat cluster template with Neutron enabled.
           Two NodeGroups used: 'master' with Ephemeral drive attached and
           'worker' with 2 attached volumes 10GB size each
        """

        ng1, ng2 = self._make_node_groups('floating')
        cluster = self._make_cluster('private_net', ng1, ng2)
        heat_template = self._make_heat_template(cluster, ng1, ng2)
        self.override_config("use_neutron", True)
        main_template = h._load_template(
            'main.heat', {'resources': heat_template._serialize_resources()})

        self.assertEqual(
            json.loads(main_template),
            json.loads(
                f.get_file_text("tests/unit/resources/"
                                "test_serialize_resources_use_neutron.heat")))
Exemple #8
0
    def test_load_template_use_nova_network_with_autoassignment(self):
        """This test checks Heat cluster template with Nova Network enabled
           with autoassignment floating ip.
           Two NodeGroups used: 'master' with Ephemeral drive attached and
           'worker' with 2 attached volumes 10GB size each
        """

        ng1, ng2 = self._make_node_groups()
        cluster = self._make_cluster(None, ng1, ng2)
        heat_template = self._make_heat_template(cluster, ng1, ng2)
        self.override_config("use_neutron", False)
        main_template = h._load_template(
            'main.heat', {'resources':
                          heat_template._serialize_resources()})

        self.assertEqual(
            json.loads(main_template),
            json.loads(f.get_file_text(
                "tests/unit/resources/"
                "test_serialize_resources_use_nn_with_autoassignment.heat"))
        )
Exemple #9
0
    def test_load_template_use_nova_network_with_autoassignment(self):
        """Checks Heat cluster template with Nova Network enabled.

        Nova Network checked with autoassignment of floating ip.

        Two NodeGroups used: 'master' with Ephemeral drive attached and
        'worker' with 2 attached volumes 10GB size each
        """

        ng1, ng2 = self._make_node_groups()
        cluster = self._make_cluster(None, ng1, ng2)
        heat_template = self._make_heat_template(cluster, ng1, ng2)
        self.override_config("use_neutron", False)
        main_template = h._load_template(
            'main.heat', {'resources': heat_template._serialize_resources()})

        self.assertEqual(
            json.loads(main_template),
            json.loads(
                f.get_file_text(
                    "tests/unit/resources/"
                    "test_serialize_resources_use_nn_with_autoassignment.heat")
            ))