From 9f4bbb93d479e26e2320d96ae4fbd070c0d7c594 Mon Sep 17 00:00:00 2001 From: Aman Pandae Date: Mon, 19 Aug 2024 08:28:26 -0400 Subject: [PATCH] Rest API Doc in StarlingX Api-ref API Request and Response Information added to the Code Repository. Modified tox and Zuul to build the doc html pages. Added docs for the following APIs: 1. /metrics 2. /metrics/device/{device_name} 3. /metrics/pci-addr/{pci_addr} Story: 2010918 Task: 50889 Change-Id: I720cbabc37b07314ef9fa74f0d39942373e6aec8 Signed-off-by: Aman Pandae Signed-off-by: AbhishekJ --- .gitignore | 1 + .zuul.yaml | 4 + api-ref/requirements.txt | 4 + api-ref/source/api_node_interface_metrics.rst | 142 +++++++++++ api-ref/source/conf.py | 78 ++++++ api-ref/source/index.rst | 14 ++ .../samples/openmet_complete_pf_vfs.txt | 226 ++++++++++++++++++ api-ref/source/samples/openmet_pciaddr_vf.txt | 46 ++++ test-requirements.txt | 1 + tox.ini | 9 +- 10 files changed, 524 insertions(+), 1 deletion(-) create mode 100644 api-ref/requirements.txt create mode 100644 api-ref/source/api_node_interface_metrics.rst create mode 100644 api-ref/source/conf.py create mode 100644 api-ref/source/index.rst create mode 100644 api-ref/source/samples/openmet_complete_pf_vfs.txt create mode 100644 api-ref/source/samples/openmet_pciaddr_vf.txt diff --git a/.gitignore b/.gitignore index 293696c..571940d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ # Sphinx _build doc/source/api/ +api-ref/build # Packages/installer info *.egg diff --git a/.zuul.yaml b/.zuul.yaml index 86869c9..9d8280f 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,5 +1,9 @@ --- - project: + vars: + ensure_tox_version: '<4' + templates: + - stx-api-ref-jobs check: jobs: - openstack-tox-linters diff --git a/api-ref/requirements.txt b/api-ref/requirements.txt new file mode 100644 index 0000000..9136f4f --- /dev/null +++ b/api-ref/requirements.txt @@ -0,0 +1,4 @@ +openstackdocstheme>=2.2.1 # Apache-2.0 +os-api-ref>=1.4.0 # Apache-2.0 +reno>=3.1.0 # Apache-2.0 +sphinx>=2.0.0,!=2.1.0 # BSD \ No newline at end of file diff --git a/api-ref/source/api_node_interface_metrics.rst b/api-ref/source/api_node_interface_metrics.rst new file mode 100644 index 0000000..dc5fea4 --- /dev/null +++ b/api-ref/source/api_node_interface_metrics.rst @@ -0,0 +1,142 @@ +======================================= +Node Interface Metrics Exporter API v1 +======================================= + +This Section contains the list of APIs of Node Interface Metrics Exporter. + +The Application Pod retrieves the node interface information and statistics by making a call to the following REST APIs. + +The server address is the node’s host name or IP address, and it uses port 9110. + +The output is presented in the Open Metrics format, providing information and statistics for devices that are in the UP state. + + +--------------------- +Open Metrics API List +--------------------- + +***************************************** +Get statistics of all devices in the node +***************************************** + +.. rest_method:: GET /metrics + +- ``/metrics`` provides the information and statistics of all Physical + Function devices. + +- It provides the information and statistics of Virtual Function devices + that belong to the Physical Function devices. + +- It also provides the POD information if the Virtual Function device + is used by any POD (matched by PciAddr of Virtual Function device). + +**Normal response codes** + +200 + +**Error response codes** + +computeFault (400, 500, …), serviceUnavailable (503), badRequest (400), badMethod (405), itemNotFound (404) + +**Request parameters** + +None + +**Response parameters** + +Node statistics in Open Metrics format. + +.. include:: samples/openmet_complete_pf_vfs.txt + :literal: + + +**************************************************** +Get Statistics of a particular device by device_name +**************************************************** + +.. rest_method:: GET /metrics/device/{device_name} + +Get the information and statistics of a particular device in the Node +identified by ``{device_name}``. + +- If the input device name is Physical Function, + ``/metrics/device/{device_name}`` provides its device information and + statistics. It provides device information and statistics of all + the Virtual Functions that belong to the input device. It also provides + the POD information if Virtual Function device is used by any + POD (matched by ``pci-address`` of Virtual Function device). + +- Input Virtual Function device name is not supported as multiple Virtual + Functions have the same device name in different pods. + +**Normal response codes** + +200 + +**Error response codes** + +computeFault (400, 500, …), serviceUnavailable (503), badRequest (400), badMethod (405), itemNotFound (404) + +**Request parameters** + +.. csv-table:: + :header: "Parameter", "Style", "Type", "Description" + :widths: 20, 20, 20, 60 + + "device_name","URI","string","The unique name of Physical Function device" + +**Response parameters** + +Device statistics in Open Metrics format. + +.. include:: samples/openmet_complete_pf_vfs.txt + :literal: + +**************************************************** +Get Statistics of a particular device by pci_address +**************************************************** + +.. rest_method:: GET /metrics/pci-addr/{pci_address} + +Get statistics of the particular device in the node identified +by ``{pci_address}``. + +- If the input ``pci-address`` belongs to the Physical Function device, + ``/metrics/pci-addr/{pci_address}`` provides its device information and + statistics. It also provides statistics of all the Virtual + Function devices that belong to the Physical Function device. + +- If the input ``pci-address`` belongs to the Virtual Function device, it + provides its device information and statistics. It provides the POD + information as well if the Virtual Function device is used by any POD + (matched by ``pci-address`` of the Virtual Function device). + +**Normal response codes** + +200 + +**Error response codes** + +computeFault (400, 500, …), serviceUnavailable (503), badRequest (400), badMethod (405), itemNotFound (404) + +**Request parameters** + +.. csv-table:: + :header: "Parameter", "Style", "Type", "Description" + :widths: 20, 20, 20, 80 + + "pci_address","URI","csapi:UUID","Unique identifier of the pci-address of the Physical Function or the Virtual Function devices" + +**Response parameters** + +Device statistics in Open Metrics format. + +- When input is ``pci-address`` of Physical Function device: + +.. include:: samples/openmet_complete_pf_vfs.txt + :literal: + +- When input is ``pci-address`` of the Virtual Function device: + +.. include:: samples/openmet_pciaddr_vf.txt + :literal: diff --git a/api-ref/source/conf.py b/api-ref/source/conf.py new file mode 100644 index 0000000..1176831 --- /dev/null +++ b/api-ref/source/conf.py @@ -0,0 +1,78 @@ +# 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. +# +# stx-config API reference documentation build configuration file +# +# This file is execfile()d with the current directory set to +# its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import os +import sys + +extensions = [ + 'openstackdocstheme', + 'os_api_ref', +] + +html_theme = 'starlingxdocs' + +html_theme_options = { + "sidebar_dropdown": "api_ref", + "sidebar_mode": "toc", +} + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +sys.path.insert(0, os.path.abspath('../../')) +sys.path.insert(0, os.path.abspath('../')) +sys.path.insert(0, os.path.abspath('./')) +sys.path.insert(0,os.path.abspath('./samples')) + +# The suffix of source filenames. +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +openstackdocs_repo_name = 'starlingx/app-node-interface-metrics-exporter' +openstackdocs_auto_name = False + +# exclude_patterns = ['samples/openmet_complete_pf_vfs.rst'] +# exclude_patterns = ['samples/openmet_complete_pf_vfs.rst'] + + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +add_module_names = False + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'native' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass +# [howto/manual]). +latex_documents = [ + ('index', 'stx-node-interface-metrics.tex', u'stx-node-interface-metrics API Documentation', + u'StarlingX', 'manual'), +] diff --git a/api-ref/source/index.rst b/api-ref/source/index.rst new file mode 100644 index 0000000..03d06e7 --- /dev/null +++ b/api-ref/source/index.rst @@ -0,0 +1,14 @@ +================================================== +API Definition for Node Interface Metrics Exporter +================================================== +API reference for using Node Interface Metrics Exporter application on StarlingX + +Search Node Interface Metrics Exporter API content using the :ref:`search page `. + +-------------- +API definition +-------------- +.. toctree:: + :maxdepth: 2 + + api_node_interface_metrics.rst \ No newline at end of file diff --git a/api-ref/source/samples/openmet_complete_pf_vfs.txt b/api-ref/source/samples/openmet_complete_pf_vfs.txt new file mode 100644 index 0000000..7a9c35c --- /dev/null +++ b/api-ref/source/samples/openmet_complete_pf_vfs.txt @@ -0,0 +1,226 @@ + + # TYPE network_interface_device_info gauge + # HELP network_interface_device_info network_interface_device_info + network_interface_device_info{device="enp59s0f1",address="6c:fe:54:1e:2e:01",broadcast="[fe80::6efe:54ff:fe1e:2e01/64]",duplex="full",ifalias=" ",operstate="up",pciaddr="0000:3b:00.1"} 1 + # TYPE network_interface_rx_packets counter + # HELP network_interface_rx_packets network_interface_rx_packets + network_interface_rx_packets_total{device="enp59s0f1"} 49874 + network_interface_rx_packets_created{device="enp59s0f1"} 1721817246.063053 + # TYPE network_interface_tx_packets counter + # HELP network_interface_tx_packets network_interface_tx_packets + network_interface_tx_packets_total{device="enp59s0f1"} 3147 + network_interface_tx_packets_created{device="enp59s0f1"} 1721817246.063055 + # TYPE network_interface_rx_bytes counter + # HELP network_interface_rx_bytes network_interface_rx_bytes + network_interface_rx_bytes_total{device="enp59s0f1"} 4.182353e+06 + network_interface_rx_bytes_created{device="enp59s0f1"} 1721817246.063057 + # TYPE network_interface_tx_bytes counter + # HELP network_interface_tx_bytes network_interface_tx_bytes + network_interface_tx_bytes_total{device="enp59s0f1"} 860374 + network_interface_tx_bytes_created{device="enp59s0f1"} 1721817246.063058 + # TYPE network_interface_rx_errors counter + # HELP network_interface_rx_errors network_interface_rx_errors + network_interface_rx_errors_total{device="enp59s0f1"} 0 + network_interface_rx_errors_created{device="enp59s0f1"} 1721817246.063060 + # TYPE network_interface_tx_errors counter + # HELP network_interface_tx_errors network_interface_tx_errors + network_interface_tx_errors_total{device="enp59s0f1"} 0 + network_interface_tx_errors_created{device="enp59s0f1"} 1721817246.063061 + # TYPE network_interface_rx_dropped counter + # HELP network_interface_rx_dropped network_interface_rx_dropped + network_interface_rx_dropped_total{device="enp59s0f1"} 0 + network_interface_rx_dropped_created{device="enp59s0f1"} 1721817246.063063 + # TYPE network_interface_tx_dropped counter + # HELP network_interface_tx_dropped network_interface_tx_dropped + network_interface_tx_dropped_total{device="enp59s0f1"} 0 + network_interface_tx_dropped_created{device="enp59s0f1"} 1721817246.063065 + # TYPE network_interface_multicast counter + # HELP network_interface_multicast network_interface_multicast + network_interface_multicast_total{device="enp59s0f1"} 49873 + network_interface_multicast_created{device="enp59s0f1"} 1721817246.063072 + # TYPE network_interface_collisions counter + # HELP network_interface_collisions network_interface_collisions + network_interface_collisions_total{device="enp59s0f1"} 0 + network_interface_collisions_created{device="enp59s0f1"} 1721817246.063075 + # TYPE network_interface_rx_length_errors counter + # HELP network_interface_rx_length_errors network_interface_rx_length_errors + network_interface_rx_length_errors_total{device="enp59s0f1"} 0 + network_interface_rx_length_errors_created{device="enp59s0f1"} 1721817246.063076 + # TYPE network_interface_rx_over_errors counter + # HELP network_interface_rx_over_errors network_interface_rx_over_errors + network_interface_rx_over_errors_total{device="enp59s0f1"} 0 + network_interface_rx_over_errors_created{device="enp59s0f1"} 1721817246.063078 + # TYPE network_interface_rx_crc_errors counter + # HELP network_interface_rx_crc_errors network_interface_rx_crc_errors + network_interface_rx_crc_errors_total{device="enp59s0f1"} 0 + network_interface_rx_crc_errors_created{device="enp59s0f1"} 1721817246.063079 + # TYPE network_interface_rx_frame_errors counter + # HELP network_interface_rx_frame_errors network_interface_rx_frame_errors + network_interface_rx_frame_errors_total{device="enp59s0f1"} 0 + network_interface_rx_frame_errors_created{device="enp59s0f1"} 1721817246.063081 + # TYPE network_interface_rx_fifo_errors counter + # HELP network_interface_rx_fifo_errors network_interface_rx_fifo_errors + network_interface_rx_fifo_errors_total{device="enp59s0f1"} 0 + network_interface_rx_fifo_errors_created{device="enp59s0f1"} 1721817246.063083 + # TYPE network_interface_rx_missed_errors counter + # HELP network_interface_rx_missed_errors network_interface_rx_missed_errors + network_interface_rx_missed_errors_total{device="enp59s0f1"} 0 + network_interface_rx_missed_errors_created{device="enp59s0f1"} 1721817246.063085 + # TYPE network_interface_tx_aborted_errors counter + # HELP network_interface_tx_aborted_errors network_interface_tx_aborted_errors + network_interface_tx_aborted_errors_total{device="enp59s0f1"} 0 + network_interface_tx_aborted_errors_created{device="enp59s0f1"} 1721817246.063086 + # TYPE network_interface_tx_carrier_errors counter + # HELP network_interface_tx_carrier_errors network_interface_tx_carrier_errors + network_interface_tx_carrier_errors_total{device="enp59s0f1"} 0 + network_interface_tx_carrier_errors_created{device="enp59s0f1"} 1721817246.063093 + # TYPE network_interface_tx_fifo_errors counter + # HELP network_interface_tx_fifo_errors network_interface_tx_fifo_errors + network_interface_tx_fifo_errors_total{device="enp59s0f1"} 0 + network_interface_tx_fifo_errors_created{device="enp59s0f1"} 1721817246.063095 + # TYPE network_interface_tx_heartbeat_errors counter + # HELP network_interface_tx_heartbeat_errors network_interface_tx_heartbeat_errors + network_interface_tx_heartbeat_errors_total{device="enp59s0f1"} 0 + network_interface_tx_heartbeat_errors_created{device="enp59s0f1"} 1721817246.063097 + # TYPE network_interface_tx_window_errors counter + # HELP network_interface_tx_window_errors network_interface_tx_window_errors + network_interface_tx_window_errors_total{device="enp59s0f1"} 0 + network_interface_tx_window_errors_created{device="enp59s0f1"} 1721817246.063099 + # TYPE network_interface_rx_compressed counter + # HELP network_interface_rx_compressed network_interface_rx_compressed + network_interface_rx_compressed_total{device="enp59s0f1"} 0 + network_interface_rx_compressed_created{device="enp59s0f1"} 1721817246.063101 + # TYPE network_interface_tx_compressed counter + # HELP network_interface_tx_compressed network_interface_tx_compressed + network_interface_tx_compressed_total{device="enp59s0f1"} 0 + network_interface_tx_compressed_created{device="enp59s0f1"} 1721817246.063102 + + # EOF + # TYPE network_interface_vf_device_info gauge + # HELP network_interface_vf_device_info network_interface_vf_device_info + network_interface_vf_device_info{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0",address="8a:ff:e4:cf:9a:7a",vlan="0",spoofcheck="on",trust="off"} 1 + # EOF + # TYPE network_interface_vf_tx_rate counter + # HELP network_interface_vf_tx_rate network_interface_vf_tx_rate + network_interface_vf_tx_rate_total{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 0 + network_interface_vf_tx_rate_created{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 1721817246.063172 + # TYPE network_interface_vf_max_tx_rate counter + # HELP network_interface_vf_max_tx_rate network_interface_vf_max_tx_rate + network_interface_vf_max_tx_rate_total{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 0 + network_interface_vf_max_tx_rate_created{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 1721817246.063175 + # TYPE network_interface_vf_min_tx_rate counter + # HELP network_interface_vf_min_tx_rate network_interface_vf_min_tx_rate + network_interface_vf_min_tx_rate_total{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 0 + network_interface_vf_min_tx_rate_created{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 1721817246.063177 + # TYPE network_interface_vf_rx_packets counter + # HELP network_interface_vf_rx_packets network_interface_vf_rx_packets + network_interface_vf_rx_packets_total{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 0 + network_interface_vf_rx_packets_created{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 1721817246.063179 + # TYPE network_interface_vf_tx_packets counter + # HELP network_interface_vf_tx_packets network_interface_vf_tx_packets + network_interface_vf_tx_packets_total{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 30 + network_interface_vf_tx_packets_created{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 1721817246.063180 + # TYPE network_interface_vf_rx_bytes counter + # HELP network_interface_vf_rx_bytes network_interface_vf_rx_bytes + network_interface_vf_rx_bytes_total{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 0 + network_interface_vf_rx_bytes_created{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 1721817246.063182 + # TYPE network_interface_vf_tx_bytes counter + # HELP network_interface_vf_tx_bytes network_interface_vf_tx_bytes + network_interface_vf_tx_bytes_total{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 2324 + network_interface_vf_tx_bytes_created{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 1721817246.063184 + # TYPE network_interface_vf_rx_dropped counter + # HELP network_interface_vf_rx_dropped network_interface_vf_rx_dropped + network_interface_vf_rx_dropped_total{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 0 + network_interface_vf_rx_dropped_created{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 1721817246.063186 + # TYPE network_interface_vf_tx_dropped counter + # HELP network_interface_vf_tx_dropped network_interface_vf_tx_dropped + network_interface_vf_tx_dropped_total{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 0 + network_interface_vf_tx_dropped_created{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 1721817246.063188 + # EOF + + + # EOF + # TYPE network_interface_vf_tx_rate counter + # HELP network_interface_vf_tx_rate network_interface_vf_tx_rate + network_interface_vf_tx_rate_total{device="enp59s0f1",vf="1",pciaddr="0000:3b:0a.1"} 0 + network_interface_vf_tx_rate_created{device="enp59s0f1",vf="1",pciaddr="0000:3b:0a.1"} 1721817246.063229 + # TYPE network_interface_vf_max_tx_rate counter + # HELP network_interface_vf_max_tx_rate network_interface_vf_max_tx_rate + network_interface_vf_max_tx_rate_total{device="enp59s0f1",vf="1",pciaddr="0000:3b:0a.1"} 0 + network_interface_vf_max_tx_rate_created{device="enp59s0f1",vf="1",pciaddr="0000:3b:0a.1"} 1721817246.063231 + # TYPE network_interface_vf_min_tx_rate counter + # HELP network_interface_vf_min_tx_rate network_interface_vf_min_tx_rate + network_interface_vf_min_tx_rate_total{device="enp59s0f1",vf="1",pciaddr="0000:3b:0a.1"} 0 + network_interface_vf_min_tx_rate_created{device="enp59s0f1",vf="1",pciaddr="0000:3b:0a.1"} 1721817246.063236 + # TYPE network_interface_vf_rx_packets counter + # HELP network_interface_vf_rx_packets network_interface_vf_rx_packets + network_interface_vf_rx_packets_total{device="enp59s0f1",vf="1",pciaddr="0000:3b:0a.1"} 0 + network_interface_vf_rx_packets_created{device="enp59s0f1",vf="1",pciaddr="0000:3b:0a.1"} 1721817246.063238 + # TYPE network_interface_vf_tx_packets counter + # HELP network_interface_vf_tx_packets network_interface_vf_tx_packets + network_interface_vf_tx_packets_total{device="enp59s0f1",vf="1",pciaddr="0000:3b:0a.1"} 0 + network_interface_vf_tx_packets_created{device="enp59s0f1",vf="1",pciaddr="0000:3b:0a.1"} 1721817246.063240 + # TYPE network_interface_vf_rx_bytes counter + # HELP network_interface_vf_rx_bytes network_interface_vf_rx_bytes + network_interface_vf_rx_bytes_total{device="enp59s0f1",vf="1",pciaddr="0000:3b:0a.1"} 0 + network_interface_vf_rx_bytes_created{device="enp59s0f1",vf="1",pciaddr="0000:3b:0a.1"} 1721817246.063241 + # TYPE network_interface_vf_tx_bytes counter + # HELP network_interface_vf_tx_bytes network_interface_vf_tx_bytes + network_interface_vf_tx_bytes_total{device="enp59s0f1",vf="1",pciaddr="0000:3b:0a.1"} 0 + network_interface_vf_tx_bytes_created{device="enp59s0f1",vf="1",pciaddr="0000:3b:0a.1"} 1721817246.063243 + # TYPE network_interface_vf_rx_dropped counter + # HELP network_interface_vf_rx_dropped network_interface_vf_rx_dropped + network_interface_vf_rx_dropped_total{device="enp59s0f1",vf="1",pciaddr="0000:3b:0a.1"} 0 + network_interface_vf_rx_dropped_created{device="enp59s0f1",vf="1",pciaddr="0000:3b:0a.1"} 1721817246.063246 + # TYPE network_interface_vf_tx_dropped counter + # HELP network_interface_vf_tx_dropped network_interface_vf_tx_dropped + network_interface_vf_tx_dropped_total{device="enp59s0f1",vf="1",pciaddr="0000:3b:0a.1"} 0 + network_interface_vf_tx_dropped_created{device="enp59s0f1",vf="1",pciaddr="0000:3b:0a.1"} 1721817246.063248 + # EOF + + # TYPE network_interface_vf_device_info gauge + # HELP network_interface_vf_device_info network_interface_vf_device_info + network_interface_vf_device_info{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3",address="7e:c4:e9:5e:ef:8f",vlan="0",spoofcheck="on",trust="off"} 1 + # EOF + # TYPE network_interface_vf_tx_rate counter + # HELP network_interface_vf_tx_rate network_interface_vf_tx_rate + network_interface_vf_tx_rate_total{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3"} 0 + network_interface_vf_tx_rate_created{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3"} 1721817246.066860 + # TYPE network_interface_vf_max_tx_rate counter + # HELP network_interface_vf_max_tx_rate network_interface_vf_max_tx_rate + network_interface_vf_max_tx_rate_total{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3"} 0 + network_interface_vf_max_tx_rate_created{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3"} 1721817246.066865 + # TYPE network_interface_vf_min_tx_rate counter + # HELP network_interface_vf_min_tx_rate network_interface_vf_min_tx_rate + network_interface_vf_min_tx_rate_total{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3"} 0 + network_interface_vf_min_tx_rate_created{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3"} 1721817246.066867 + # TYPE network_interface_vf_rx_packets counter + # HELP network_interface_vf_rx_packets network_interface_vf_rx_packets + network_interface_vf_rx_packets_total{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3"} 0 + network_interface_vf_rx_packets_created{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3"} 1721817246.066869 + # TYPE network_interface_vf_tx_packets counter + # HELP network_interface_vf_tx_packets network_interface_vf_tx_packets + network_interface_vf_tx_packets_total{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3"} 0 + network_interface_vf_tx_packets_created{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3"} 1721817246.066871 + # TYPE network_interface_vf_rx_bytes counter + # HELP network_interface_vf_rx_bytes network_interface_vf_rx_bytes + network_interface_vf_rx_bytes_total{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3"} 0 + network_interface_vf_rx_bytes_created{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3"} 1721817246.066873 + # TYPE network_interface_vf_tx_bytes counter + # HELP network_interface_vf_tx_bytes network_interface_vf_tx_bytes + network_interface_vf_tx_bytes_total{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3"} 0 + network_interface_vf_tx_bytes_created{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3"} 1721817246.066875 + # TYPE network_interface_vf_rx_dropped counter + # HELP network_interface_vf_rx_dropped network_interface_vf_rx_dropped + network_interface_vf_rx_dropped_total{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3"} 0 + network_interface_vf_rx_dropped_created{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3"} 1721817246.066879 + # TYPE network_interface_vf_tx_dropped counter + # HELP network_interface_vf_tx_dropped network_interface_vf_tx_dropped + network_interface_vf_tx_dropped_total{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3"} 0 + network_interface_vf_tx_dropped_created{device="enp59s0f1",vf="3",pciaddr="0000:3b:0a.3"} 1721817246.066881 + # EOF + + # EOF + # TYPE network_interface_vf_kube_pod_info gauge + # HELP network_interface_vf_kube_pod_info network_interface_vf_kube_pod_info + network_interface_vf_kube_pod_info{namespace="default",pod="sriov-pod-demo",container="test-sriovdp-netdev-single-pod-0",resource="intel.com/pci_sriov_net_group0_data0",device="net1",vf="1",pciaddr="0000:3b:0a.0",address="8a:ff:e4:cf:9a:7a"} 1 diff --git a/api-ref/source/samples/openmet_pciaddr_vf.txt b/api-ref/source/samples/openmet_pciaddr_vf.txt new file mode 100644 index 0000000..9d8336b --- /dev/null +++ b/api-ref/source/samples/openmet_pciaddr_vf.txt @@ -0,0 +1,46 @@ + + # TYPE network_interface_vf_device_info gauge + # HELP network_interface_vf_device_info network_interface_vf_device_info + network_interface_vf_device_info{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0",address="8a:ff:e4:cf:9a:7a",vlan="0",spoofcheck="on",trust="off"} 1 + # EOF + # TYPE network_interface_vf_tx_rate counter + # HELP network_interface_vf_tx_rate network_interface_vf_tx_rate + network_interface_vf_tx_rate_total{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 0 + network_interface_vf_tx_rate_created{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 1721817109.463198 + # TYPE network_interface_vf_max_tx_rate counter + # HELP network_interface_vf_max_tx_rate network_interface_vf_max_tx_rate + network_interface_vf_max_tx_rate_total{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 0 + network_interface_vf_max_tx_rate_created{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 1721817109.463204 + # TYPE network_interface_vf_min_tx_rate counter + # HELP network_interface_vf_min_tx_rate network_interface_vf_min_tx_rate + network_interface_vf_min_tx_rate_total{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 0 + network_interface_vf_min_tx_rate_created{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 1721817109.463207 + # TYPE network_interface_vf_rx_packets counter + # HELP network_interface_vf_rx_packets network_interface_vf_rx_packets + network_interface_vf_rx_packets_total{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 0 + network_interface_vf_rx_packets_created{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 1721817109.463209 + # TYPE network_interface_vf_tx_packets counter + # HELP network_interface_vf_tx_packets network_interface_vf_tx_packets + network_interface_vf_tx_packets_total{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 30 + network_interface_vf_tx_packets_created{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 1721817109.463212 + # TYPE network_interface_vf_rx_bytes counter + # HELP network_interface_vf_rx_bytes network_interface_vf_rx_bytes + network_interface_vf_rx_bytes_total{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 0 + network_interface_vf_rx_bytes_created{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 1721817109.463214 + # TYPE network_interface_vf_tx_bytes counter + # HELP network_interface_vf_tx_bytes network_interface_vf_tx_bytes + network_interface_vf_tx_bytes_total{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 2324 + network_interface_vf_tx_bytes_created{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 1721817109.463216 + # TYPE network_interface_vf_rx_dropped counter + # HELP network_interface_vf_rx_dropped network_interface_vf_rx_dropped + network_interface_vf_rx_dropped_total{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 0 + network_interface_vf_rx_dropped_created{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 1721817109.463218 + # TYPE network_interface_vf_tx_dropped counter + # HELP network_interface_vf_tx_dropped network_interface_vf_tx_dropped + network_interface_vf_tx_dropped_total{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 0 + network_interface_vf_tx_dropped_created{device="enp59s0f1",vf="0",pciaddr="0000:3b:0a.0"} 1721817109.463221 + # EOF + # TYPE network_interface_vf_kube_pod_info gauge + # HELP network_interface_vf_kube_pod_info network_interface_vf_kube_pod_info + network_interface_vf_kube_pod_info{namespace="default",pod="sriov-pod-demo",container="test-sriovdp-netdev-single-pod-0",resource="intel.com/pci_sriov_net_group0_data0",device="net1",vf="1",pciaddr="0000:3b:0a.0",address="8a:ff:e4:cf:9a:7a"} 1 + # EOF diff --git a/test-requirements.txt b/test-requirements.txt index fa7c694..65a8db8 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,3 +1,4 @@ # hacking pulls in flake8 hacking>=1.1.0,<=2.0.0 # Apache-2.0 bashate >= 0.2 +sphinx diff --git a/tox.ini b/tox.ini index 3285317..a7a08bf 100644 --- a/tox.ini +++ b/tox.ini @@ -21,7 +21,7 @@ deps = -r{toxinidir}/test-requirements.txt allowlist_externals = bash - + rm [testenv:linters] commands = {[testenv:bashate]commands} @@ -54,3 +54,10 @@ description = Dummy environment to allow sysinv-app to be run in subdir tox basepython = python3 description = Dummy environment to allow bandit to be run in subdir tox +[testenv:api-ref] +basepython = python3 +install_command = pip install -U {opts} {packages} +deps = -r {toxinidir}/api-ref/requirements.txt +commands = + sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html +