Esempio n. 1
0
    def test_get_power(self):
        """ Test node.get_power method """
        for node in self.nodes:
            result = node.get_power()

            self.assertEqual(node.bmc.method_calls, [call.get_chassis_status()])
            self.assertEqual(result, False)
Esempio n. 2
0
    def test_get_power_policy(self):
        """ Test node.get_power_policy method """
        for node in self.nodes:
            result = node.get_power_policy()

            self.assertEqual(node.bmc.method_calls, [call.get_chassis_status()])
            self.assertEqual(result, "always-off")
Esempio n. 3
0
    def test_composite_bmc(self):
        """ Test the CompositeBMC member """
        with self.assertRaises(AttributeError):
            self.fabric.cbmc.fake_method()

        self.fabric.cbmc.set_chassis_power("off")
        results = self.fabric.cbmc.get_chassis_status()

        self.assertEqual(len(results), len(self.fabric.nodes))
        for node_id in self.fabric.nodes:
            self.assertFalse(results[node_id].power_on)

        for node in self.fabric.nodes.values():
            self.assertEqual(node.bmc.method_calls, [
                call.set_chassis_power("off"),
                call.get_chassis_status()
            ])
Esempio n. 4
0
    def test_composite_bmc(self):
        """ Test the CompositeBMC member """
        with self.assertRaises(AttributeError):
            self.fabric.cbmc.fake_method()

        self.fabric.cbmc.set_chassis_power("off")
        results = self.fabric.cbmc.get_chassis_status()

        self.assertEqual(len(results), len(self.fabric.nodes))
        for node_id in self.fabric.nodes:
            self.assertFalse(results[node_id].power_on)

        for node in self.fabric.nodes.values():
            self.assertEqual(
                node.bmc.method_calls,
                [call.set_chassis_power("off"),
                 call.get_chassis_status()])