3b20fa0852
The ipmi meters use resource_ids which make it challenging to select information for all the sensors of a particular type. This change adds metadata that identifies the physical node on which a sensor exists. There are still remaining issues with the naming of ipmi and sensor-related meters that will need to be addressed separately. Closes-Bug: 1377157 Change-Id: Ib53755112e4757aa53ab60079f3c555e21a72b63
68 lines
2.0 KiB
Python
68 lines
2.0 KiB
Python
# Copyright 2014 Intel Corp.
|
|
#
|
|
# Author: Zhai Edwin <edwin.zhai@intel.com>
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
import mock
|
|
from oslo.config import cfg
|
|
|
|
from ceilometer.ipmi.pollsters import node
|
|
from ceilometer.tests.ipmi.pollsters import base
|
|
|
|
|
|
CONF = cfg.CONF
|
|
CONF.import_opt('host', 'ceilometer.service')
|
|
|
|
|
|
class TestPowerPollster(base.TestPollsterBase):
|
|
|
|
def fake_data(self):
|
|
# data after parsing Intel Node Manager output
|
|
return {"Current_value": ['13', '00']}
|
|
|
|
def fake_sensor_data(self, sensor_type):
|
|
# No use for this test
|
|
return None
|
|
|
|
def make_pollster(self):
|
|
return node.PowerPollster()
|
|
|
|
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
|
def test_get_samples(self):
|
|
self._test_get_samples()
|
|
|
|
# only one sample, and value is 19(0x13 as current_value)
|
|
self._verify_metering(1, 19, CONF.host)
|
|
|
|
|
|
class TestTemperaturePollster(base.TestPollsterBase):
|
|
|
|
def fake_data(self):
|
|
# data after parsing Intel Node Manager output
|
|
return {"Current_value": ['23', '00']}
|
|
|
|
def fake_sensor_data(self, sensor_type):
|
|
# No use for this test
|
|
return None
|
|
|
|
def make_pollster(self):
|
|
return node.TemperaturePollster()
|
|
|
|
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
|
def test_get_samples(self):
|
|
self._test_get_samples()
|
|
|
|
# only one sample, and value is 35(0x23 as current_value)
|
|
self._verify_metering(1, 35, CONF.host)
|