Files
distcloud/distributedcloud/tox.ini
Victor Romano 4ceac85048 Introduce dcagent API and periodic info gathering
This commit introduces the new dcagent package. It is comprised of a
periodic process that queries the necessary endpoints to gather the
audit data and an API running on port 8325 (internal) and 8326 (admin).
The api only has one endpoint /v1/dcaudit that accepts only PATCH and
will respond with 'in-sync' or 'out-of-sync' for dcmanager-audit based
on the RegionOne data provided or will return the subcloud data for the
requested endpoints for dcorch-audit.

The agent also supports a key 'use_cache' to be sent in the payload
that will determine if it should use the cache data gathered by the
periodic process or get new information on the fly.

Example of payload using cached data:
  {
    "base_audit": "",
    "firmware_audit": "<regionone-audit-data>",
    "kubernetes_audit": "<regionone-audit-data>",
    "kube_rootca_audit" : "<regionone-audit-data>",
    "software_audit": "<regionone-audit-data>"
  }

Example of payload requesting new information:
  {
    "certificates": "",
    "iuser": "",
    "fernet_repo": "",
    "use_cache": "false"
  }

NOTES:
  - As patch and load audits will be deprecated in the next major
    release, no effort was made to integrate both patch and load audit
    to dcagent.
  - All tests described below were executed applying [1] as well,
    to avoid retesting.

[1]: https://review.opendev.org/c/starlingx/distcloud/+/923351

Test plan:
  - PASS: Run dcmanager audit with dcagent. Verify only one call is
          made to audit the subcloud and the response include the
          correct sync status.
  - PASS: Run dcmanager audit without dcagent. Verify the audit
          works as expected querying each individual endpoint.

Story: 2011106
Task: 50559

Change-Id: I1820ca9688d5d05f8712f9a42f6012f2ec3e2d8a
Signed-off-by: Victor Romano <victor.gluzromano@windriver.com>
2024-07-24 12:39:00 -03:00

105 lines
3.0 KiB
INI

[tox]
envlist = py39,pep8,pylint,black
minversion = 4.4.0
skipsdist = True
# move tox work directory out of the source tree
toxworkdir = /tmp/{env:USER}_dctox
[dc]
stx_config_dir = ../../config
stx_fault_dir = ../../fault
cgcs_patch_src_dir = ../../update/sw-patch/cgcs-patch
cgtsclient_src_dir = {[dc]stx_config_dir}/sysinv/cgts-client/cgts-client
fmclient_src_dir = {[dc]stx_fault_dir}/python-fmclient/fmclient
fm_api_src_dir = {[dc]stx_fault_dir}/fm-api/source
nfv_client_src_dir = ../../nfv/nfv/nfv-client
tsconfig_src_dir = {[dc]stx_config_dir}/tsconfig/tsconfig
[testenv]
basepython = python3.9
sitepackages = False
setenv =
VIRTUAL_ENV={envdir}
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=60
CURRENT_CFG_FILE={toxinidir}/.current.cfg
SINGLE_REPO=True
OSLO_LOCK_PATH={toxinidir}
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-e{[dc]cgcs_patch_src_dir}
-e{[dc]cgtsclient_src_dir}
-e{[dc]fmclient_src_dir}
-e{[dc]fm_api_src_dir}
-e{[dc]nfv_client_src_dir}
-e{[dc]tsconfig_src_dir}
allowlist_externals =
rm
find
[testenv:py39]
commands =
find {toxinidir} -not -path '{toxinidir}/.tox/*' -name '*.py[c|o]' -delete
python setup.py testr --slowest --testr-args='{posargs}'
[testenv:pep8]
commands = flake8
[testenv:cover]
commands =
coverage erase
rm -Rf cover
rm -f coverage.xml
find {toxinidir} -not -path '{toxinidir}/.tox/*' -name '*.py[c|o]' -delete
python setup.py testr --coverage --testr-args='{posargs}'
coverage html -d cover
coverage xml --rcfile=.coveragerc_xml
coverage report
[testenv:debug]
commands = oslo_debug_helper {posargs}
[flake8]
show-source = True
max-line-length = 88
# Suppressed flake8 codes
# H301 one import per line; conflict with Black
# W503 line break before binary operator; conflict with Black
# W504 line break after binary operator
# W605 invalid escape sequence
# E731 do not assign a lambda expression, use a def
ignore = H301,W503,W504,W605,E731
builtins = _
[testenv:genconfig]
commands =
oslo-config-generator --config-file=tools/config-generator.conf
[hacking]
import_exceptions = dcmanager.common.i18n,dcorch.common.i18n
[testenv:pylint]
setenv =
{[testenv]setenv}
PYTHONPATH = {toxinidir}
commands =
pylint {posargs} dccommon dcdbsync dcmanager dcorch dcagent --rcfile=./.pylintrc
[testenv:black]
# This environment checks and displays the recommended changes by Black for formatting
# Python files.
# To apply the format in a specific file, use the following command: black <file_path>
deps =
black>=23.11.0 # MIT
# Note: After all files being formatted by Black, the following command should be used
# as default for the black environment and run_black.py script should be deleted.
; commands =
; black --check --diff .
commands =
python run_black.py