Пример #1
0
 def test_assert_node_raise(self):
     model = model_root.BaremetalModelRoot()
     node_uuid = uuidutils.generate_uuid()
     node = element.IronicNode(uuid=node_uuid)
     model.add_node(node)
     self.assertRaises(exception.IllegalArgumentException,
                       model.assert_node, "obj")
Пример #2
0
 def test_remove_node(self):
     model = model_root.BaremetalModelRoot()
     node_uuid = uuidutils.generate_uuid()
     node = element.IronicNode(uuid=node_uuid)
     model.add_node(node)
     self.assertEqual(node, model.get_node_by_uuid(node_uuid))
     model.remove_node(node)
     self.assertRaises(exception.IronicNodeNotFound, model.get_node_by_uuid,
                       node_uuid)
Пример #3
0
 def test_get_all_ironic_nodes(self):
     model = model_root.BaremetalModelRoot()
     for i in range(10):
         node_uuid = uuidutils.generate_uuid()
         node = element.IronicNode(uuid=node_uuid)
         model.add_node(node)
     all_nodes = model.get_all_ironic_nodes()
     for node_uuid in all_nodes:
         node = model.get_node_by_uuid(node_uuid)
         model.assert_node(node)
Пример #4
0
    def build_scenario_1(self):
        model = modelroot.BaremetalModelRoot()
        # number of nodes
        node_count = 2

        for i in range(0, node_count):
            uuid = utils.generate_uuid()
            node_attributes = {
                "uuid": uuid,
                "power_state": "power on",
                "maintenance": "false",
                "maintenance_reason": "null",
                "extra": {"compute_node_id": i}
            }
            node = element.IronicNode(**node_attributes)
            model.add_node(node)

        return model
Пример #5
0
 def test_add_node(self):
     model = model_root.BaremetalModelRoot()
     node_uuid = uuidutils.generate_uuid()
     node = element.IronicNode(uuid=node_uuid)
     model.add_node(node)
     self.assertEqual(node, model.get_node_by_uuid(node_uuid))
Пример #6
0
 def __init__(self, osc):
     self.osc = osc
     self.model = model_root.BaremetalModelRoot()
     self.ironic_helper = ironic_helper.IronicHelper(osc=self.osc)