Ceilometer meter support to collect network statistics.

1. Add port.* meters for collecting neutron port statistics.
2. Unit tests for port.* meters and switch.ports meter

Change-Id: I89e43e275f902faaf6ad59f6ff16ba786e6f372d
Implements: blueprint network-statistics-from-opendaylight
This commit is contained in:
Deepthi V V 2017-06-27 18:53:01 +05:30
parent 58057667ec
commit ae0716c6d0
8 changed files with 198 additions and 1 deletions

View File

@ -25,6 +25,13 @@ class PortPollster(statistics._Base):
meter_unit = 'port'
class PortPollsterUptime(statistics._Base):
meter_name = 'switch.port.uptime'
meter_type = sample.TYPE_GAUGE
meter_unit = 's'
class PortPollsterReceivePackets(statistics._Base):
meter_name = 'switch.port.receive.packets'

View File

@ -0,0 +1,74 @@
#
# Copyright (C) 2017 Ericsson India Global Services Pvt Ltd.
#
# 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.
from ceilometer.network import statistics
from ceilometer import sample
class PortPollster(statistics._Base):
meter_name = 'port'
meter_type = sample.TYPE_GAUGE
meter_unit = 'port'
class PortPollsterUptime(statistics._Base):
meter_name = 'port.uptime'
meter_type = sample.TYPE_GAUGE
meter_unit = 's'
class PortPollsterReceivePackets(statistics._Base):
meter_name = 'port.receive.packets'
meter_type = sample.TYPE_CUMULATIVE
meter_unit = 'packet'
class PortPollsterTransmitPackets(statistics._Base):
meter_name = 'port.transmit.packets'
meter_type = sample.TYPE_CUMULATIVE
meter_unit = 'packet'
class PortPollsterReceiveBytes(statistics._Base):
meter_name = 'port.receive.bytes'
meter_type = sample.TYPE_CUMULATIVE
meter_unit = 'B'
class PortPollsterTransmitBytes(statistics._Base):
meter_name = 'port.transmit.bytes'
meter_type = sample.TYPE_CUMULATIVE
meter_unit = 'B'
class PortPollsterReceiveDrops(statistics._Base):
meter_name = 'port.receive.drops'
meter_type = sample.TYPE_CUMULATIVE
meter_unit = 'packet'
class PortPollsterReceiveErrors(statistics._Base):
meter_name = 'port.receive.errors'
meter_type = sample.TYPE_CUMULATIVE
meter_unit = 'packet'

View File

@ -23,3 +23,10 @@ class SWPollster(statistics._Base):
meter_name = 'switch'
meter_type = sample.TYPE_GAUGE
meter_unit = 'switch'
class SwitchPollsterPorts(statistics._Base):
meter_name = 'switch.ports'
meter_type = sample.TYPE_GAUGE
meter_unit = 'ports'

View File

@ -27,6 +27,13 @@ class TestPortPollsters(statistics._PollsterTestBase):
sample.TYPE_GAUGE,
'port')
def test_port_pollster_uptime(self):
self._test_pollster(
port.PortPollsterUptime,
'switch.port.uptime',
sample.TYPE_GAUGE,
's')
def test_port_pollster_receive_packets(self):
self._test_pollster(
port.PortPollsterReceivePackets,

View File

@ -0,0 +1,77 @@
#
# Copyright (C) 2017 Ericsson India Global Services Pvt Ltd.
#
# 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.
from ceilometer.network.statistics import port_v2
from ceilometer import sample
from ceilometer.tests.unit.network import statistics
class TestPortPollsters(statistics._PollsterTestBase):
def test_port_pollster(self):
self._test_pollster(
port_v2.PortPollster,
'port',
sample.TYPE_GAUGE,
'port')
def test_port_pollster_uptime(self):
self._test_pollster(
port_v2.PortPollsterUptime,
'port.uptime',
sample.TYPE_GAUGE,
's')
def test_port_pollster_receive_packets(self):
self._test_pollster(
port_v2.PortPollsterReceivePackets,
'port.receive.packets',
sample.TYPE_CUMULATIVE,
'packet')
def test_port_pollster_transmit_packets(self):
self._test_pollster(
port_v2.PortPollsterTransmitPackets,
'port.transmit.packets',
sample.TYPE_CUMULATIVE,
'packet')
def test_port_pollster_receive_bytes(self):
self._test_pollster(
port_v2.PortPollsterReceiveBytes,
'port.receive.bytes',
sample.TYPE_CUMULATIVE,
'B')
def test_port_pollster_transmit_bytes(self):
self._test_pollster(
port_v2.PortPollsterTransmitBytes,
'port.transmit.bytes',
sample.TYPE_CUMULATIVE,
'B')
def test_port_pollster_receive_drops(self):
self._test_pollster(
port_v2.PortPollsterReceiveDrops,
'port.receive.drops',
sample.TYPE_CUMULATIVE,
'packet')
def test_port_pollster_receive_errors(self):
self._test_pollster(
port_v2.PortPollsterReceiveErrors,
'port.receive.errors',
sample.TYPE_CUMULATIVE,
'packet')

View File

@ -20,9 +20,16 @@ from ceilometer.tests.unit.network import statistics
class TestSwitchPollster(statistics._PollsterTestBase):
def test_table_pollster(self):
def test_switch_pollster(self):
self._test_pollster(
switch.SWPollster,
'switch',
sample.TYPE_GAUGE,
'switch')
def test_switch_pollster_ports(self):
self._test_pollster(
switch.SwitchPollsterPorts,
'switch.ports',
sample.TYPE_GAUGE,
'ports')

View File

@ -0,0 +1,8 @@
---
prelude: >
Network Statistics From OpenDaylight.
features:
- Add a ceilometer driver to collect network
statistics information using REST APIs exposed by
network-statistics module in OpenDaylight.
- Add support for network statistics meters with gnocchi

View File

@ -145,6 +145,14 @@ ceilometer.poll.ipmi =
ceilometer.poll.central =
ip.floating = ceilometer.network.floatingip:FloatingIPPollster
image.size = ceilometer.image.glance:ImageSizePollster
port = ceilometer.network.statistics.port_v2:PortPollster
port.uptime = ceilometer.network.statistics.port_v2:PortPollsterUptime
port.receive.packets = ceilometer.network.statistics.port_v2:PortPollsterReceivePackets
port.transmit.packets = ceilometer.network.statistics.port_v2:PortPollsterTransmitPackets
port.receive.bytes = ceilometer.network.statistics.port_v2:PortPollsterReceiveBytes
port.transmit.bytes = ceilometer.network.statistics.port_v2:PortPollsterTransmitBytes
port.receive.drops = ceilometer.network.statistics.port_v2:PortPollsterReceiveDrops
port.receive.errors = ceilometer.network.statistics.port_v2:PortPollsterReceiveErrors
rgw.containers.objects = ceilometer.objectstore.rgw:ContainersObjectsPollster
rgw.containers.objects.size = ceilometer.objectstore.rgw:ContainersSizePollster
rgw.objects = ceilometer.objectstore.rgw:ObjectsPollster
@ -157,6 +165,7 @@ ceilometer.poll.central =
storage.objects.size = ceilometer.objectstore.swift:ObjectsSizePollster
storage.objects.containers = ceilometer.objectstore.swift:ObjectsContainersPollster
switch.port = ceilometer.network.statistics.port:PortPollster
switch.port.uptime = ceilometer.network.statistics.port:PortPollsterUptime
switch.port.receive.packets = ceilometer.network.statistics.port:PortPollsterReceivePackets
switch.port.transmit.packets = ceilometer.network.statistics.port:PortPollsterTransmitPackets
switch.port.receive.bytes = ceilometer.network.statistics.port:PortPollsterReceiveBytes
@ -174,6 +183,7 @@ ceilometer.poll.central =
switch.table.lookup.packets = ceilometer.network.statistics.table:TablePollsterLookupPackets
switch.table.matched.packets = ceilometer.network.statistics.table:TablePollsterMatchedPackets
switch = ceilometer.network.statistics.switch:SWPollster
switch.ports = ceilometer.network.statistics.switch:SwitchPollsterPorts
switch.flow = ceilometer.network.statistics.flow:FlowPollster
switch.flow.bytes = ceilometer.network.statistics.flow:FlowPollsterBytes
switch.flow.duration.nanoseconds = ceilometer.network.statistics.flow:FlowPollsterDurationNanoseconds