06:56:10 Triggered by Gerrit: https://git.opendaylight.org/gerrit/c/transportpce/+/120829 06:56:10 Running as SYSTEM 06:56:10 [EnvInject] - Loading node environment variables. 06:56:10 Building remotely on prd-ubuntu2204-docker-4c-16g-23919 (ubuntu2204-docker-4c-16g) in workspace /w/workspace/transportpce-tox-verify-transportpce-master 06:56:11 [ssh-agent] Looking for ssh-agent implementation... 06:56:11 [ssh-agent] Exec ssh-agent (binary ssh-agent on a remote machine) 06:56:11 $ ssh-agent 06:56:11 SSH_AUTH_SOCK=/tmp/ssh-XXXXXXESDjuy/agent.1559 06:56:11 SSH_AGENT_PID=1561 06:56:11 [ssh-agent] Started. 06:56:11 Running ssh-add (command line suppressed) 06:56:11 Identity added: /w/workspace/transportpce-tox-verify-transportpce-master@tmp/private_key_14949840702047491887.key (/w/workspace/transportpce-tox-verify-transportpce-master@tmp/private_key_14949840702047491887.key) 06:56:11 [ssh-agent] Using credentials jenkins (jenkins-ssh) 06:56:11 The recommended git tool is: NONE 06:56:13 using credential jenkins-ssh 06:56:13 Wiping out workspace first. 06:56:13 Cloning the remote Git repository 06:56:13 Cloning repository git://devvexx.opendaylight.org/mirror/transportpce 06:56:13 > git init /w/workspace/transportpce-tox-verify-transportpce-master # timeout=10 06:56:13 Fetching upstream changes from git://devvexx.opendaylight.org/mirror/transportpce 06:56:13 > git --version # timeout=10 06:56:13 > git --version # 'git version 2.34.1' 06:56:13 using GIT_SSH to set credentials jenkins-ssh 06:56:13 Verifying host key using known hosts file, will automatically accept unseen keys 06:56:13 > git fetch --tags --force --progress -- git://devvexx.opendaylight.org/mirror/transportpce +refs/heads/*:refs/remotes/origin/* # timeout=10 06:56:17 > git config remote.origin.url git://devvexx.opendaylight.org/mirror/transportpce # timeout=10 06:56:17 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 06:56:17 > git config remote.origin.url git://devvexx.opendaylight.org/mirror/transportpce # timeout=10 06:56:17 Fetching upstream changes from git://devvexx.opendaylight.org/mirror/transportpce 06:56:17 using GIT_SSH to set credentials jenkins-ssh 06:56:17 Verifying host key using known hosts file, will automatically accept unseen keys 06:56:17 > git fetch --tags --force --progress -- git://devvexx.opendaylight.org/mirror/transportpce refs/changes/29/120829/15 # timeout=10 06:56:18 > git rev-parse 785fcb13938a447e501f47a0aa9a74a97736484f^{commit} # timeout=10 06:56:18 JENKINS-19022: warning: possible memory leak due to Git plugin usage; see: https://plugins.jenkins.io/git/#remove-git-plugin-buildsbybranch-builddata-script 06:56:18 Checking out Revision 785fcb13938a447e501f47a0aa9a74a97736484f (refs/changes/29/120829/15) 06:56:18 > git config core.sparsecheckout # timeout=10 06:56:18 > git checkout -f 785fcb13938a447e501f47a0aa9a74a97736484f # timeout=10 06:56:18 Commit message: "Support for openconfig 2.0" 06:56:18 > git rev-parse FETCH_HEAD^{commit} # timeout=10 06:56:18 > git rev-list --no-walk f6d12910d5094a7663243830395c69423a66f1b9 # timeout=10 06:56:18 > git remote # timeout=10 06:56:18 > git submodule init # timeout=10 06:56:18 > git submodule sync # timeout=10 06:56:18 > git config --get remote.origin.url # timeout=10 06:56:18 > git submodule init # timeout=10 06:56:18 > git config -f .gitmodules --get-regexp ^submodule\.(.+)\.url # timeout=10 06:56:18 ERROR: No submodules found. 06:56:22 provisioning config files... 06:56:22 copy managed file [npmrc] to file:/home/jenkins/.npmrc 06:56:22 copy managed file [pipconf] to file:/home/jenkins/.config/pip/pip.conf 06:56:22 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins15317011600488793296.sh 06:56:22 ---> python-tools-install.sh 06:56:22 Setup pyenv: 06:56:22 * system (set by /opt/pyenv/version) 06:56:22 * 3.8.20 (set by /opt/pyenv/version) 06:56:22 * 3.9.20 (set by /opt/pyenv/version) 06:56:22 3.10.15 06:56:22 3.11.10 06:56:26 lf-activate-venv(): INFO: Creating python3 venv at /tmp/venv-HXnc 06:56:26 lf-activate-venv(): INFO: Save venv in file: /tmp/.os_lf_venv 06:56:26 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 06:56:26 lf-activate-venv(): INFO: Attempting to install with network-safe options... 06:56:31 lf-activate-venv(): INFO: Base packages installed successfully 06:56:31 lf-activate-venv(): INFO: Installing additional packages: lftools 06:57:00 lf-activate-venv(): INFO: Adding /tmp/venv-HXnc/bin to PATH 06:57:00 Generating Requirements File 06:57:26 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. 06:57:26 httplib2 0.30.2 requires pyparsing<4,>=3.0.4, but you have pyparsing 2.4.7 which is incompatible. 06:57:26 Python 3.11.10 06:57:26 pip 26.1.2 from /tmp/venv-HXnc/lib/python3.11/site-packages/pip (python 3.11) 06:57:27 aiohappyeyeballs==2.6.2 06:57:27 aiohttp==3.14.0 06:57:27 aiosignal==1.4.0 06:57:27 appdirs==1.4.4 06:57:27 argcomplete==3.6.3 06:57:27 aspy.yaml==1.3.0 06:57:27 attrs==26.1.0 06:57:27 autopage==0.6.0 06:57:27 beautifulsoup4==4.14.3 06:57:27 boto3==1.43.23 06:57:27 botocore==1.43.23 06:57:27 bs4==0.0.2 06:57:27 certifi==2026.5.20 06:57:27 cffi==2.0.0 06:57:27 cfgv==3.5.0 06:57:27 chardet==7.4.3 06:57:27 charset-normalizer==3.4.7 06:57:27 click==8.4.1 06:57:27 cliff==4.14.0 06:57:27 cmd2==3.5.1 06:57:27 cryptography==3.3.2 06:57:27 debtcollector==3.1.0 06:57:27 decorator==5.3.1 06:57:27 defusedxml==0.7.1 06:57:27 Deprecated==1.3.1 06:57:27 distlib==0.4.1 06:57:27 dnspython==2.8.0 06:57:27 docker==7.1.0 06:57:27 dogpile.cache==1.5.0 06:57:27 durationpy==0.10 06:57:27 email-validator==2.3.0 06:57:27 filelock==3.29.1 06:57:27 frozenlist==1.8.0 06:57:27 future==1.0.0 06:57:27 gitdb==4.0.12 06:57:27 GitPython==3.1.50 06:57:27 httplib2==0.30.2 06:57:27 identify==2.6.19 06:57:27 idna==3.18 06:57:27 importlib-resources==1.5.0 06:57:27 iso8601==2.1.0 06:57:27 Jinja2==3.1.6 06:57:27 jmespath==1.1.0 06:57:27 jsonpatch==1.33 06:57:27 jsonpointer==3.1.1 06:57:27 jsonschema==4.26.0 06:57:27 jsonschema-specifications==2025.9.1 06:57:27 keystoneauth1==5.14.0 06:57:27 kubernetes==36.0.2 06:57:27 lftools==0.37.22 06:57:27 lxml==6.1.1 06:57:27 markdown-it-py==4.2.0 06:57:27 MarkupSafe==3.0.3 06:57:27 mdurl==0.1.2 06:57:27 msgpack==1.1.2 06:57:27 multi_key_dict==2.0.3 06:57:27 multidict==6.7.1 06:57:27 munch==4.0.0 06:57:27 netaddr==1.3.0 06:57:27 niet==1.4.2 06:57:27 nodeenv==1.10.0 06:57:27 oauth2client==4.1.3 06:57:27 oauthlib==3.3.1 06:57:27 openstacksdk==4.14.0 06:57:27 os-service-types==1.8.2 06:57:27 osc-lib==4.6.0 06:57:27 oslo.config==10.4.0 06:57:27 oslo.context==6.4.0 06:57:27 oslo.i18n==6.8.0 06:57:27 oslo.log==8.2.0 06:57:27 oslo.serialization==5.10.0 06:57:27 oslo.utils==10.1.0 06:57:27 packaging==26.2 06:57:27 pbr==7.0.3 06:57:27 platformdirs==4.10.0 06:57:27 prettytable==3.17.0 06:57:27 propcache==0.5.2 06:57:27 psutil==7.2.2 06:57:27 pyasn1==0.6.3 06:57:27 pyasn1_modules==0.4.2 06:57:27 pycparser==3.0 06:57:27 pygerrit2==2.0.15 06:57:27 PyGithub==2.9.1 06:57:27 Pygments==2.20.0 06:57:27 PyJWT==2.13.0 06:57:27 PyNaCl==1.6.2 06:57:27 pyparsing==2.4.7 06:57:27 pyperclip==1.11.0 06:57:27 pyrsistent==0.20.0 06:57:27 python-cinderclient==9.9.0 06:57:27 python-dateutil==2.9.0.post0 06:57:27 python-discovery==1.4.0 06:57:27 python-heatclient==5.2.0 06:57:27 python-jenkins==1.8.3 06:57:27 python-keystoneclient==5.8.0 06:57:27 python-magnumclient==4.10.0 06:57:27 python-openstackclient==10.0.0 06:57:27 python-swiftclient==4.10.0 06:57:27 PyYAML==6.0.3 06:57:27 referencing==0.37.0 06:57:27 requests==2.34.2 06:57:27 requests-oauthlib==2.0.0 06:57:27 rfc3986==2.0.0 06:57:27 rich==15.0.0 06:57:27 rich-argparse==1.8.0 06:57:27 rpds-py==2026.5.1 06:57:27 rsa==4.9.1 06:57:27 ruamel.yaml==0.19.1 06:57:27 ruamel.yaml.clib==0.2.15 06:57:27 s3transfer==0.18.0 06:57:27 simplejson==4.1.1 06:57:27 six==1.17.0 06:57:27 smmap==5.0.3 06:57:27 soupsieve==2.8.4 06:57:27 stevedore==5.8.0 06:57:27 tabulate==0.10.0 06:57:27 toml==0.10.2 06:57:27 tomlkit==0.15.0 06:57:27 tqdm==4.67.3 06:57:27 typing_extensions==4.15.0 06:57:27 urllib3==1.26.20 06:57:27 virtualenv==21.4.2 06:57:27 wcwidth==0.7.0 06:57:27 websocket-client==1.9.0 06:57:27 wrapt==2.2.1 06:57:27 xdg==6.0.0 06:57:27 xmltodict==1.0.4 06:57:27 yarl==1.24.2 06:57:27 yq==3.4.3 06:57:27 [transportpce-tox-verify-transportpce-master] $ /bin/sh /tmp/jenkins13588373595164691843.sh 06:57:27 ---> uv-install.sh 06:57:27 Installing uv/uvx (latest) using shell installer 06:57:27 2026-06-05 06:57:27 URL:https://releases.astral.sh/installers/uv/latest/uv-installer.sh [71233/71233] -> "/tmp/uv-install-iHwYJY.sh" [1] 06:57:27 downloading uv 0.11.19 x86_64-unknown-linux-gnu 06:57:28 installing to /home/jenkins/.local/bin 06:57:28 uv 06:57:28 uvx 06:57:28 everything's installed! 06:57:28 06:57:28 To add $HOME/.local/bin to your PATH, either restart your shell or run: 06:57:28 06:57:28 source $HOME/.local/bin/env (sh, bash, zsh) 06:57:28 source $HOME/.local/bin/env.fish (fish) 06:57:28 Adding install location to PATH 06:57:28 ---> Validating uv/uvx install 06:57:28 uvx 0.11.19 (x86_64-unknown-linux-gnu) 06:57:28 [EnvInject] - Injecting environment variables from a build step. 06:57:28 [EnvInject] - Injecting as environment variables the properties content 06:57:28 PYTHON=python3 06:57:28 06:57:28 [EnvInject] - Variables injected successfully. 06:57:28 [transportpce-tox-verify-transportpce-master] $ /bin/bash -l /tmp/jenkins778095740998558277.sh 06:57:28 ---> tox-install.sh 06:57:28 + source /home/jenkins/lf-env.sh 06:57:28 + lf-activate-venv --venv-file /tmp/.toxenv tox virtualenv urllib3~=1.26.15 06:57:28 ++ mktemp -d /tmp/venv-XXXX 06:57:28 + lf_venv=/tmp/venv-9VeT 06:57:28 + local venv_file=/tmp/.os_lf_venv 06:57:28 + local python=python3 06:57:28 + local options 06:57:28 + local set_path=true 06:57:28 + local install_args= 06:57:28 ++ getopt -o np:v: -l no-path,system-site-packages,python:,venv-file: -n lf-activate-venv -- --venv-file /tmp/.toxenv tox virtualenv urllib3~=1.26.15 06:57:28 + options=' --venv-file '\''/tmp/.toxenv'\'' -- '\''tox'\'' '\''virtualenv'\'' '\''urllib3~=1.26.15'\''' 06:57:28 + eval set -- ' --venv-file '\''/tmp/.toxenv'\'' -- '\''tox'\'' '\''virtualenv'\'' '\''urllib3~=1.26.15'\''' 06:57:28 ++ set -- --venv-file /tmp/.toxenv -- tox virtualenv urllib3~=1.26.15 06:57:28 + true 06:57:28 + case $1 in 06:57:28 + venv_file=/tmp/.toxenv 06:57:28 + shift 2 06:57:28 + true 06:57:28 + case $1 in 06:57:28 + shift 06:57:28 + break 06:57:28 + case $python in 06:57:28 + local pkg_list= 06:57:28 + [[ -d /opt/pyenv ]] 06:57:28 + echo 'Setup pyenv:' 06:57:28 Setup pyenv: 06:57:28 + export PYENV_ROOT=/opt/pyenv 06:57:28 + PYENV_ROOT=/opt/pyenv 06:57:28 + export PATH=/opt/pyenv/bin:/home/jenkins/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 06:57:28 + PATH=/opt/pyenv/bin:/home/jenkins/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 06:57:28 + pyenv versions 06:57:28 system 06:57:28 3.8.20 06:57:28 3.9.20 06:57:28 3.10.15 06:57:28 * 3.11.10 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 06:57:28 + command -v pyenv 06:57:28 ++ pyenv init - --no-rehash 06:57:28 + eval 'PATH="$(bash --norc -ec '\''IFS=:; paths=($PATH); 06:57:28 for i in ${!paths[@]}; do 06:57:28 if [[ ${paths[i]} == "'\'''\''/opt/pyenv/shims'\'''\''" ]]; then unset '\''\'\'''\''paths[i]'\''\'\'''\''; 06:57:28 fi; done; 06:57:28 echo "${paths[*]}"'\'')" 06:57:28 export PATH="/opt/pyenv/shims:${PATH}" 06:57:28 export PYENV_SHELL=bash 06:57:28 source '\''/opt/pyenv/libexec/../completions/pyenv.bash'\'' 06:57:28 pyenv() { 06:57:28 local command 06:57:28 command="${1:-}" 06:57:28 if [ "$#" -gt 0 ]; then 06:57:28 shift 06:57:28 fi 06:57:28 06:57:28 case "$command" in 06:57:28 rehash|shell) 06:57:28 eval "$(pyenv "sh-$command" "$@")" 06:57:28 ;; 06:57:28 *) 06:57:28 command pyenv "$command" "$@" 06:57:28 ;; 06:57:28 esac 06:57:28 }' 06:57:28 +++ bash --norc -ec 'IFS=:; paths=($PATH); 06:57:28 for i in ${!paths[@]}; do 06:57:28 if [[ ${paths[i]} == "/opt/pyenv/shims" ]]; then unset '\''paths[i]'\''; 06:57:28 fi; done; 06:57:28 echo "${paths[*]}"' 06:57:28 ++ PATH=/opt/pyenv/bin:/home/jenkins/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 06:57:28 ++ export PATH=/opt/pyenv/shims:/opt/pyenv/bin:/home/jenkins/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 06:57:28 ++ PATH=/opt/pyenv/shims:/opt/pyenv/bin:/home/jenkins/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 06:57:28 ++ export PYENV_SHELL=bash 06:57:28 ++ PYENV_SHELL=bash 06:57:28 ++ source /opt/pyenv/libexec/../completions/pyenv.bash 06:57:28 +++ complete -F _pyenv pyenv 06:57:28 ++ lf-pyver python3 06:57:28 ++ local py_version_xy=python3 06:57:28 ++ local py_version_xyz= 06:57:28 ++ pyenv versions 06:57:28 ++ local command 06:57:28 ++ command=versions 06:57:28 ++ '[' 1 -gt 0 ']' 06:57:28 ++ shift 06:57:28 ++ case "$command" in 06:57:28 ++ command pyenv versions 06:57:28 ++ sed 's/^[ *]* //' 06:57:28 ++ awk '{ print $1 }' 06:57:28 ++ grep -E '^[0-9.]*[0-9]$' 06:57:28 ++ [[ ! -s /tmp/.pyenv_versions ]] 06:57:28 +++ grep '^3' /tmp/.pyenv_versions 06:57:28 +++ sort -V 06:57:28 +++ tail -n 1 06:57:28 ++ py_version_xyz=3.11.10 06:57:28 ++ [[ -z 3.11.10 ]] 06:57:28 ++ echo 3.11.10 06:57:28 ++ return 0 06:57:28 + pyenv local 3.11.10 06:57:28 + local command 06:57:28 + command=local 06:57:28 + '[' 2 -gt 0 ']' 06:57:28 + shift 06:57:28 + case "$command" in 06:57:28 + command pyenv local 3.11.10 06:57:28 + for arg in "$@" 06:57:28 + case $arg in 06:57:28 + pkg_list+='tox ' 06:57:28 + for arg in "$@" 06:57:28 + case $arg in 06:57:28 + pkg_list+='virtualenv ' 06:57:28 + for arg in "$@" 06:57:28 + case $arg in 06:57:28 + pkg_list+='urllib3~=1.26.15 ' 06:57:28 + [[ -f /tmp/.toxenv ]] 06:57:28 + [[ ! -f /tmp/.toxenv ]] 06:57:28 + [[ -n '' ]] 06:57:28 + python3 -m venv /tmp/venv-9VeT 06:57:32 + echo 'lf-activate-venv(): INFO: Creating python3 venv at /tmp/venv-9VeT' 06:57:32 lf-activate-venv(): INFO: Creating python3 venv at /tmp/venv-9VeT 06:57:32 + echo /tmp/venv-9VeT 06:57:32 + echo 'lf-activate-venv(): INFO: Save venv in file: /tmp/.toxenv' 06:57:32 lf-activate-venv(): INFO: Save venv in file: /tmp/.toxenv 06:57:32 + echo 'lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv)' 06:57:32 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 06:57:32 + local 'pip_opts=--upgrade --quiet' 06:57:32 + pip_opts='--upgrade --quiet --trusted-host pypi.org' 06:57:32 + pip_opts='--upgrade --quiet --trusted-host pypi.org --trusted-host files.pythonhosted.org' 06:57:32 + pip_opts='--upgrade --quiet --trusted-host pypi.org --trusted-host files.pythonhosted.org --trusted-host pypi.python.org' 06:57:32 + [[ -n '' ]] 06:57:32 + [[ -n '' ]] 06:57:32 + echo 'lf-activate-venv(): INFO: Attempting to install with network-safe options...' 06:57:32 lf-activate-venv(): INFO: Attempting to install with network-safe options... 06:57:32 + /tmp/venv-9VeT/bin/python3 -m pip install --upgrade --quiet --trusted-host pypi.org --trusted-host files.pythonhosted.org --trusted-host pypi.python.org pip 'setuptools<66' virtualenv 06:57:36 + echo 'lf-activate-venv(): INFO: Base packages installed successfully' 06:57:36 lf-activate-venv(): INFO: Base packages installed successfully 06:57:36 + [[ -z tox virtualenv urllib3~=1.26.15 ]] 06:57:36 + echo 'lf-activate-venv(): INFO: Installing additional packages: tox virtualenv urllib3~=1.26.15 ' 06:57:36 lf-activate-venv(): INFO: Installing additional packages: tox virtualenv urllib3~=1.26.15 06:57:36 + /tmp/venv-9VeT/bin/python3 -m pip install --upgrade --quiet --trusted-host pypi.org --trusted-host files.pythonhosted.org --trusted-host pypi.python.org --upgrade-strategy eager tox virtualenv urllib3~=1.26.15 06:57:38 + type python3 06:57:38 + true 06:57:38 + echo 'lf-activate-venv(): INFO: Adding /tmp/venv-9VeT/bin to PATH' 06:57:38 lf-activate-venv(): INFO: Adding /tmp/venv-9VeT/bin to PATH 06:57:38 + PATH=/tmp/venv-9VeT/bin:/opt/pyenv/shims:/opt/pyenv/bin:/home/jenkins/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 06:57:38 + return 0 06:57:38 + python3 --version 06:57:38 Python 3.11.10 06:57:38 + python3 -m pip --version 06:57:38 pip 26.1.2 from /tmp/venv-9VeT/lib/python3.11/site-packages/pip (python 3.11) 06:57:38 + python3 -m pip freeze 06:57:38 cachetools==7.1.4 06:57:38 colorama==0.4.6 06:57:38 distlib==0.4.1 06:57:38 filelock==3.29.1 06:57:38 packaging==26.2 06:57:38 platformdirs==4.10.0 06:57:38 pluggy==1.6.0 06:57:38 pyproject-api==1.10.1 06:57:38 python-discovery==1.4.0 06:57:38 tomli_w==1.2.0 06:57:38 tox==4.55.1 06:57:38 urllib3==1.26.20 06:57:38 virtualenv==21.4.2 06:57:39 [transportpce-tox-verify-transportpce-master] $ /bin/sh -xe /tmp/jenkins13129551788027771517.sh 06:57:39 [EnvInject] - Injecting environment variables from a build step. 06:57:39 [EnvInject] - Injecting as environment variables the properties content 06:57:39 PARALLEL=True 06:57:39 06:57:39 [EnvInject] - Variables injected successfully. 06:57:39 [transportpce-tox-verify-transportpce-master] $ /bin/bash -l /tmp/jenkins1210305760896343537.sh 06:57:39 ---> tox-run.sh 06:57:39 + PATH=/home/jenkins/.local/bin:/home/jenkins/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 06:57:39 + ARCHIVE_TOX_DIR=/w/workspace/transportpce-tox-verify-transportpce-master/archives/tox 06:57:39 + ARCHIVE_DOC_DIR=/w/workspace/transportpce-tox-verify-transportpce-master/archives/docs 06:57:39 + mkdir -p /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox 06:57:39 + cd /w/workspace/transportpce-tox-verify-transportpce-master/. 06:57:39 + source /home/jenkins/lf-env.sh 06:57:39 + lf-activate-venv --venv-file /tmp/.toxenv tox virtualenv urllib3~=1.26.15 06:57:39 ++ mktemp -d /tmp/venv-XXXX 06:57:39 + lf_venv=/tmp/venv-1xPc 06:57:39 + local venv_file=/tmp/.os_lf_venv 06:57:39 + local python=python3 06:57:39 + local options 06:57:39 + local set_path=true 06:57:39 + local install_args= 06:57:39 ++ getopt -o np:v: -l no-path,system-site-packages,python:,venv-file: -n lf-activate-venv -- --venv-file /tmp/.toxenv tox virtualenv urllib3~=1.26.15 06:57:39 + options=' --venv-file '\''/tmp/.toxenv'\'' -- '\''tox'\'' '\''virtualenv'\'' '\''urllib3~=1.26.15'\''' 06:57:39 + eval set -- ' --venv-file '\''/tmp/.toxenv'\'' -- '\''tox'\'' '\''virtualenv'\'' '\''urllib3~=1.26.15'\''' 06:57:39 ++ set -- --venv-file /tmp/.toxenv -- tox virtualenv urllib3~=1.26.15 06:57:39 + true 06:57:39 + case $1 in 06:57:39 + venv_file=/tmp/.toxenv 06:57:39 + shift 2 06:57:39 + true 06:57:39 + case $1 in 06:57:39 + shift 06:57:39 + break 06:57:39 + case $python in 06:57:39 + local pkg_list= 06:57:39 + [[ -d /opt/pyenv ]] 06:57:39 + echo 'Setup pyenv:' 06:57:39 Setup pyenv: 06:57:39 + export PYENV_ROOT=/opt/pyenv 06:57:39 + PYENV_ROOT=/opt/pyenv 06:57:39 + export PATH=/opt/pyenv/bin:/home/jenkins/.local/bin:/home/jenkins/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 06:57:39 + PATH=/opt/pyenv/bin:/home/jenkins/.local/bin:/home/jenkins/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 06:57:39 + pyenv versions 06:57:39 system 06:57:39 3.8.20 06:57:39 3.9.20 06:57:39 3.10.15 06:57:39 * 3.11.10 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 06:57:39 + command -v pyenv 06:57:39 ++ pyenv init - --no-rehash 06:57:39 + eval 'PATH="$(bash --norc -ec '\''IFS=:; paths=($PATH); 06:57:39 for i in ${!paths[@]}; do 06:57:39 if [[ ${paths[i]} == "'\'''\''/opt/pyenv/shims'\'''\''" ]]; then unset '\''\'\'''\''paths[i]'\''\'\'''\''; 06:57:39 fi; done; 06:57:39 echo "${paths[*]}"'\'')" 06:57:39 export PATH="/opt/pyenv/shims:${PATH}" 06:57:39 export PYENV_SHELL=bash 06:57:39 source '\''/opt/pyenv/libexec/../completions/pyenv.bash'\'' 06:57:39 pyenv() { 06:57:39 local command 06:57:39 command="${1:-}" 06:57:39 if [ "$#" -gt 0 ]; then 06:57:39 shift 06:57:39 fi 06:57:39 06:57:39 case "$command" in 06:57:39 rehash|shell) 06:57:39 eval "$(pyenv "sh-$command" "$@")" 06:57:39 ;; 06:57:39 *) 06:57:39 command pyenv "$command" "$@" 06:57:39 ;; 06:57:39 esac 06:57:39 }' 06:57:39 +++ bash --norc -ec 'IFS=:; paths=($PATH); 06:57:39 for i in ${!paths[@]}; do 06:57:39 if [[ ${paths[i]} == "/opt/pyenv/shims" ]]; then unset '\''paths[i]'\''; 06:57:39 fi; done; 06:57:39 echo "${paths[*]}"' 06:57:39 ++ PATH=/opt/pyenv/bin:/home/jenkins/.local/bin:/home/jenkins/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 06:57:39 ++ export PATH=/opt/pyenv/shims:/opt/pyenv/bin:/home/jenkins/.local/bin:/home/jenkins/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 06:57:39 ++ PATH=/opt/pyenv/shims:/opt/pyenv/bin:/home/jenkins/.local/bin:/home/jenkins/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 06:57:39 ++ export PYENV_SHELL=bash 06:57:39 ++ PYENV_SHELL=bash 06:57:39 ++ source /opt/pyenv/libexec/../completions/pyenv.bash 06:57:39 +++ complete -F _pyenv pyenv 06:57:39 ++ lf-pyver python3 06:57:39 ++ local py_version_xy=python3 06:57:39 ++ local py_version_xyz= 06:57:39 ++ pyenv versions 06:57:39 ++ local command 06:57:39 ++ command=versions 06:57:39 ++ '[' 1 -gt 0 ']' 06:57:39 ++ shift 06:57:39 ++ case "$command" in 06:57:39 ++ command pyenv versions 06:57:39 ++ sed 's/^[ *]* //' 06:57:39 ++ grep -E '^[0-9.]*[0-9]$' 06:57:39 ++ awk '{ print $1 }' 06:57:39 ++ [[ ! -s /tmp/.pyenv_versions ]] 06:57:39 +++ grep '^3' /tmp/.pyenv_versions 06:57:39 +++ sort -V 06:57:39 +++ tail -n 1 06:57:39 ++ py_version_xyz=3.11.10 06:57:39 ++ [[ -z 3.11.10 ]] 06:57:39 ++ echo 3.11.10 06:57:39 ++ return 0 06:57:39 + pyenv local 3.11.10 06:57:39 + local command 06:57:39 + command=local 06:57:39 + '[' 2 -gt 0 ']' 06:57:39 + shift 06:57:39 + case "$command" in 06:57:39 + command pyenv local 3.11.10 06:57:39 + for arg in "$@" 06:57:39 + case $arg in 06:57:39 + pkg_list+='tox ' 06:57:39 + for arg in "$@" 06:57:39 + case $arg in 06:57:39 + pkg_list+='virtualenv ' 06:57:39 + for arg in "$@" 06:57:39 + case $arg in 06:57:39 + pkg_list+='urllib3~=1.26.15 ' 06:57:39 + [[ -f /tmp/.toxenv ]] 06:57:39 ++ cat /tmp/.toxenv 06:57:39 + lf_venv=/tmp/venv-9VeT 06:57:39 + echo 'lf-activate-venv(): INFO: Reuse venv:/tmp/venv-9VeT from' file:/tmp/.toxenv 06:57:39 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-9VeT from file:/tmp/.toxenv 06:57:39 + echo 'lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv)' 06:57:39 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 06:57:39 + local 'pip_opts=--upgrade --quiet' 06:57:39 + pip_opts='--upgrade --quiet --trusted-host pypi.org' 06:57:39 + pip_opts='--upgrade --quiet --trusted-host pypi.org --trusted-host files.pythonhosted.org' 06:57:39 + pip_opts='--upgrade --quiet --trusted-host pypi.org --trusted-host files.pythonhosted.org --trusted-host pypi.python.org' 06:57:39 + [[ -n '' ]] 06:57:39 + [[ -n '' ]] 06:57:39 + echo 'lf-activate-venv(): INFO: Attempting to install with network-safe options...' 06:57:39 lf-activate-venv(): INFO: Attempting to install with network-safe options... 06:57:39 + /tmp/venv-9VeT/bin/python3 -m pip install --upgrade --quiet --trusted-host pypi.org --trusted-host files.pythonhosted.org --trusted-host pypi.python.org pip 'setuptools<66' virtualenv 06:57:40 + echo 'lf-activate-venv(): INFO: Base packages installed successfully' 06:57:40 lf-activate-venv(): INFO: Base packages installed successfully 06:57:40 + [[ -z tox virtualenv urllib3~=1.26.15 ]] 06:57:40 + echo 'lf-activate-venv(): INFO: Installing additional packages: tox virtualenv urllib3~=1.26.15 ' 06:57:40 lf-activate-venv(): INFO: Installing additional packages: tox virtualenv urllib3~=1.26.15 06:57:40 + /tmp/venv-9VeT/bin/python3 -m pip install --upgrade --quiet --trusted-host pypi.org --trusted-host files.pythonhosted.org --trusted-host pypi.python.org --upgrade-strategy eager tox virtualenv urllib3~=1.26.15 06:57:41 + type python3 06:57:41 + true 06:57:41 + echo 'lf-activate-venv(): INFO: Adding /tmp/venv-9VeT/bin to PATH' 06:57:41 lf-activate-venv(): INFO: Adding /tmp/venv-9VeT/bin to PATH 06:57:41 + PATH=/tmp/venv-9VeT/bin:/opt/pyenv/shims:/opt/pyenv/bin:/home/jenkins/.local/bin:/home/jenkins/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 06:57:41 + return 0 06:57:41 + [[ -d /opt/pyenv ]] 06:57:41 + echo '---> Setting up pyenv' 06:57:41 ---> Setting up pyenv 06:57:41 + export PYENV_ROOT=/opt/pyenv 06:57:41 + PYENV_ROOT=/opt/pyenv 06:57:41 + export PATH=/opt/pyenv/bin:/tmp/venv-9VeT/bin:/opt/pyenv/shims:/opt/pyenv/bin:/home/jenkins/.local/bin:/home/jenkins/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 06:57:41 + PATH=/opt/pyenv/bin:/tmp/venv-9VeT/bin:/opt/pyenv/shims:/opt/pyenv/bin:/home/jenkins/.local/bin:/home/jenkins/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 06:57:41 ++ pwd 06:57:41 + PYTHONPATH=/w/workspace/transportpce-tox-verify-transportpce-master 06:57:41 + export PYTHONPATH 06:57:41 + export TOX_TESTENV_PASSENV=PYTHONPATH 06:57:41 + TOX_TESTENV_PASSENV=PYTHONPATH 06:57:41 + tox --version 06:57:41 4.55.1 from /tmp/venv-9VeT/lib/python3.11/site-packages/tox/__init__.py 06:57:41 + PARALLEL=True 06:57:41 + TOX_OPTIONS_LIST= 06:57:41 + [[ -n '' ]] 06:57:41 + case ${PARALLEL,,} in 06:57:41 + TOX_OPTIONS_LIST=' --parallel auto --parallel-live' 06:57:41 + tox --parallel auto --parallel-live 06:57:41 + tee -a /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tox.log 06:57:43 docs-linkcheck: install_deps> python -I -m pip install -r docs/requirements.txt 06:57:43 checkbashisms: freeze> python -m pip freeze --all 06:57:43 buildcontroller: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 06:57:43 docs: install_deps> python -I -m pip install -r docs/requirements.txt 06:57:44 checkbashisms: pip==26.1.1,setuptools==82.0.1 06:57:44 checkbashisms: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./fixCIcentOS8reposMirrors.sh 06:57:44 checkbashisms: commands[1] /w/workspace/transportpce-tox-verify-transportpce-master/tests> sh -c 'command checkbashisms>/dev/null || sudo yum install -y devscripts-checkbashisms || sudo yum install -y devscripts-minimal || sudo yum install -y devscripts || sudo yum install -y https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/31/Everything/x86_64/os/Packages/d/devscripts-checkbashisms-2.19.6-2.fc31.x86_64.rpm || (echo "checkbashisms command not found - please install it (e.g. sudo apt-get install devscripts | yum install devscripts-minimal )" >&2 && exit 1)' 06:57:44 checkbashisms: commands[2] /w/workspace/transportpce-tox-verify-transportpce-master/tests> find . -not -path '*/\.*' -name '*.sh' -exec checkbashisms -f '{}' + 06:57:45 checkbashisms: OK ✔ in 3.3 seconds 06:57:45 pre-commit: install_deps> python -I -m pip install pre-commit 06:57:47 pre-commit: freeze> python -m pip freeze --all 06:57:48 pre-commit: cfgv==3.5.0,distlib==0.4.1,filelock==3.29.1,identify==2.6.19,nodeenv==1.10.0,pip==26.1.1,platformdirs==4.10.0,pre_commit==4.6.0,python-discovery==1.4.0,PyYAML==6.0.3,setuptools==82.0.1,virtualenv==21.4.2 06:57:48 pre-commit: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./fixCIcentOS8reposMirrors.sh 06:57:48 pre-commit: commands[1] /w/workspace/transportpce-tox-verify-transportpce-master/tests> sh -c 'which cpan || sudo yum install -y perl-CPAN || (echo "cpan command not found - please install it (e.g. sudo apt-get install perl-modules | yum install perl-CPAN )" >&2 && exit 1)' 06:57:48 /usr/bin/cpan 06:57:48 pre-commit: commands[2] /w/workspace/transportpce-tox-verify-transportpce-master/tests> pre-commit run --all-files --show-diff-on-failure 06:57:48 [INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks. 06:57:48 [INFO] Initializing environment for https://github.com/jorisroovers/gitlint. 06:57:49 [INFO] Initializing environment for https://github.com/jorisroovers/gitlint:./gitlint-core[trusted-deps]. 06:57:49 [INFO] Initializing environment for https://github.com/Lucas-C/pre-commit-hooks. 06:57:49 [INFO] Initializing environment for https://github.com/hhatto/autopep8. 06:57:50 buildcontroller: freeze> python -m pip freeze --all 06:57:50 buildcontroller: bcrypt==5.0.0,certifi==2026.5.20,cffi==2.0.0,charset-normalizer==3.4.7,cryptography==48.0.0,dict2xml==1.7.8,idna==3.18,iniconfig==2.3.0,invoke==3.0.3,lxml==6.1.1,netconf-client==3.6.0,packaging==26.2,paramiko==5.0.0,pip==26.1.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.20.0,PyNaCl==1.6.2,pytest==9.0.3,requests==2.34.2,setuptools==82.0.1,urllib3==2.7.0 06:57:50 buildcontroller: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_controller.sh 06:57:50 + update-java-alternatives -l 06:57:50 java-1.11.0-openjdk-amd64 1111 /usr/lib/jvm/java-1.11.0-openjdk-amd64 06:57:50 java-1.17.0-openjdk-amd64 1711 /usr/lib/jvm/java-1.17.0-openjdk-amd64 06:57:50 java-1.21.0-openjdk-amd64 2111 /usr/lib/jvm/java-1.21.0-openjdk-amd64 06:57:50 + sudo update-java-alternatives -s java-1.21.0-openjdk-amd64 06:57:50 update-alternatives: error: no alternatives for jaotc 06:57:50 [INFO] Initializing environment for https://github.com/perltidy/perltidy. 06:57:50 update-alternatives: error: no alternatives for rmic 06:57:50 + + sed -n ;s/.* version "\(.*\)\.\(.*\)\..*".*$/\1/p; 06:57:50 java -version 06:57:50 + JAVA_VER=21 06:57:50 + echo 21 06:57:50 21 06:57:50 + javac -version 06:57:50 + sed -n ;s/javac \(.*\)\.\(.*\)\..*.*$/\1/p; 06:57:51 + JAVAC_VER=21 06:57:51 + echo 21 06:57:51 + [ 21 -ge 21 ] 06:57:51 21 06:57:51 ok, java is 21 or newer 06:57:51 + [ 21 -ge 21 ] 06:57:51 + echo ok, java is 21 or newer 06:57:51 + wget -nv https://dlcdn.apache.org/maven/maven-3/3.9.16/binaries/apache-maven-3.9.16-bin.tar.gz -P /tmp 06:57:51 [INFO] Initializing environment for https://github.com/koalaman/shellcheck-precommit. 06:57:51 [INFO] Initializing environment for https://github.com/pre-commit/mirrors-prettier. 06:57:52 [INFO] Initializing environment for https://github.com/pre-commit/mirrors-prettier:prettier@4.0.0-alpha.8. 06:57:52 [INFO] Initializing environment for https://github.com/adrienverge/yamllint. 06:57:52 2026-06-05 06:57:52 URL:https://dlcdn.apache.org/maven/maven-3/3.9.16/binaries/apache-maven-3.9.16-bin.tar.gz [9278065/9278065] -> "/tmp/apache-maven-3.9.16-bin.tar.gz" [1] 06:57:52 + sudo mkdir -p /opt 06:57:52 + sudo tar xf /tmp/apache-maven-3.9.16-bin.tar.gz -C /opt 06:57:52 + sudo ln -s /opt/apache-maven-3.9.16 /opt/maven 06:57:52 + sudo ln -s /opt/maven/bin/mvn /usr/bin/mvn 06:57:52 + mvn --version 06:57:52 [INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks. 06:57:52 [INFO] Once installed this environment will be reused. 06:57:52 [INFO] This may take a few minutes... 06:57:52 Apache Maven 3.9.16 (2bdd9fddda4b155ebf8000e807eb73fd829a51d5) 06:57:52 Maven home: /opt/maven 06:57:52 Java version: 21.0.10, vendor: Ubuntu, runtime: /usr/lib/jvm/java-21-openjdk-amd64 06:57:52 Default locale: en, platform encoding: UTF-8 06:57:52 OS name: "linux", version: "5.15.0-174-generic", arch: "amd64", family: "unix" 06:57:52 NOTE: Picked up JDK_JAVA_OPTIONS: 06:57:52 --add-opens=java.base/java.io=ALL-UNNAMED 06:57:52 --add-opens=java.base/java.lang=ALL-UNNAMED 06:57:52 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 06:57:52 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 06:57:52 --add-opens=java.base/java.net=ALL-UNNAMED 06:57:52 --add-opens=java.base/java.nio=ALL-UNNAMED 06:57:52 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 06:57:52 --add-opens=java.base/java.nio.file=ALL-UNNAMED 06:57:52 --add-opens=java.base/java.util=ALL-UNNAMED 06:57:52 --add-opens=java.base/java.util.jar=ALL-UNNAMED 06:57:52 --add-opens=java.base/java.util.stream=ALL-UNNAMED 06:57:52 --add-opens=java.base/java.util.zip=ALL-UNNAMED 06:57:52 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 06:57:52 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 06:57:52 -Xlog:disable 06:57:59 [INFO] Installing environment for https://github.com/Lucas-C/pre-commit-hooks. 06:57:59 [INFO] Once installed this environment will be reused. 06:57:59 [INFO] This may take a few minutes... 06:58:06 [INFO] Installing environment for https://github.com/hhatto/autopep8. 06:58:06 [INFO] Once installed this environment will be reused. 06:58:06 [INFO] This may take a few minutes... 06:58:11 docs: freeze> python -m pip freeze --all 06:58:11 docs-linkcheck: freeze> python -m pip freeze --all 06:58:11 docs: alabaster==1.0.0,attrs==26.1.0,babel==2.18.0,blockdiag==3.0.0,certifi==2026.5.20,charset-normalizer==3.4.7,contourpy==1.3.3,cycler==0.12.1,docutils==0.21.2,fonttools==4.63.0,funcparserlib==2.0.0a0,future==1.0.0,idna==3.18,imagesize==2.0.0,Jinja2==3.1.6,jsonschema==3.2.0,kiwisolver==1.5.0,lfdocs_conf==0.10.0,MarkupSafe==3.0.3,matplotlib==3.10.9,numpy==2.4.6,nwdiag==3.0.0,packaging==26.2,pillow==12.2.0,pip==26.1.1,Pygments==2.20.0,pyparsing==3.3.2,pyrsistent==0.20.0,python-dateutil==2.9.0.post0,PyYAML==6.0.3,requests==2.34.2,requests-file==1.5.1,roman-numerals==4.1.0,roman-numerals-py==4.1.0,seqdiag==3.0.0,setuptools==82.0.1,six==1.17.0,snowballstemmer==3.1.1,Sphinx==8.2.3,sphinx-bootstrap-theme==0.8.1,sphinx-data-viewer==0.1.5,sphinx-tabs==3.5.0,sphinx_rtd_theme==3.1.0,sphinxcontrib-applehelp==2.0.0,sphinxcontrib-blockdiag==3.0.0,sphinxcontrib-devhelp==2.0.0,sphinxcontrib-htmlhelp==2.1.0,sphinxcontrib-jquery==4.1,sphinxcontrib-jsmath==1.0.1,sphinxcontrib-needs==0.7.9,sphinxcontrib-nwdiag==2.0.0,sphinxcontrib-plantuml==0.31,sphinxcontrib-qthelp==2.0.0,sphinxcontrib-seqdiag==3.0.0,sphinxcontrib-serializinghtml==2.0.0,sphinxcontrib-swaggerdoc==0.1.7,urllib3==2.7.0,webcolors==25.10.0 06:58:11 docs: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> sphinx-build -q -W --keep-going -b html -n -d /w/workspace/transportpce-tox-verify-transportpce-master/.tox/docs/tmp/doctrees ../docs/ /w/workspace/transportpce-tox-verify-transportpce-master/docs/_build/html 06:58:12 [INFO] Installing environment for https://github.com/perltidy/perltidy. 06:58:12 [INFO] Once installed this environment will be reused. 06:58:12 [INFO] This may take a few minutes... 06:58:12 docs-linkcheck: alabaster==1.0.0,attrs==26.1.0,babel==2.18.0,blockdiag==3.0.0,certifi==2026.5.20,charset-normalizer==3.4.7,contourpy==1.3.3,cycler==0.12.1,docutils==0.21.2,fonttools==4.63.0,funcparserlib==2.0.0a0,future==1.0.0,idna==3.18,imagesize==2.0.0,Jinja2==3.1.6,jsonschema==3.2.0,kiwisolver==1.5.0,lfdocs_conf==0.10.0,MarkupSafe==3.0.3,matplotlib==3.10.9,numpy==2.4.6,nwdiag==3.0.0,packaging==26.2,pillow==12.2.0,pip==26.1.1,Pygments==2.20.0,pyparsing==3.3.2,pyrsistent==0.20.0,python-dateutil==2.9.0.post0,PyYAML==6.0.3,requests==2.34.2,requests-file==1.5.1,roman-numerals==4.1.0,roman-numerals-py==4.1.0,seqdiag==3.0.0,setuptools==82.0.1,six==1.17.0,snowballstemmer==3.1.1,Sphinx==8.2.3,sphinx-bootstrap-theme==0.8.1,sphinx-data-viewer==0.1.5,sphinx-tabs==3.5.0,sphinx_rtd_theme==3.1.0,sphinxcontrib-applehelp==2.0.0,sphinxcontrib-blockdiag==3.0.0,sphinxcontrib-devhelp==2.0.0,sphinxcontrib-htmlhelp==2.1.0,sphinxcontrib-jquery==4.1,sphinxcontrib-jsmath==1.0.1,sphinxcontrib-needs==0.7.9,sphinxcontrib-nwdiag==2.0.0,sphinxcontrib-plantuml==0.31,sphinxcontrib-qthelp==2.0.0,sphinxcontrib-seqdiag==3.0.0,sphinxcontrib-serializinghtml==2.0.0,sphinxcontrib-swaggerdoc==0.1.7,urllib3==2.7.0,webcolors==25.10.0 06:58:12 docs-linkcheck: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> sphinx-build -q -b linkcheck -d /w/workspace/transportpce-tox-verify-transportpce-master/.tox/docs-linkcheck/tmp/doctrees ../docs/ /w/workspace/transportpce-tox-verify-transportpce-master/docs/_build/linkcheck 06:58:15 docs: OK ✔ in 32.87 seconds 06:58:15 pylint: install_deps> python -I -m pip install 'pylint>=2.6.0' 06:58:19 pylint: freeze> python -m pip freeze --all 06:58:19 pylint: astroid==4.0.4,dill==0.4.1,isort==8.0.1,mccabe==0.7.0,pip==26.1.1,platformdirs==4.10.0,pylint==4.0.5,setuptools==82.0.1,tomlkit==0.15.0 06:58:19 pylint: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> find transportpce_tests/ -name '*.py' -exec pylint --fail-under=10 --max-line-length=120 --disable=missing-docstring,import-error --disable=fixme --disable=duplicate-code '--module-rgx=([a-z0-9_]+$)|([0-9.]{1,30}$)' '--method-rgx=(([a-z_][a-zA-Z0-9_]{2,})|(_[a-z0-9_]*)|(__[a-zA-Z][a-zA-Z0-9_]+__))$' '--variable-rgx=[a-zA-Z_][a-zA-Z0-9_]{1,30}$' '{}' + 06:58:25 [INFO] Installing environment for https://github.com/pre-commit/mirrors-prettier. 06:58:25 [INFO] Once installed this environment will be reused. 06:58:25 [INFO] This may take a few minutes... 06:58:29 [INFO] Installing environment for https://github.com/adrienverge/yamllint. 06:58:29 [INFO] Once installed this environment will be reused. 06:58:29 [INFO] This may take a few minutes... 06:58:34 trim trailing whitespace.................................................Passed 06:58:34 fix end of files.........................................................Passed 06:58:34 check for added large files..............................................Passed 06:58:35 check for merge conflicts................................................Passed 06:58:35 check for case conflicts.................................................Passed 06:58:35 check json...............................................................Passed 06:58:35 mixed line ending........................................................Passed 06:58:36 Tabs remover.............................................................Passed 06:58:36 autopep8.................................................................Passed 06:58:40 perltidy.................................................................Passed 06:58:41 ShellCheck v0.11.0.......................................................Passed 06:58:45 prettier.................................................................Passed 06:58:47 yamllint.................................................................Passed 06:58:48 docs-linkcheck: OK ✔ in 37.47 seconds 06:58:48 pre-commit: commands[3] /w/workspace/transportpce-tox-verify-transportpce-master/tests> pre-commit run gitlint-ci --hook-stage manual 06:58:48 [INFO] Installing environment for https://github.com/jorisroovers/gitlint. 06:58:48 [INFO] Once installed this environment will be reused. 06:58:48 [INFO] This may take a few minutes... 06:58:48 06:58:48 ------------------------------------ 06:58:48 Your code has been rated at 10.00/10 06:58:48 06:58:58 gitlint..................................................................Passed 06:59:38 pylint: OK ✔ in 36.36 seconds 06:59:38 pre-commit: OK ✔ in 1 minute 12.86 seconds 06:59:38 buildcontroller: OK ✔ in 1 minute 55.95 seconds 06:59:38 build_karaf_tests121: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 06:59:38 build_karaf_tests71: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 06:59:38 build_karaf_tests221: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 06:59:38 build_karaf_tests200: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 06:59:45 build_karaf_tests71: freeze> python -m pip freeze --all 06:59:45 build_karaf_tests221: freeze> python -m pip freeze --all 06:59:45 build_karaf_tests200: freeze> python -m pip freeze --all 06:59:45 build_karaf_tests121: freeze> python -m pip freeze --all 06:59:45 build_karaf_tests71: bcrypt==5.0.0,certifi==2026.5.20,cffi==2.0.0,charset-normalizer==3.4.7,cryptography==48.0.0,dict2xml==1.7.8,idna==3.18,iniconfig==2.3.0,invoke==3.0.3,lxml==6.1.1,netconf-client==3.6.0,packaging==26.2,paramiko==5.0.0,pip==26.1.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.20.0,PyNaCl==1.6.2,pytest==9.0.3,requests==2.34.2,setuptools==82.0.1,urllib3==2.7.0 06:59:45 build_karaf_tests71: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_karaf_for_tests.sh 06:59:45 build karaf in karaf71 with ./karaf71.env 06:59:45 build_karaf_tests221: bcrypt==5.0.0,certifi==2026.5.20,cffi==2.0.0,charset-normalizer==3.4.7,cryptography==48.0.0,dict2xml==1.7.8,idna==3.18,iniconfig==2.3.0,invoke==3.0.3,lxml==6.1.1,netconf-client==3.6.0,packaging==26.2,paramiko==5.0.0,pip==26.1.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.20.0,PyNaCl==1.6.2,pytest==9.0.3,requests==2.34.2,setuptools==82.0.1,urllib3==2.7.0 06:59:45 build_karaf_tests221: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_karaf_for_tests.sh 06:59:45 build karaf in karaf221 with ./karaf221.env 06:59:45 build_karaf_tests200: bcrypt==5.0.0,certifi==2026.5.20,cffi==2.0.0,charset-normalizer==3.4.7,cryptography==48.0.0,dict2xml==1.7.8,idna==3.18,iniconfig==2.3.0,invoke==3.0.3,lxml==6.1.1,netconf-client==3.6.0,packaging==26.2,paramiko==5.0.0,pip==26.1.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.20.0,PyNaCl==1.6.2,pytest==9.0.3,requests==2.34.2,setuptools==82.0.1,urllib3==2.7.0 06:59:45 build_karaf_tests200: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_karaf_for_tests.sh 06:59:45 NOTE: Picked up JDK_JAVA_OPTIONS: 06:59:45 --add-opens=java.base/java.io=ALL-UNNAMED 06:59:45 --add-opens=java.base/java.lang=ALL-UNNAMED 06:59:45 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 06:59:45 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 06:59:45 --add-opens=java.base/java.net=ALL-UNNAMED 06:59:45 --add-opens=java.base/java.nio=ALL-UNNAMED 06:59:45 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 06:59:45 --add-opens=java.base/java.nio.file=ALL-UNNAMED 06:59:45 --add-opens=java.base/java.util=ALL-UNNAMED 06:59:45 --add-opens=java.base/java.util.jar=ALL-UNNAMED 06:59:45 --add-opens=java.base/java.util.stream=ALL-UNNAMED 06:59:45 --add-opens=java.base/java.util.zip=ALL-UNNAMED 06:59:45 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 06:59:45 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 06:59:45 -Xlog:disable 06:59:45 build karaf in karafoc200 with ./karafoc200.env 06:59:45 build_karaf_tests121: bcrypt==5.0.0,certifi==2026.5.20,cffi==2.0.0,charset-normalizer==3.4.7,cryptography==48.0.0,dict2xml==1.7.8,idna==3.18,iniconfig==2.3.0,invoke==3.0.3,lxml==6.1.1,netconf-client==3.6.0,packaging==26.2,paramiko==5.0.0,pip==26.1.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.20.0,PyNaCl==1.6.2,pytest==9.0.3,requests==2.34.2,setuptools==82.0.1,urllib3==2.7.0 06:59:45 build_karaf_tests121: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_karaf_for_tests.sh 06:59:45 build karaf in karaf121 with ./karaf121.env 06:59:46 NOTE: Picked up JDK_JAVA_OPTIONS: 06:59:46 --add-opens=java.base/java.io=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.lang=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.net=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.nio=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.nio.file=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.util=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.util.jar=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.util.stream=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.util.zip=ALL-UNNAMED 06:59:46 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 06:59:46 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 06:59:46 -Xlog:disable 06:59:46 NOTE: Picked up JDK_JAVA_OPTIONS: 06:59:46 --add-opens=java.base/java.io=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.lang=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.net=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.nio=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.nio.file=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.util=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.util.jar=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.util.stream=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.util.zip=ALL-UNNAMED 06:59:46 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 06:59:46 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 06:59:46 -Xlog:disable 06:59:46 NOTE: Picked up JDK_JAVA_OPTIONS: 06:59:46 --add-opens=java.base/java.io=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.lang=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.net=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.nio=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.nio.file=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.util=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.util.jar=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.util.stream=ALL-UNNAMED 06:59:46 --add-opens=java.base/java.util.zip=ALL-UNNAMED 06:59:46 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 06:59:46 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 06:59:46 -Xlog:disable 07:00:40 build_karaf_tests121: OK ✔ in 1 minute 2.52 seconds 07:00:40 build_karaf_tests71: OK ✔ in 1 minute 2.52 seconds 07:00:40 build_karaf_tests200: OK ✔ in 1 minute 2.54 seconds 07:00:40 buildlighty: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 07:00:40 sims: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 07:00:41 build_karaf_tests221: OK ✔ in 1 minute 3.02 seconds 07:00:41 testsPCE: install_deps> python -I -m pip install gnpy4tpce==2.4.7 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 07:00:48 sims: freeze> python -m pip freeze --all 07:00:48 buildlighty: freeze> python -m pip freeze --all 07:00:48 buildlighty: bcrypt==5.0.0,certifi==2026.5.20,cffi==2.0.0,charset-normalizer==3.4.7,cryptography==48.0.0,dict2xml==1.7.8,idna==3.18,iniconfig==2.3.0,invoke==3.0.3,lxml==6.1.1,netconf-client==3.6.0,packaging==26.2,paramiko==5.0.0,pip==26.1.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.20.0,PyNaCl==1.6.2,pytest==9.0.3,requests==2.34.2,setuptools==82.0.1,urllib3==2.7.0 07:00:48 buildlighty: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/lighty> ./build.sh 07:00:48 sims: bcrypt==5.0.0,certifi==2026.5.20,cffi==2.0.0,charset-normalizer==3.4.7,cryptography==48.0.0,dict2xml==1.7.8,idna==3.18,iniconfig==2.3.0,invoke==3.0.3,lxml==6.1.1,netconf-client==3.6.0,packaging==26.2,paramiko==5.0.0,pip==26.1.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.20.0,PyNaCl==1.6.2,pytest==9.0.3,requests==2.34.2,setuptools==82.0.1,urllib3==2.7.0 07:00:48 sims: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./install_lightynode.sh 07:00:48 Using lighynode version 22.1.0.7 07:00:48 Installing lightynode device to ./lightynode/lightynode-openroadm-device directory 07:00:48 NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED 07:00:51 sims: OK ✔ in 10.83 seconds 07:00:51 tests71: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 07:00:57 tests71: freeze> python -m pip freeze --all 07:00:57 tests71: bcrypt==5.0.0,certifi==2026.5.20,cffi==2.0.0,charset-normalizer==3.4.7,cryptography==48.0.0,dict2xml==1.7.8,idna==3.18,iniconfig==2.3.0,invoke==3.0.3,lxml==6.1.1,netconf-client==3.6.0,packaging==26.2,paramiko==5.0.0,pip==26.1.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.20.0,PyNaCl==1.6.2,pytest==9.0.3,requests==2.34.2,setuptools==82.0.1,urllib3==2.7.0 07:00:57 tests71: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh 7.1 07:00:57 using environment variables from ./karaf71.env 07:00:57 pytest -q transportpce_tests/7.1/test01_portmapping.py 07:01:35 buildlighty: OK ✔ in 41.43 seconds 07:01:35 testsPCE: freeze> python -m pip freeze --all 07:01:35 testsPCE: bcrypt==5.0.0,certifi==2026.5.20,cffi==2.0.0,charset-normalizer==3.4.7,click==8.4.1,contourpy==1.3.3,cryptography==3.3.2,cycler==0.12.1,dict2xml==1.7.8,Flask==2.1.3,Flask-Injector==0.14.0,fonttools==4.63.0,gnpy4tpce==2.4.7,idna==3.18,iniconfig==2.3.0,injector==0.24.0,invoke==3.0.3,itsdangerous==2.2.0,Jinja2==3.1.6,kiwisolver==1.5.0,lxml==6.1.1,MarkupSafe==3.0.3,matplotlib==3.10.9,netconf-client==3.6.0,networkx==2.8.8,numpy==1.26.4,packaging==26.2,pandas==1.5.3,paramiko==5.0.0,pbr==5.11.1,pillow==12.2.0,pip==26.1.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.20.0,PyNaCl==1.6.2,pyparsing==3.3.2,pytest==9.0.3,python-dateutil==2.9.0.post0,pytz==2026.2,requests==2.34.2,scipy==1.17.1,setuptools==50.3.2,six==1.17.0,urllib3==2.7.0,Werkzeug==2.0.3,xlrd==1.2.0 07:01:35 testsPCE: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh pce 07:01:35 pytest -q transportpce_tests/pce/test01_pce.py 07:01:42 ............ [100%] 07:01:55 12 passed in 57.07s 07:01:55 pytest -q transportpce_tests/7.1/test02_otn_renderer.py 07:02:35 ................................................... [100%] 07:03:41 20 passed in 125.48s (0:02:05) 07:03:41 .pytest -q transportpce_tests/pce/test02_pce_400G.py 07:03:43 ................................... [100%] 07:04:30 12 passed in 48.92s 07:04:30 pytest -q transportpce_tests/pce/test03_gnpy.py 07:04:32 ....... [100%] 07:04:46 62 passed in 170.66s (0:02:50) 07:04:46 pytest -q transportpce_tests/7.1/test03_renderer_or_modes.py 07:04:49 ........ [100%] 07:05:11 8 passed in 40.40s 07:05:11 pytest -q transportpce_tests/pce/test04_pce_bug_fix.py 07:05:21 ................ [100%] 07:05:52 3 passed in 40.46s 07:05:53 testsPCE: OK ✔ in 5 minutes 11.39 seconds 07:05:53 tests_tapi: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 07:05:53 tests200: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 07:05:53 tests121: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 07:05:53 ....tests121: freeze> python -m pip freeze --all 07:06:00 tests200: freeze> python -m pip freeze --all 07:06:00 tests_tapi: freeze> python -m pip freeze --all 07:06:00 tests121: bcrypt==5.0.0,certifi==2026.5.20,cffi==2.0.0,charset-normalizer==3.4.7,cryptography==48.0.0,dict2xml==1.7.8,idna==3.18,iniconfig==2.3.0,invoke==3.0.3,lxml==6.1.1,netconf-client==3.6.0,packaging==26.2,paramiko==5.0.0,pip==26.1.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.20.0,PyNaCl==1.6.2,pytest==9.0.3,requests==2.34.2,setuptools==82.0.1,urllib3==2.7.0 07:06:00 tests121: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh 1.2.1 07:06:00 using environment variables from ./karaf121.env 07:06:00 pytest -q transportpce_tests/1.2.1/test01_portmapping.py 07:06:00 tests_tapi: bcrypt==5.0.0,certifi==2026.5.20,cffi==2.0.0,charset-normalizer==3.4.7,cryptography==48.0.0,dict2xml==1.7.8,idna==3.18,iniconfig==2.3.0,invoke==3.0.3,lxml==6.1.1,netconf-client==3.6.0,packaging==26.2,paramiko==5.0.0,pip==26.1.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.20.0,PyNaCl==1.6.2,pytest==9.0.3,requests==2.34.2,setuptools==82.0.1,urllib3==2.7.0 07:06:00 tests_tapi: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh tapi 07:06:00 using environment variables from ./karaf221.env 07:06:00 pytest -q transportpce_tests/tapi/test01_abstracted_topology.py 07:06:00 tests200: bcrypt==5.0.0,certifi==2026.5.20,cffi==2.0.0,charset-normalizer==3.4.7,cryptography==48.0.0,dict2xml==1.7.8,idna==3.18,iniconfig==2.3.0,invoke==3.0.3,lxml==6.1.1,netconf-client==3.6.0,packaging==26.2,paramiko==5.0.0,pip==26.1.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.20.0,PyNaCl==1.6.2,pytest==9.0.3,requests==2.34.2,setuptools==82.0.1,urllib3==2.7.0 07:06:00 tests200: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh oc200 07:06:00 using environment variables from ./karafoc200.env 07:06:00 pytest -q transportpce_tests/oc200/test01_portmapping.py 07:06:01 ............................... [100%] 07:07:10 48 passed in 143.95s (0:02:23) 07:07:10 pytest -q transportpce_tests/7.1/test04_renderer_regen_mode.py 07:07:11 .......... [100%] 07:07:36 10 passed in 95.35s (0:01:35) 07:07:36 pytest -q transportpce_tests/oc200/test02_topology.py 07:08:05 ................................................................. [100%] 07:08:54 22 passed in 103.00s (0:01:42) 07:08:55 . [100%] 07:08:57 14 passed in 80.60s (0:01:20) 07:08:57 pytest -q transportpce_tests/oc200/test03_renderer.py 07:09:13 ....................... [100%] 07:09:48 16 passed in 51.26s 07:09:58 ..F......FFFFFFFFFFFFFFFFFFF [100%] 07:10:42 =================================== FAILURES =================================== 07:10:42 ___________ TestTransportPCEPortmapping.test_02_rdm_device_connected ___________ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01?content=nonconfig' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01?content=nonconfig' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01?content=nonconfig (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_02_rdm_device_connected(self): 07:10:42 > response = test_utils.check_device_connection("ROADMA01") 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:54: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:409: in check_device_connection 07:10:42 response = get_request(url[RESTCONF_VERSION].format('{}', node)) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:117: in get_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01?content=nonconfig (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_02_rdm_device_connected 07:10:42 ___________ TestTransportPCEPortmapping.test_03_rdm_portmapping_info ___________ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/node-info' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/node-info' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=ROADMA01/node-info (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_03_rdm_portmapping_info(self): 07:10:42 > response = test_utils.get_portmapping_node_attr("ROADMA01", "node-info", None) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:60: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 07:10:42 response = get_request(target_url) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:117: in get_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=ROADMA01/node-info (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_03_rdm_portmapping_info 07:10:42 ______ TestTransportPCEPortmapping.test_04_rdm_portmapping_DEG1_TTP_TXRX _______ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=DEG1-TTP-TXRX' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=DEG1-TTP-TXRX' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=DEG1-TTP-TXRX (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_04_rdm_portmapping_DEG1_TTP_TXRX(self): 07:10:42 > response = test_utils.get_portmapping_node_attr("ROADMA01", "mapping", "DEG1-TTP-TXRX") 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:73: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 07:10:42 response = get_request(target_url) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:117: in get_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=DEG1-TTP-TXRX (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_04_rdm_portmapping_DEG1_TTP_TXRX 07:10:42 ______ TestTransportPCEPortmapping.test_05_rdm_portmapping_SRG1_PP7_TXRX _______ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=SRG1-PP7-TXRX' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=SRG1-PP7-TXRX' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=SRG1-PP7-TXRX (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_05_rdm_portmapping_SRG1_PP7_TXRX(self): 07:10:42 > response = test_utils.get_portmapping_node_attr("ROADMA01", "mapping", "SRG1-PP7-TXRX") 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:82: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 07:10:42 response = get_request(target_url) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:117: in get_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=SRG1-PP7-TXRX (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_05_rdm_portmapping_SRG1_PP7_TXRX 07:10:42 ______ TestTransportPCEPortmapping.test_06_rdm_portmapping_SRG3_PP1_TXRX _______ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=SRG3-PP1-TXRX' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=SRG3-PP1-TXRX' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=SRG3-PP1-TXRX (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_06_rdm_portmapping_SRG3_PP1_TXRX(self): 07:10:42 > response = test_utils.get_portmapping_node_attr("ROADMA01", "mapping", "SRG3-PP1-TXRX") 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:91: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 07:10:42 response = get_request(target_url) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:117: in get_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=SRG3-PP1-TXRX (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_06_rdm_portmapping_SRG3_PP1_TXRX 07:10:42 __________ TestTransportPCEPortmapping.test_07_xpdr_device_connection __________ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'PUT' 07:10:42 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01' 07:10:42 body = '{"node": [{"node-id": "XPDRA01", "netconf-node-topology:netconf-node": {"netconf-node-topology:host": "127.0.0.1", "n...ff-millis": 1800000, "netconf-node-topology:backoff-multiplier": 1.5, "netconf-node-topology:keepalive-delay": 120}}]}' 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '709', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'PUT' 07:10:42 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01 (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_07_xpdr_device_connection(self): 07:10:42 > response = test_utils.mount_device("XPDRA01", ('xpdra', self.NODE_VERSION)) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:100: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:381: in mount_device 07:10:42 response = put_request(url[RESTCONF_VERSION].format('{}', node), body) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:125: in put_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01 (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_07_xpdr_device_connection 07:10:42 __________ TestTransportPCEPortmapping.test_08_xpdr_device_connected ___________ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01?content=nonconfig' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01?content=nonconfig' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01?content=nonconfig (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_08_xpdr_device_connected(self): 07:10:42 > response = test_utils.check_device_connection("XPDRA01") 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:104: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:409: in check_device_connection 07:10:42 response = get_request(url[RESTCONF_VERSION].format('{}', node)) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:117: in get_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01?content=nonconfig (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_08_xpdr_device_connected 07:10:42 __________ TestTransportPCEPortmapping.test_09_xpdr_portmapping_info ___________ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/node-info' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/node-info' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=XPDRA01/node-info (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_09_xpdr_portmapping_info(self): 07:10:42 > response = test_utils.get_portmapping_node_attr("XPDRA01", "node-info", None) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:110: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 07:10:42 response = get_request(target_url) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:117: in get_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=XPDRA01/node-info (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_09_xpdr_portmapping_info 07:10:42 ________ TestTransportPCEPortmapping.test_10_xpdr_portmapping_NETWORK1 _________ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-NETWORK1' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-NETWORK1' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-NETWORK1 (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_10_xpdr_portmapping_NETWORK1(self): 07:10:42 > response = test_utils.get_portmapping_node_attr("XPDRA01", "mapping", "XPDR1-NETWORK1") 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:123: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 07:10:42 response = get_request(target_url) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:117: in get_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-NETWORK1 (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_10_xpdr_portmapping_NETWORK1 07:10:42 ________ TestTransportPCEPortmapping.test_11_xpdr_portmapping_NETWORK2 _________ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-NETWORK2' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-NETWORK2' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-NETWORK2 (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_11_xpdr_portmapping_NETWORK2(self): 07:10:42 > response = test_utils.get_portmapping_node_attr("XPDRA01", "mapping", "XPDR1-NETWORK2") 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:135: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 07:10:42 response = get_request(target_url) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:117: in get_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-NETWORK2 (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_11_xpdr_portmapping_NETWORK2 07:10:42 _________ TestTransportPCEPortmapping.test_12_xpdr_portmapping_CLIENT1 _________ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT1' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT1' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT1 (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_12_xpdr_portmapping_CLIENT1(self): 07:10:42 > response = test_utils.get_portmapping_node_attr("XPDRA01", "mapping", "XPDR1-CLIENT1") 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:147: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 07:10:42 response = get_request(target_url) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:117: in get_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT1 (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_12_xpdr_portmapping_CLIENT1 07:10:42 _________ TestTransportPCEPortmapping.test_13_xpdr_portmapping_CLIENT2 _________ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT2' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT2' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT2 (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_13_xpdr_portmapping_CLIENT2(self): 07:10:42 > response = test_utils.get_portmapping_node_attr("XPDRA01", "mapping", "XPDR1-CLIENT2") 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:159: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 07:10:42 response = get_request(target_url) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:117: in get_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT2 (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_13_xpdr_portmapping_CLIENT2 07:10:42 _________ TestTransportPCEPortmapping.test_14_xpdr_portmapping_CLIENT3 _________ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT3' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT3' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT3 (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_14_xpdr_portmapping_CLIENT3(self): 07:10:42 > response = test_utils.get_portmapping_node_attr("XPDRA01", "mapping", "XPDR1-CLIENT3") 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:170: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 07:10:42 response = get_request(target_url) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:117: in get_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT3 (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_14_xpdr_portmapping_CLIENT3 07:10:42 _________ TestTransportPCEPortmapping.test_15_xpdr_portmapping_CLIENT4 _________ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT4' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT4' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT4 (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_15_xpdr_portmapping_CLIENT4(self): 07:10:42 > response = test_utils.get_portmapping_node_attr("XPDRA01", "mapping", "XPDR1-CLIENT4") 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:182: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 07:10:42 response = get_request(target_url) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:117: in get_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT4 (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_15_xpdr_portmapping_CLIENT4 07:10:42 ________ TestTransportPCEPortmapping.test_16_xpdr_device_disconnection _________ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'DELETE' 07:10:42 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '0', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30 07:10:42 verify = True, cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'DELETE' 07:10:42 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01 (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_16_xpdr_device_disconnection(self): 07:10:42 > response = test_utils.unmount_device("XPDRA01") 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:193: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:398: in unmount_device 07:10:42 response = delete_request(url[RESTCONF_VERSION].format('{}', node)) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:134: in delete_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30 07:10:42 verify = True, cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01 (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_16_xpdr_device_disconnection 07:10:42 _________ TestTransportPCEPortmapping.test_17_xpdr_device_disconnected _________ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01?content=nonconfig' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01?content=nonconfig' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01?content=nonconfig (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_17_xpdr_device_disconnected(self): 07:10:42 > response = test_utils.check_device_connection("XPDRA01") 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:197: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:409: in check_device_connection 07:10:42 response = get_request(url[RESTCONF_VERSION].format('{}', node)) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:117: in get_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01?content=nonconfig (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_17_xpdr_device_disconnected 07:10:42 ________ TestTransportPCEPortmapping.test_18_xpdr_device_not_connected _________ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/node-info' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/node-info' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=XPDRA01/node-info (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_18_xpdr_device_not_connected(self): 07:10:42 > response = test_utils.get_portmapping_node_attr("XPDRA01", "node-info", None) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:205: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 07:10:42 response = get_request(target_url) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:117: in get_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=XPDRA01/node-info (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_18_xpdr_device_not_connected 07:10:42 _________ TestTransportPCEPortmapping.test_19_rdm_device_disconnection _________ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'DELETE' 07:10:42 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '0', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30 07:10:42 verify = True, cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'DELETE' 07:10:42 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01 (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_19_rdm_device_disconnection(self): 07:10:42 > response = test_utils.unmount_device("ROADMA01") 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:213: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:398: in unmount_device 07:10:42 response = delete_request(url[RESTCONF_VERSION].format('{}', node)) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:134: in delete_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30 07:10:42 verify = True, cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01 (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_19_rdm_device_disconnection 07:10:42 _________ TestTransportPCEPortmapping.test_20_rdm_device_disconnected __________ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01?content=nonconfig' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01?content=nonconfig' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01?content=nonconfig (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_20_rdm_device_disconnected(self): 07:10:42 > response = test_utils.check_device_connection("ROADMA01") 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:217: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:409: in check_device_connection 07:10:42 response = get_request(url[RESTCONF_VERSION].format('{}', node)) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:117: in get_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01?content=nonconfig (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_20_rdm_device_disconnected 07:10:42 _________ TestTransportPCEPortmapping.test_21_rdm_device_not_connected _________ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 > sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 07:10:42 raise err 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 address = ('localhost', 8191), timeout = 30, source_address = None 07:10:42 socket_options = [(6, 1, 1)] 07:10:42 07:10:42 def create_connection( 07:10:42 address: tuple[str, int], 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 source_address: tuple[str, int] | None = None, 07:10:42 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 07:10:42 ) -> socket.socket: 07:10:42 """Connect to *address* and return the socket object. 07:10:42 07:10:42 Convenience function. Connect to *address* (a 2-tuple ``(host, 07:10:42 port)``) and return the socket object. Passing the optional 07:10:42 *timeout* parameter will set the timeout on the socket instance 07:10:42 before attempting to connect. If no *timeout* is supplied, the 07:10:42 global default timeout setting returned by :func:`socket.getdefaulttimeout` 07:10:42 is used. If *source_address* is set it must be a tuple of (host, port) 07:10:42 for the socket to bind as a source address before making the connection. 07:10:42 An host of '' or port 0 tells the OS to use the default. 07:10:42 """ 07:10:42 07:10:42 host, port = address 07:10:42 if host.startswith("["): 07:10:42 host = host.strip("[]") 07:10:42 err = None 07:10:42 07:10:42 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 07:10:42 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 07:10:42 # The original create_connection function always returns all records. 07:10:42 family = allowed_gai_family() 07:10:42 07:10:42 try: 07:10:42 host.encode("idna") 07:10:42 except UnicodeError: 07:10:42 raise LocationParseError(f"'{host}', label empty or too long") from None 07:10:42 07:10:42 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 07:10:42 af, socktype, proto, canonname, sa = res 07:10:42 sock = None 07:10:42 try: 07:10:42 sock = socket.socket(af, socktype, proto) 07:10:42 07:10:42 # If provided, set socket level options before connecting. 07:10:42 _set_socket_options(sock, socket_options) 07:10:42 07:10:42 if timeout is not _DEFAULT_TIMEOUT: 07:10:42 sock.settimeout(timeout) 07:10:42 if source_address: 07:10:42 sock.bind(source_address) 07:10:42 > sock.connect(sa) 07:10:42 E ConnectionRefusedError: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/node-info' 07:10:42 body = None 07:10:42 headers = {'User-Agent': 'python-requests/2.34.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 07:10:42 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 redirect = False, assert_same_host = False 07:10:42 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 07:10:42 release_conn = False, chunked = False, body_pos = None, preload_content = False 07:10:42 decode_content = False, response_kw = {}, destination_scheme = None, conn = None 07:10:42 release_this_conn = True, http_tunnel_required = False, err = None 07:10:42 clean_exit = False 07:10:42 07:10:42 def urlopen( # type: ignore[override] 07:10:42 self, 07:10:42 method: str, 07:10:42 url: str, 07:10:42 body: _TYPE_BODY | None = None, 07:10:42 headers: typing.Mapping[str, str] | None = None, 07:10:42 retries: Retry | bool | int | None = None, 07:10:42 redirect: bool = True, 07:10:42 assert_same_host: bool = True, 07:10:42 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 07:10:42 pool_timeout: int | None = None, 07:10:42 release_conn: bool | None = None, 07:10:42 chunked: bool = False, 07:10:42 body_pos: _TYPE_BODY_POSITION | None = None, 07:10:42 preload_content: bool = True, 07:10:42 decode_content: bool = True, 07:10:42 **response_kw: typing.Any, 07:10:42 ) -> BaseHTTPResponse: 07:10:42 """ 07:10:42 Get a connection from the pool and perform an HTTP request. This is the 07:10:42 lowest level call for making a request, so you'll need to specify all 07:10:42 the raw details. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 More commonly, it's appropriate to use a convenience method 07:10:42 such as :meth:`request`. 07:10:42 07:10:42 .. note:: 07:10:42 07:10:42 `release_conn` will only behave as expected if 07:10:42 `preload_content=False` because we want to make 07:10:42 `preload_content=False` the default behaviour someday soon without 07:10:42 breaking backwards compatibility. 07:10:42 07:10:42 :param method: 07:10:42 HTTP request method (such as GET, POST, PUT, etc.) 07:10:42 07:10:42 :param url: 07:10:42 The URL to perform the request on. 07:10:42 07:10:42 :param body: 07:10:42 Data to send in the request body, either :class:`str`, :class:`bytes`, 07:10:42 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 07:10:42 07:10:42 :param headers: 07:10:42 Dictionary of custom headers to send, such as User-Agent, 07:10:42 If-None-Match, etc. If None, pool headers are used. If provided, 07:10:42 these headers completely replace any pool-specific headers. 07:10:42 07:10:42 :param retries: 07:10:42 Configure the number of retries to allow before raising a 07:10:42 :class:`~urllib3.exceptions.MaxRetryError` exception. 07:10:42 07:10:42 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 07:10:42 :class:`~urllib3.util.retry.Retry` object for fine-grained control 07:10:42 over different types of retries. 07:10:42 Pass an integer number to retry connection errors that many times, 07:10:42 but no other types of errors. Pass zero to never retry. 07:10:42 07:10:42 If ``False``, then retries are disabled and any exception is raised 07:10:42 immediately. Also, instead of raising a MaxRetryError on redirects, 07:10:42 the redirect response will be returned. 07:10:42 07:10:42 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 07:10:42 07:10:42 :param redirect: 07:10:42 If True, automatically handle redirects (status codes 301, 302, 07:10:42 303, 307, 308). Each redirect counts as a retry. Disabling retries 07:10:42 will disable redirect, too. 07:10:42 07:10:42 :param assert_same_host: 07:10:42 If ``True``, will make sure that the host of the pool requests is 07:10:42 consistent else will raise HostChangedError. When ``False``, you can 07:10:42 use the pool on an HTTP proxy and request foreign hosts. 07:10:42 07:10:42 :param timeout: 07:10:42 If specified, overrides the default timeout for this one 07:10:42 request. It may be a float (in seconds) or an instance of 07:10:42 :class:`urllib3.util.Timeout`. 07:10:42 07:10:42 :param pool_timeout: 07:10:42 If set and the pool is set to block=True, then this method will 07:10:42 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 07:10:42 connection is available within the time period. 07:10:42 07:10:42 :param bool preload_content: 07:10:42 If True, the response's body will be preloaded into memory. 07:10:42 07:10:42 :param bool decode_content: 07:10:42 If True, will attempt to decode the body based on the 07:10:42 'content-encoding' header. 07:10:42 07:10:42 :param release_conn: 07:10:42 If False, then the urlopen call will not release the connection 07:10:42 back into the pool once a response is received (but will release if 07:10:42 you read the entire contents of the response such as when 07:10:42 `preload_content=True`). This is useful if you're not preloading 07:10:42 the response's content immediately. You will need to call 07:10:42 ``r.release_conn()`` on the response ``r`` to return the connection 07:10:42 back into the pool. If None, it takes the value of ``preload_content`` 07:10:42 which defaults to ``True``. 07:10:42 07:10:42 :param bool chunked: 07:10:42 If True, urllib3 will send the body using chunked transfer 07:10:42 encoding. Otherwise, urllib3 will send the body using the standard 07:10:42 content-length form. Defaults to False. 07:10:42 07:10:42 :param int body_pos: 07:10:42 Position to seek to in file-like body in the event of a retry or 07:10:42 redirect. Typically this won't need to be set because urllib3 will 07:10:42 auto-populate the value when needed. 07:10:42 """ 07:10:42 # Ensure that the URL we're connecting to is properly encoded 07:10:42 if url.startswith("/"): 07:10:42 # URLs starting with / are inherently schemeless. 07:10:42 url = to_str(_encode_target(url)) 07:10:42 destination_scheme = None 07:10:42 else: 07:10:42 parsed_url = parse_url(url) 07:10:42 destination_scheme = parsed_url.scheme 07:10:42 url = to_str(parsed_url.url) 07:10:42 07:10:42 if headers is None: 07:10:42 headers = self.headers 07:10:42 07:10:42 if not isinstance(retries, Retry): 07:10:42 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 07:10:42 07:10:42 if release_conn is None: 07:10:42 release_conn = preload_content 07:10:42 07:10:42 # Check host 07:10:42 if assert_same_host and not self.is_same_host(url): 07:10:42 raise HostChangedError(self, url, retries) 07:10:42 07:10:42 conn = None 07:10:42 07:10:42 # Track whether `conn` needs to be released before 07:10:42 # returning/raising/recursing. Update this variable if necessary, and 07:10:42 # leave `release_conn` constant throughout the function. That way, if 07:10:42 # the function recurses, the original value of `release_conn` will be 07:10:42 # passed down into the recursive call, and its value will be respected. 07:10:42 # 07:10:42 # See issue #651 [1] for details. 07:10:42 # 07:10:42 # [1] 07:10:42 release_this_conn = release_conn 07:10:42 07:10:42 http_tunnel_required = connection_requires_http_tunnel( 07:10:42 self.proxy, self.proxy_config, destination_scheme 07:10:42 ) 07:10:42 07:10:42 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 07:10:42 # have to copy the headers dict so we can safely change it without those 07:10:42 # changes being reflected in anyone else's copy. 07:10:42 if not http_tunnel_required: 07:10:42 headers = headers.copy() # type: ignore[attr-defined] 07:10:42 headers.update(self.proxy_headers) # type: ignore[union-attr] 07:10:42 07:10:42 # Must keep the exception bound to a separate variable or else Python 3 07:10:42 # complains about UnboundLocalError. 07:10:42 err = None 07:10:42 07:10:42 # Keep track of whether we cleanly exited the except block. This 07:10:42 # ensures we do proper cleanup in finally. 07:10:42 clean_exit = False 07:10:42 07:10:42 # Rewind body position, if needed. Record current position 07:10:42 # for future rewinds in the event of a redirect/retry. 07:10:42 body_pos = set_file_position(body, body_pos) 07:10:42 07:10:42 try: 07:10:42 # Request a connection from the queue. 07:10:42 timeout_obj = self._get_timeout(timeout) 07:10:42 conn = self._get_conn(timeout=pool_timeout) 07:10:42 07:10:42 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 07:10:42 07:10:42 # Is this a closed/new connection that requires CONNECT tunnelling? 07:10:42 if self.proxy is not None and http_tunnel_required and conn.is_closed: 07:10:42 try: 07:10:42 self._prepare_proxy(conn) 07:10:42 except (BaseSSLError, OSError, SocketTimeout) as e: 07:10:42 self._raise_timeout( 07:10:42 err=e, url=self.proxy.url, timeout_value=conn.timeout 07:10:42 ) 07:10:42 raise 07:10:42 07:10:42 # If we're going to release the connection in ``finally:``, then 07:10:42 # the response doesn't need to know about the connection. Otherwise 07:10:42 # it will also try to release it and we'll have a double-release 07:10:42 # mess. 07:10:42 response_conn = conn if not release_conn else None 07:10:42 07:10:42 # Make the request on the HTTPConnection object 07:10:42 > response = self._make_request( 07:10:42 conn, 07:10:42 method, 07:10:42 url, 07:10:42 timeout=timeout_obj, 07:10:42 body=body, 07:10:42 headers=headers, 07:10:42 chunked=chunked, 07:10:42 retries=retries, 07:10:42 response_conn=response_conn, 07:10:42 preload_content=preload_content, 07:10:42 decode_content=decode_content, 07:10:42 **response_kw, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:788: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 07:10:42 conn.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 07:10:42 self.endheaders() 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 07:10:42 self._send_output(message_body, encode_chunked=encode_chunked) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 07:10:42 self.send(msg) 07:10:42 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 07:10:42 self.connect() 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 07:10:42 self.sock = self._new_conn() 07:10:42 ^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 07:10:42 def _new_conn(self) -> socket.socket: 07:10:42 """Establish a socket connection and set nodelay settings on it. 07:10:42 07:10:42 :return: New socket connection. 07:10:42 """ 07:10:42 try: 07:10:42 sock = connection.create_connection( 07:10:42 (self._dns_host, self.port), 07:10:42 self.timeout, 07:10:42 source_address=self.source_address, 07:10:42 socket_options=self.socket_options, 07:10:42 ) 07:10:42 except socket.gaierror as e: 07:10:42 raise NameResolutionError(self.host, self, e) from e 07:10:42 except SocketTimeout as e: 07:10:42 raise ConnectTimeoutError( 07:10:42 self, 07:10:42 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 07:10:42 ) from e 07:10:42 07:10:42 except OSError as e: 07:10:42 > raise NewConnectionError( 07:10:42 self, f"Failed to establish a new connection: {e}" 07:10:42 ) from e 07:10:42 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 07:10:42 07:10:42 The above exception was the direct cause of the following exception: 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 > resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:696: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:842: in urlopen 07:10:42 retries = retries.increment( 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 07:10:42 method = 'GET' 07:10:42 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/node-info' 07:10:42 response = None 07:10:42 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 07:10:42 _pool = 07:10:42 _stacktrace = 07:10:42 07:10:42 def increment( 07:10:42 self, 07:10:42 method: str | None = None, 07:10:42 url: str | None = None, 07:10:42 response: BaseHTTPResponse | None = None, 07:10:42 error: Exception | None = None, 07:10:42 _pool: ConnectionPool | None = None, 07:10:42 _stacktrace: TracebackType | None = None, 07:10:42 ) -> Self: 07:10:42 """Return a new Retry object with incremented retry counters. 07:10:42 07:10:42 :param response: A response object, or None, if the server did not 07:10:42 return a response. 07:10:42 :type response: :class:`~urllib3.response.BaseHTTPResponse` 07:10:42 :param Exception error: An error encountered during the request, or 07:10:42 None if the response was received successfully. 07:10:42 07:10:42 :return: A new ``Retry`` object. 07:10:42 """ 07:10:42 if self.total is False and error: 07:10:42 # Disabled, indicate to re-raise the error. 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 07:10:42 total = self.total 07:10:42 if total is not None: 07:10:42 total -= 1 07:10:42 07:10:42 connect = self.connect 07:10:42 read = self.read 07:10:42 redirect = self.redirect 07:10:42 status_count = self.status 07:10:42 other = self.other 07:10:42 cause = "unknown" 07:10:42 status = None 07:10:42 redirect_location = None 07:10:42 07:10:42 if error and self._is_connection_error(error): 07:10:42 # Connect retry? 07:10:42 if connect is False: 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif connect is not None: 07:10:42 connect -= 1 07:10:42 07:10:42 elif error and self._is_read_error(error): 07:10:42 # Read retry? 07:10:42 if read is False or method is None or not self._is_method_retryable(method): 07:10:42 raise reraise(type(error), error, _stacktrace) 07:10:42 elif read is not None: 07:10:42 read -= 1 07:10:42 07:10:42 elif error: 07:10:42 # Other retry? 07:10:42 if other is not None: 07:10:42 other -= 1 07:10:42 07:10:42 elif response and response.get_redirect_location(): 07:10:42 # Redirect retry? 07:10:42 if redirect is not None: 07:10:42 redirect -= 1 07:10:42 cause = "too many redirects" 07:10:42 response_redirect_location = response.get_redirect_location() 07:10:42 if response_redirect_location: 07:10:42 redirect_location = response_redirect_location 07:10:42 status = response.status 07:10:42 07:10:42 else: 07:10:42 # Incrementing because of a server error like a 500 in 07:10:42 # status_forcelist and the given method is in the allowed_methods 07:10:42 cause = ResponseError.GENERIC_ERROR 07:10:42 if response and response.status: 07:10:42 if status_count is not None: 07:10:42 status_count -= 1 07:10:42 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 07:10:42 status = response.status 07:10:42 07:10:42 history = self.history + ( 07:10:42 RequestHistory(method, url, error, status, redirect_location), 07:10:42 ) 07:10:42 07:10:42 new_retry = self.new( 07:10:42 total=total, 07:10:42 connect=connect, 07:10:42 read=read, 07:10:42 redirect=redirect, 07:10:42 status=status_count, 07:10:42 other=other, 07:10:42 history=history, 07:10:42 ) 07:10:42 07:10:42 if new_retry.is_exhausted(): 07:10:42 reason = error or ResponseError(cause) 07:10:42 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=ROADMA01/node-info (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:543: MaxRetryError 07:10:42 07:10:42 During handling of the above exception, another exception occurred: 07:10:42 07:10:42 self = 07:10:42 07:10:42 def test_21_rdm_device_not_connected(self): 07:10:42 > response = test_utils.get_portmapping_node_attr("ROADMA01", "node-info", None) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 07:10:42 transportpce_tests/1.2.1/test01_portmapping.py:225: 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 07:10:42 response = get_request(target_url) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 transportpce_tests/common/test_utils.py:117: in get_request 07:10:42 return requests.request( 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:71: in request 07:10:42 return session.request(method=method, url=url, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:651: in request 07:10:42 resp = self.send(prep, **send_kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:784: in send 07:10:42 r = adapter.send(request, **kwargs) 07:10:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 07:10:42 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 07:10:42 07:10:42 self = 07:10:42 request = , stream = False, timeout = 30, verify = True 07:10:42 cert = None, proxies = OrderedDict() 07:10:42 07:10:42 def send( 07:10:42 self, 07:10:42 request: PreparedRequest, 07:10:42 stream: bool = False, 07:10:42 timeout: _t.TimeoutType = None, 07:10:42 verify: _t.VerifyType = True, 07:10:42 cert: _t.CertType = None, 07:10:42 proxies: dict[str, str] | None = None, 07:10:42 ) -> Response: 07:10:42 """Sends PreparedRequest object. Returns Response object. 07:10:42 07:10:42 :param request: The :class:`PreparedRequest ` being sent. 07:10:42 :param stream: (optional) Whether to stream the request content. 07:10:42 :param timeout: (optional) How long to wait for the server to send 07:10:42 data before giving up, as a float, or a :ref:`(connect timeout, 07:10:42 read timeout) ` tuple. 07:10:42 :type timeout: float or tuple or urllib3 Timeout object 07:10:42 :param verify: (optional) Either a boolean, in which case it controls whether 07:10:42 we verify the server's TLS certificate, or a string, in which case it 07:10:42 must be a path to a CA bundle to use 07:10:42 :param cert: (optional) Any user-provided SSL certificate to be trusted. 07:10:42 :param proxies: (optional) The proxies dictionary to apply to the request. 07:10:42 :rtype: requests.Response 07:10:42 """ 07:10:42 07:10:42 assert _is_prepared(request) 07:10:42 07:10:42 try: 07:10:42 conn = self.get_connection_with_tls_context( 07:10:42 request, verify, proxies=proxies, cert=cert 07:10:42 ) 07:10:42 except LocationValueError as e: 07:10:42 raise InvalidURL(e, request=request) 07:10:42 07:10:42 self.cert_verify(conn, request.url, verify, cert) 07:10:42 url = self.request_url(request, proxies) 07:10:42 self.add_headers( 07:10:42 request, 07:10:42 stream=stream, 07:10:42 timeout=timeout, 07:10:42 verify=verify, 07:10:42 cert=cert, 07:10:42 proxies=proxies, 07:10:42 ) 07:10:42 07:10:42 chunked = not (request.body is None or "Content-Length" in request.headers) 07:10:42 07:10:42 if isinstance(timeout, tuple): 07:10:42 try: 07:10:42 connect, read = timeout 07:10:42 resolved_timeout = TimeoutSauce(connect=connect, read=read) 07:10:42 except ValueError: 07:10:42 raise ValueError( 07:10:42 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 07:10:42 f"or a single float to set both timeouts to the same value." 07:10:42 ) 07:10:42 elif isinstance(timeout, TimeoutSauce): 07:10:42 resolved_timeout = timeout 07:10:42 else: 07:10:42 resolved_timeout = TimeoutSauce(connect=timeout, read=timeout) 07:10:42 07:10:42 try: 07:10:42 resp = conn.urlopen( 07:10:42 method=request.method, 07:10:42 url=url, 07:10:42 body=request.body, # type: ignore[arg-type] # urllib3 stubs don't accept Iterable[bytes | str] 07:10:42 headers=request.headers, # type: ignore[arg-type] # urllib3#3072 07:10:42 redirect=False, 07:10:42 assert_same_host=False, 07:10:42 preload_content=False, 07:10:42 decode_content=False, 07:10:42 retries=self.max_retries, 07:10:42 timeout=resolved_timeout, 07:10:42 chunked=chunked, 07:10:42 ) 07:10:42 07:10:42 except (ProtocolError, OSError) as err: 07:10:42 raise ConnectionError(err, request=request) 07:10:42 07:10:42 except MaxRetryError as e: 07:10:42 if isinstance(e.reason, ConnectTimeoutError): 07:10:42 # TODO: Remove this in 3.0.0: see #2811 07:10:42 if not isinstance(e.reason, NewConnectionError): 07:10:42 raise ConnectTimeout(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, ResponseError): 07:10:42 raise RetryError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _ProxyError): 07:10:42 raise ProxyError(e, request=request) 07:10:42 07:10:42 if isinstance(e.reason, _SSLError): 07:10:42 # This branch is for urllib3 v1.22 and later. 07:10:42 raise SSLError(e, request=request) 07:10:42 07:10:42 > raise ConnectionError(e, request=request) 07:10:42 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8191): Max retries exceeded with url: /rests/data/transportpce-portmapping:network/nodes=ROADMA01/node-info (Caused by NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused")) 07:10:42 07:10:42 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:729: ConnectionError 07:10:42 ----------------------------- Captured stdout call ----------------------------- 07:10:42 execution of test_21_rdm_device_not_connected 07:10:42 --------------------------- Captured stdout teardown --------------------------- 07:10:42 all processes killed 07:10:42 ODL log file stored 07:10:42 =========================== short test summary info ============================ 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_02_rdm_device_connected 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_03_rdm_portmapping_info 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_04_rdm_portmapping_DEG1_TTP_TXRX 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_05_rdm_portmapping_SRG1_PP7_TXRX 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_06_rdm_portmapping_SRG3_PP1_TXRX 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_07_xpdr_device_connection 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_08_xpdr_device_connected 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_09_xpdr_portmapping_info 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_10_xpdr_portmapping_NETWORK1 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_11_xpdr_portmapping_NETWORK2 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_12_xpdr_portmapping_CLIENT1 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_13_xpdr_portmapping_CLIENT2 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_14_xpdr_portmapping_CLIENT3 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_15_xpdr_portmapping_CLIENT4 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_16_xpdr_device_disconnection 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_17_xpdr_device_disconnected 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_18_xpdr_device_not_connected 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_19_rdm_device_disconnection 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_20_rdm_device_disconnected 07:10:42 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_21_rdm_device_not_connected 07:10:42 20 failed, 1 passed in 281.38s (0:04:41) 07:10:42 tests71: OK ✔ in 8 minutes 3.16 seconds 07:10:42 tests200: OK ✔ in 3 minutes 56.44 seconds 07:10:42 tests121: exit 1 (281.72 seconds) /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh 1.2.1 pid=9964 07:13:18 ....... [100%] 07:14:35 51 passed in 514.43s (0:08:34) 07:14:35 pytest -q transportpce_tests/tapi/test02_full_topology.py 07:15:30 .................................... [100%] 07:20:07 36 passed in 332.16s (0:05:32) 07:20:07 pytest -q transportpce_tests/tapi/test03_tapi_device_change_notifications.py 07:20:58 ....................................................................... [100%] 07:28:29 71 passed in 501.81s (0:08:21) 07:28:30 pytest -q transportpce_tests/tapi/test04_topo_extension.py 07:29:26 ................... [100%] 07:30:57 19 passed in 147.62s (0:02:27) 07:30:57 pytest -q transportpce_tests/tapi/test05_pce_tapi.py 07:33:06 ...................... [100%] 07:38:43 22 passed in 465.33s (0:07:45) 07:38:43 tests121: FAIL ✖ in 4 minutes 49.89 seconds 07:38:43 tests_tapi: OK ✔ in 32 minutes 51.28 seconds 07:38:43 tests221: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 07:38:51 tests221: freeze> python -m pip freeze --all 07:38:51 tests221: bcrypt==5.0.0,certifi==2026.5.20,cffi==2.0.0,charset-normalizer==3.4.7,cryptography==48.0.0,dict2xml==1.7.8,idna==3.18,iniconfig==2.3.0,invoke==3.0.3,lxml==6.1.1,netconf-client==3.6.0,packaging==26.2,paramiko==5.0.0,pip==26.1.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.20.0,PyNaCl==1.6.2,pytest==9.0.3,requests==2.34.2,setuptools==82.0.1,urllib3==2.7.0 07:38:51 tests221: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh 2.2.1 07:38:51 using environment variables from ./karaf221.env 07:38:51 pytest -q transportpce_tests/2.2.1/test01_portmapping.py 07:39:29 ................................... [100%] 07:40:09 35 passed in 77.67s (0:01:17) 07:40:09 pytest -q transportpce_tests/2.2.1/test02_topo_portmapping.py 07:40:42 ...... [100%] 07:40:56 6 passed in 46.90s 07:40:56 pytest -q transportpce_tests/2.2.1/test03_topology.py 07:41:41 ............................................ [100%] 07:43:16 44 passed in 139.07s (0:02:19) 07:43:16 pytest -q transportpce_tests/2.2.1/test04_otn_topology.py 07:43:53 ............ [100%] 07:44:17 12 passed in 61.21s (0:01:01) 07:44:17 pytest -q transportpce_tests/2.2.1/test05_flex_grid.py 07:44:44 ................ [100%] 07:46:13 16 passed in 115.32s (0:01:55) 07:46:13 pytest -q transportpce_tests/2.2.1/test06_renderer_service_path_nominal.py 07:46:44 ............................... [100%] 07:46:51 31 passed in 37.71s 07:46:51 pytest -q transportpce_tests/2.2.1/test07_otn_renderer.py 07:47:27 .......................... [100%] 07:48:23 26 passed in 91.52s (0:01:31) 07:48:23 pytest -q transportpce_tests/2.2.1/test08_otn_sh_renderer.py 07:49:01 ...................... [100%] 07:50:05 22 passed in 102.15s (0:01:42) 07:50:05 pytest -q transportpce_tests/2.2.1/test09_olm.py 07:50:48 ........................................ [100%] 07:53:10 40 passed in 184.50s (0:03:04) 07:53:10 pytest -q transportpce_tests/2.2.1/test11_otn_end2end.py 07:53:55 ........................................................................ [ 74%] 07:59:32 ......................... [100%] 08:01:24 97 passed in 493.23s (0:08:13) 08:01:24 pytest -q transportpce_tests/2.2.1/test12_end2end.py 08:02:06 ...................................................... [100%] 08:08:54 54 passed in 449.96s (0:07:29) 08:08:54 pytest -q transportpce_tests/2.2.1/test14_otn_switch_end2end.py 08:09:51 ........................................................................ [ 71%] 08:15:00 ............................. [100%] 08:20:09 101 passed in 674.87s (0:11:14) 08:20:09 pytest -q transportpce_tests/2.2.1/test15_otn_end2end_with_intermediate_switch.py 08:21:06 ........................................................................ [ 67%] 08:26:53 ................................... [100%] 08:30:14 107 passed in 604.39s (0:10:04) 08:30:14 pytest -q transportpce_tests/2.2.1/test16_freq_end2end.py 08:31:00 ............................................. [100%] 08:33:37 45 passed in 203.27s (0:03:23) 08:33:38 tests221: OK ✔ in 54 minutes 54.27 seconds 08:33:38 tests_hybrid: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 08:33:44 tests_hybrid: freeze> python -m pip freeze --all 08:33:44 tests_hybrid: bcrypt==5.0.0,certifi==2026.5.20,cffi==2.0.0,charset-normalizer==3.4.7,cryptography==48.0.0,dict2xml==1.7.8,idna==3.18,iniconfig==2.3.0,invoke==3.0.3,lxml==6.1.1,netconf-client==3.6.0,packaging==26.2,paramiko==5.0.0,pip==26.1.2,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.20.0,PyNaCl==1.6.2,pytest==9.0.3,requests==2.34.2,setuptools==82.0.1,urllib3==2.7.0 08:33:44 tests_hybrid: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh hybrid 08:33:44 using environment variables from ./karaf221.env 08:33:44 pytest -q transportpce_tests/hybrid/test01_device_change_notifications.py 08:34:27 ................................................... [100%] 08:36:15 51 passed in 150.32s (0:02:30) 08:36:15 pytest -q transportpce_tests/hybrid/test02_B100G_end2end.py 08:37:00 ........................................................................ [ 66%] 08:41:21 ..................................... [100%] 08:43:27 109 passed in 432.10s (0:07:12) 08:43:28 pytest -q transportpce_tests/hybrid/test03_autonomous_reroute.py 08:44:18 ..................................................... [100%] 08:47:51 53 passed in 263.34s (0:04:23) 08:47:51 buildcontroller: OK (115.95=setup[8.69]+cmd[107.25] seconds) 08:47:51 sims: OK (10.83=setup[8.18]+cmd[2.65] seconds) 08:47:51 build_karaf_tests121: OK (62.52=setup[8.01]+cmd[54.51] seconds) 08:47:51 testsPCE: OK (311.39=setup[54.67]+cmd[256.72] seconds) 08:47:51 tests121: FAIL code 1 (289.89=setup[8.17]+cmd[281.72] seconds) 08:47:51 build_karaf_tests221: OK (63.02=setup[7.94]+cmd[55.08] seconds) 08:47:51 tests_tapi: OK (1971.28=setup[8.19]+cmd[1963.09] seconds) 08:47:51 tests221: OK (3294.27=setup[8.08]+cmd[3286.19] seconds) 08:47:51 build_karaf_tests71: OK (62.52=setup[7.89]+cmd[54.63] seconds) 08:47:51 tests71: OK (483.16=setup[6.64]+cmd[476.52] seconds) 08:47:51 build_karaf_tests200: OK (62.54=setup[7.96]+cmd[54.58] seconds) 08:47:51 tests200: OK (236.44=setup[8.21]+cmd[228.23] seconds) 08:47:51 tests_hybrid: OK (853.79=setup[7.05]+cmd[846.75] seconds) 08:47:51 buildlighty: OK (41.43=setup[8.18]+cmd[33.25] seconds) 08:47:51 docs: OK (32.87=setup[29.94]+cmd[2.93] seconds) 08:47:51 docs-linkcheck: OK (37.47=setup[30.43]+cmd[7.04] seconds) 08:47:51 checkbashisms: OK (3.30=setup[2.04]+cmd[0.01,0.05,1.20] seconds) 08:47:51 pre-commit: OK (72.86=setup[2.88]+cmd[0.00,0.00,60.11,9.86] seconds) 08:47:51 pylint: OK (36.36=setup[4.60]+cmd[31.76] seconds) 08:47:51 evaluation failed :( (6609.76 seconds) 08:47:51 + tox_status=1 08:47:51 + echo '---> Completed tox runs' 08:47:51 ---> Completed tox runs 08:47:51 + for i in .tox/*/log 08:47:51 ++ echo .tox/build_karaf_tests121/log 08:47:51 ++ awk -F/ '{print $2}' 08:47:51 + tox_env=build_karaf_tests121 08:47:51 + cp -r .tox/build_karaf_tests121/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/build_karaf_tests121 08:47:51 + for i in .tox/*/log 08:47:51 ++ echo .tox/build_karaf_tests200/log 08:47:51 ++ awk -F/ '{print $2}' 08:47:51 + tox_env=build_karaf_tests200 08:47:51 + cp -r .tox/build_karaf_tests200/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/build_karaf_tests200 08:47:51 + for i in .tox/*/log 08:47:51 ++ echo .tox/build_karaf_tests221/log 08:47:51 ++ awk -F/ '{print $2}' 08:47:51 + tox_env=build_karaf_tests221 08:47:51 + cp -r .tox/build_karaf_tests221/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/build_karaf_tests221 08:47:51 + for i in .tox/*/log 08:47:51 ++ echo .tox/build_karaf_tests71/log 08:47:51 ++ awk -F/ '{print $2}' 08:47:51 + tox_env=build_karaf_tests71 08:47:51 + cp -r .tox/build_karaf_tests71/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/build_karaf_tests71 08:47:51 + for i in .tox/*/log 08:47:51 ++ echo .tox/buildcontroller/log 08:47:51 ++ awk -F/ '{print $2}' 08:47:51 + tox_env=buildcontroller 08:47:51 + cp -r .tox/buildcontroller/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/buildcontroller 08:47:51 + for i in .tox/*/log 08:47:51 ++ echo .tox/buildlighty/log 08:47:51 ++ awk -F/ '{print $2}' 08:47:51 + tox_env=buildlighty 08:47:51 + cp -r .tox/buildlighty/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/buildlighty 08:47:51 + for i in .tox/*/log 08:47:51 ++ echo .tox/checkbashisms/log 08:47:51 ++ awk -F/ '{print $2}' 08:47:51 + tox_env=checkbashisms 08:47:51 + cp -r .tox/checkbashisms/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/checkbashisms 08:47:51 + for i in .tox/*/log 08:47:51 ++ echo .tox/docs-linkcheck/log 08:47:51 ++ awk -F/ '{print $2}' 08:47:51 + tox_env=docs-linkcheck 08:47:51 + cp -r .tox/docs-linkcheck/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/docs-linkcheck 08:47:51 + for i in .tox/*/log 08:47:51 ++ echo .tox/docs/log 08:47:51 ++ awk -F/ '{print $2}' 08:47:51 + tox_env=docs 08:47:51 + cp -r .tox/docs/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/docs 08:47:51 + for i in .tox/*/log 08:47:51 ++ echo .tox/pre-commit/log 08:47:51 ++ awk -F/ '{print $2}' 08:47:51 + tox_env=pre-commit 08:47:51 + cp -r .tox/pre-commit/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/pre-commit 08:47:51 + for i in .tox/*/log 08:47:51 ++ echo .tox/pylint/log 08:47:51 ++ awk -F/ '{print $2}' 08:47:51 + tox_env=pylint 08:47:51 + cp -r .tox/pylint/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/pylint 08:47:51 + for i in .tox/*/log 08:47:51 ++ echo .tox/sims/log 08:47:51 ++ awk -F/ '{print $2}' 08:47:51 + tox_env=sims 08:47:51 + cp -r .tox/sims/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/sims 08:47:51 + for i in .tox/*/log 08:47:51 ++ echo .tox/tests121/log 08:47:51 ++ awk -F/ '{print $2}' 08:47:51 + tox_env=tests121 08:47:51 + cp -r .tox/tests121/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests121 08:47:51 + for i in .tox/*/log 08:47:51 ++ echo .tox/tests200/log 08:47:51 ++ awk -F/ '{print $2}' 08:47:51 + tox_env=tests200 08:47:51 + cp -r .tox/tests200/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests200 08:47:51 + for i in .tox/*/log 08:47:51 ++ echo .tox/tests221/log 08:47:51 ++ awk -F/ '{print $2}' 08:47:51 + tox_env=tests221 08:47:51 + cp -r .tox/tests221/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests221 08:47:52 + for i in .tox/*/log 08:47:52 ++ echo .tox/tests71/log 08:47:52 ++ awk -F/ '{print $2}' 08:47:52 + tox_env=tests71 08:47:52 + cp -r .tox/tests71/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests71 08:47:52 + for i in .tox/*/log 08:47:52 ++ echo .tox/testsPCE/log 08:47:52 ++ awk -F/ '{print $2}' 08:47:52 + tox_env=testsPCE 08:47:52 + cp -r .tox/testsPCE/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/testsPCE 08:47:52 + for i in .tox/*/log 08:47:52 ++ echo .tox/tests_hybrid/log 08:47:52 ++ awk -F/ '{print $2}' 08:47:52 + tox_env=tests_hybrid 08:47:52 + cp -r .tox/tests_hybrid/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests_hybrid 08:47:52 + for i in .tox/*/log 08:47:52 ++ awk -F/ '{print $2}' 08:47:52 ++ echo .tox/tests_tapi/log 08:47:52 + tox_env=tests_tapi 08:47:52 + cp -r .tox/tests_tapi/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests_tapi 08:47:52 + DOC_DIR=docs/_build/html 08:47:52 + [[ -d docs/_build/html ]] 08:47:52 + echo '---> Archiving generated docs' 08:47:52 ---> Archiving generated docs 08:47:52 + mv docs/_build/html /w/workspace/transportpce-tox-verify-transportpce-master/archives/docs 08:47:52 + echo '---> tox-run.sh ends' 08:47:52 ---> tox-run.sh ends 08:47:52 + test 1 -eq 0 08:47:52 + exit 1 08:47:52 ++ '[' 1 = 1 ']' 08:47:52 ++ '[' -x /usr/bin/clear_console ']' 08:47:52 ++ /usr/bin/clear_console -q 08:47:52 Build step 'Execute shell' marked build as failure 08:47:52 $ ssh-agent -k 08:47:52 unset SSH_AUTH_SOCK; 08:47:52 unset SSH_AGENT_PID; 08:47:52 echo Agent pid 1561 killed; 08:47:52 [ssh-agent] Stopped. 08:47:52 [PostBuildScript] - [INFO] Executing post build scripts. 08:47:52 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins6739885597063367689.sh 08:47:52 ---> sysstat.sh 08:47:53 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins14754908644909940182.sh 08:47:53 ---> package-listing.sh 08:47:53 ++ facter osfamily 08:47:53 ++ tr '[:upper:]' '[:lower:]' 08:47:53 + OS_FAMILY=debian 08:47:53 + workspace=/w/workspace/transportpce-tox-verify-transportpce-master 08:47:53 + START_PACKAGES=/tmp/packages_start.txt 08:47:53 + END_PACKAGES=/tmp/packages_end.txt 08:47:53 + DIFF_PACKAGES=/tmp/packages_diff.txt 08:47:53 + PACKAGES=/tmp/packages_start.txt 08:47:53 + '[' /w/workspace/transportpce-tox-verify-transportpce-master ']' 08:47:53 + PACKAGES=/tmp/packages_end.txt 08:47:53 + case "${OS_FAMILY}" in 08:47:53 + dpkg -l 08:47:53 + grep '^ii' 08:47:53 + '[' -f /tmp/packages_start.txt ']' 08:47:53 + '[' -f /tmp/packages_end.txt ']' 08:47:53 + diff /tmp/packages_start.txt /tmp/packages_end.txt 08:47:53 + '[' /w/workspace/transportpce-tox-verify-transportpce-master ']' 08:47:53 + mkdir -p /w/workspace/transportpce-tox-verify-transportpce-master/archives/ 08:47:53 + cp -f /tmp/packages_diff.txt /tmp/packages_end.txt /tmp/packages_start.txt /w/workspace/transportpce-tox-verify-transportpce-master/archives/ 08:47:53 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins13847959820211311634.sh 08:47:53 ---> capture-instance-metadata.sh 08:47:53 Setup pyenv: 08:47:53 system 08:47:53 3.8.20 08:47:53 3.9.20 08:47:53 3.10.15 08:47:53 * 3.11.10 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 08:47:53 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-HXnc from file:/tmp/.os_lf_venv 08:47:53 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 08:47:53 lf-activate-venv(): INFO: Attempting to install with network-safe options... 08:47:56 lf-activate-venv(): INFO: Base packages installed successfully 08:47:56 lf-activate-venv(): INFO: Installing additional packages: lftools 08:48:08 lf-activate-venv(): INFO: Adding /tmp/venv-HXnc/bin to PATH 08:48:08 INFO: Running in OpenStack, capturing instance metadata 08:48:09 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins1341680498691563739.sh 08:48:09 provisioning config files... 08:48:09 Could not find credentials [logs] for transportpce-tox-verify-transportpce-master #5578 08:48:09 copy managed file [jenkins-log-archives-settings] to file:/w/workspace/transportpce-tox-verify-transportpce-master@tmp/config12188878840156182396tmp 08:48:09 Regular expression run condition: Expression=[^.*logs-s3.*], Label=[odl-logs-s3-cloudfront-index] 08:48:09 Run condition [Regular expression match] enabling perform for step [Provide Configuration files] 08:48:09 provisioning config files... 08:48:10 copy managed file [jenkins-s3-log-ship] to file:/home/jenkins/.aws/credentials 08:48:10 [EnvInject] - Injecting environment variables from a build step. 08:48:10 [EnvInject] - Injecting as environment variables the properties content 08:48:10 SERVER_ID=logs 08:48:10 08:48:10 [EnvInject] - Variables injected successfully. 08:48:10 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins312144545815096130.sh 08:48:10 ---> create-netrc.sh 08:48:10 WARN: Log server credential not found. 08:48:10 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins16791509841700132132.sh 08:48:10 ---> python-tools-install.sh 08:48:10 Setup pyenv: 08:48:10 system 08:48:10 3.8.20 08:48:10 3.9.20 08:48:10 3.10.15 08:48:10 * 3.11.10 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 08:48:10 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-HXnc from file:/tmp/.os_lf_venv 08:48:10 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 08:48:10 lf-activate-venv(): INFO: Attempting to install with network-safe options... 08:48:12 lf-activate-venv(): INFO: Base packages installed successfully 08:48:12 lf-activate-venv(): INFO: Installing additional packages: lftools 08:48:21 lf-activate-venv(): INFO: Adding /tmp/venv-HXnc/bin to PATH 08:48:21 [transportpce-tox-verify-transportpce-master] $ /bin/sh /tmp/jenkins885949295405197946.sh 08:48:21 ---> uv-install.sh 08:48:21 uv 0.11.19 is already installed 08:48:21 uvx 0.11.19 (x86_64-unknown-linux-gnu) 08:48:21 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins15067992451336357099.sh 08:48:21 ---> sudo-logs.sh 08:48:21 Archiving 'sudo' log.. 08:48:21 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins10731457236988492516.sh 08:48:21 ---> job-cost.sh 08:48:21 INFO: Activating Python virtual environment... 08:48:21 Setup pyenv: 08:48:21 system 08:48:21 3.8.20 08:48:21 3.9.20 08:48:21 3.10.15 08:48:21 * 3.11.10 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 08:48:22 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-HXnc from file:/tmp/.os_lf_venv 08:48:22 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 08:48:22 lf-activate-venv(): INFO: Attempting to install with network-safe options... 08:48:24 lf-activate-venv(): INFO: Base packages installed successfully 08:48:24 lf-activate-venv(): INFO: Installing additional packages: zipp==1.1.0 python-openstackclient urllib3~=1.26.15 08:48:30 lf-activate-venv(): INFO: Adding /tmp/venv-HXnc/bin to PATH 08:48:30 INFO: No stack-cost file found 08:48:30 INFO: Instance uptime: 6782s 08:48:30 INFO: Fetching instance metadata (attempt 1 of 3)... 08:48:30 DEBUG: URL: http://169.254.169.254/latest/meta-data/instance-type 08:48:30 INFO: Successfully fetched instance metadata 08:48:30 INFO: Instance type: v3-standard-4 08:48:30 INFO: Retrieving pricing info for: v3-standard-4 08:48:30 INFO: Fetching Vexxhost pricing API (attempt 1 of 3)... 08:48:30 DEBUG: URL: https://pricing.vexxhost.net/v1/pricing/v3-standard-4/cost?seconds=6782 08:48:31 INFO: Successfully fetched Vexxhost pricing API 08:48:31 INFO: Retrieved cost: 0.22 08:48:31 INFO: Retrieved resource: v3-standard-4 08:48:31 INFO: Creating archive directory: /w/workspace/transportpce-tox-verify-transportpce-master/archives/cost 08:48:31 INFO: Archiving costs to: /w/workspace/transportpce-tox-verify-transportpce-master/archives/cost.csv 08:48:31 INFO: Successfully archived job cost data 08:48:31 DEBUG: Cost data: transportpce-tox-verify-transportpce-master,5578,2026-06-05 08:48:31,v3-standard-4,6782,0.22,0.00,FAILURE 08:48:31 [transportpce-tox-verify-transportpce-master] $ /bin/bash -l /tmp/jenkins2555544269060996852.sh 08:48:31 ---> logs-deploy.sh 08:48:31 Setup pyenv: 08:48:31 system 08:48:31 3.8.20 08:48:31 3.9.20 08:48:31 3.10.15 08:48:31 * 3.11.10 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 08:48:31 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-HXnc from file:/tmp/.os_lf_venv 08:48:31 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 08:48:31 lf-activate-venv(): INFO: Attempting to install with network-safe options... 08:48:33 lf-activate-venv(): INFO: Base packages installed successfully 08:48:33 lf-activate-venv(): INFO: Installing additional packages: lftools urllib3~=1.26.15 08:48:42 lf-activate-venv(): INFO: Adding /tmp/venv-HXnc/bin to PATH 08:48:42 WARNING: Nexus logging server not set 08:48:42 INFO: S3 path logs/releng/vex-yul-odl-jenkins-1/transportpce-tox-verify-transportpce-master/5578/ 08:48:42 INFO: archiving logs to S3 08:48:44 ---> uname -a: 08:48:44 Linux prd-ubuntu2204-docker-4c-16g-23919 5.15.0-174-generic #184-Ubuntu SMP Fri Mar 13 18:41:50 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux 08:48:44 08:48:44 08:48:44 ---> lscpu: 08:48:44 Architecture: x86_64 08:48:44 CPU op-mode(s): 32-bit, 64-bit 08:48:44 Address sizes: 40 bits physical, 48 bits virtual 08:48:44 Byte Order: Little Endian 08:48:44 CPU(s): 4 08:48:44 On-line CPU(s) list: 0-3 08:48:44 Vendor ID: AuthenticAMD 08:48:44 Model name: AMD EPYC-Rome Processor 08:48:44 CPU family: 23 08:48:44 Model: 49 08:48:44 Thread(s) per core: 1 08:48:44 Core(s) per socket: 1 08:48:44 Socket(s): 4 08:48:44 Stepping: 0 08:48:44 BogoMIPS: 5599.99 08:48:44 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm rep_good nopl cpuid extd_apicid tsc_known_freq pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext perfctr_core ssbd ibrs ibpb stibp vmmcall fsgsbase tsc_adjust bmi1 avx2 smep bmi2 rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 clzero xsaveerptr wbnoinvd arat npt nrip_save umip rdpid arch_capabilities 08:48:44 Virtualization: AMD-V 08:48:44 Hypervisor vendor: KVM 08:48:44 Virtualization type: full 08:48:44 L1d cache: 128 KiB (4 instances) 08:48:44 L1i cache: 128 KiB (4 instances) 08:48:44 L2 cache: 2 MiB (4 instances) 08:48:44 L3 cache: 64 MiB (4 instances) 08:48:44 NUMA node(s): 1 08:48:44 NUMA node0 CPU(s): 0-3 08:48:44 Vulnerability Gather data sampling: Not affected 08:48:44 Vulnerability Indirect target selection: Not affected 08:48:44 Vulnerability Itlb multihit: Not affected 08:48:44 Vulnerability L1tf: Not affected 08:48:44 Vulnerability Mds: Not affected 08:48:44 Vulnerability Meltdown: Not affected 08:48:44 Vulnerability Mmio stale data: Not affected 08:48:44 Vulnerability Reg file data sampling: Not affected 08:48:44 Vulnerability Retbleed: Mitigation; untrained return thunk; SMT disabled 08:48:44 Vulnerability Spec rstack overflow: Mitigation; SMT disabled 08:48:44 Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp 08:48:44 Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization 08:48:44 Vulnerability Spectre v2: Mitigation; Retpolines; IBPB conditional; STIBP disabled; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected 08:48:44 Vulnerability Srbds: Not affected 08:48:44 Vulnerability Tsa: Not affected 08:48:44 Vulnerability Tsx async abort: Not affected 08:48:44 Vulnerability Vmscape: Not affected 08:48:44 08:48:44 08:48:44 ---> nproc: 08:48:44 4 08:48:44 08:48:44 08:48:44 ---> df -h: 08:48:44 Filesystem Size Used Avail Use% Mounted on 08:48:44 tmpfs 1.6G 1.1M 1.6G 1% /run 08:48:44 /dev/vda1 78G 18G 60G 23% / 08:48:44 tmpfs 7.9G 0 7.9G 0% /dev/shm 08:48:44 tmpfs 5.0M 0 5.0M 0% /run/lock 08:48:44 /dev/vda15 105M 6.1M 99M 6% /boot/efi 08:48:44 tmpfs 1.6G 4.0K 1.6G 1% /run/user/1001 08:48:44 08:48:44 08:48:44 ---> free -m: 08:48:44 total used free shared buff/cache available 08:48:44 Mem: 15989 709 11917 3 3362 14937 08:48:44 Swap: 1023 4 1019 08:48:44 08:48:44 08:48:44 ---> ip addr: 08:48:44 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 08:48:44 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 08:48:44 inet 127.0.0.1/8 scope host lo 08:48:44 valid_lft forever preferred_lft forever 08:48:44 inet6 ::1/128 scope host 08:48:44 valid_lft forever preferred_lft forever 08:48:44 2: ens3: mtu 1458 qdisc mq state UP group default qlen 1000 08:48:44 link/ether fa:16:3e:6d:29:ad brd ff:ff:ff:ff:ff:ff 08:48:44 altname enp0s3 08:48:44 inet 10.30.171.110/23 metric 100 brd 10.30.171.255 scope global dynamic ens3 08:48:44 valid_lft 79612sec preferred_lft 79612sec 08:48:44 inet6 fe80::f816:3eff:fe6d:29ad/64 scope link 08:48:44 valid_lft forever preferred_lft forever 08:48:44 3: docker0: mtu 1458 qdisc noqueue state DOWN group default 08:48:44 link/ether 42:e2:6c:68:3a:5b brd ff:ff:ff:ff:ff:ff 08:48:44 inet 10.250.0.254/24 brd 10.250.0.255 scope global docker0 08:48:44 valid_lft forever preferred_lft forever 08:48:44 inet6 fe80::40e2:6cff:fe68:3a5b/64 scope link 08:48:44 valid_lft forever preferred_lft forever 08:48:44 08:48:44 08:48:44 ---> sar -b -r -n DEV: 08:48:44 Linux 5.15.0-174-generic (prd-ubuntu2204-docker-4c-16g-23919) 06/05/26 _x86_64_ (4 CPU) 08:48:44 08:48:44 06:55:38 LINUX RESTART (4 CPU) 08:48:44 08:48:44 07:00:01 tps rtps wtps dtps bread/s bwrtn/s bdscd/s 08:48:44 07:10:18 105.93 3.94 83.96 18.03 182.02 26449.47 218227.06 08:48:44 07:20:08 14.24 8.58 5.44 0.23 161.91 160.66 1236.04 08:48:44 07:30:18 7.90 0.18 7.33 0.38 12.40 199.42 756.33 08:48:44 07:40:10 11.15 2.00 8.69 0.47 105.97 518.28 1820.25 08:48:44 07:50:06 20.63 0.02 19.74 0.88 0.72 579.83 776.74 08:48:44 08:00:18 7.47 0.03 7.14 0.30 1.01 208.73 72.30 08:48:44 08:10:18 8.33 0.02 7.94 0.36 1.52 255.13 118.91 08:48:44 08:20:10 2.25 0.02 2.22 0.01 0.51 40.27 0.18 08:48:44 08:30:14 5.42 0.01 5.24 0.17 0.50 157.35 96.11 08:48:44 08:40:18 12.31 0.12 11.68 0.50 7.82 712.01 213.81 08:48:44 Average: 19.79 1.48 16.13 2.18 47.43 2994.07 22878.56 08:48:44 08:48:44 07:00:01 kbmemfree kbavail kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty 08:48:44 07:10:18 4572088 6622320 9316252 56.90 261200 1875760 10178920 58.43 1580408 9741244 368 08:48:44 07:20:08 13224340 15329264 616712 3.77 262300 1929564 1378396 7.91 1643644 1052244 3520 08:48:44 07:30:18 7897936 10016360 5927888 36.21 263876 1941512 7025392 40.33 1653992 6374576 156 08:48:44 07:40:10 13077180 15331868 614060 3.75 269332 2072264 1361952 7.82 1674476 1170432 9552 08:48:44 07:50:06 12999252 15336296 609632 3.72 271836 2152116 1361952 7.82 1690928 1236940 12204 08:48:44 08:00:18 8929128 11283204 4661188 28.47 272756 2168228 5404928 31.02 1692836 5300436 244 08:48:44 08:10:18 7673308 10064716 5879076 35.91 273888 2204428 6725936 38.61 1696468 6546288 160 08:48:44 08:20:10 12937584 15350808 595316 3.64 274296 2225840 1362460 7.82 1699704 1304760 19740 08:48:44 08:30:14 12897840 15335472 610576 3.73 275120 2249424 1361612 7.82 1702504 1326348 21420 08:48:44 08:40:18 8792272 11365516 4578668 27.96 279864 2379884 5227068 30.00 1736780 5400208 196 08:48:44 Average: 10300093 12603582 3340937 20.41 270447 2119902 4138862 23.76 1677174 3945348 6756 08:48:44 08:48:44 07:00:01 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil 08:48:44 07:10:18 lo 26.54 26.54 20.27 20.27 0.00 0.00 0.00 0.00 08:48:44 07:10:18 ens3 37.52 26.83 642.45 3.13 0.00 0.00 0.00 0.00 08:48:44 07:10:18 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 08:48:44 07:20:08 lo 8.32 8.32 4.54 4.54 0.00 0.00 0.00 0.00 08:48:44 07:20:08 ens3 1.61 1.50 0.27 2.18 0.00 0.00 0.00 0.00 08:48:44 07:20:08 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 08:48:44 07:30:18 lo 9.72 9.72 5.58 5.58 0.00 0.00 0.00 0.00 08:48:44 07:30:18 ens3 0.58 0.45 0.12 0.09 0.00 0.00 0.00 0.00 08:48:44 07:30:18 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 08:48:44 07:40:10 lo 11.68 11.68 6.17 6.17 0.00 0.00 0.00 0.00 08:48:44 07:40:10 ens3 0.73 0.57 0.21 0.17 0.00 0.00 0.00 0.00 08:48:44 07:40:10 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 08:48:44 07:50:06 lo 12.97 12.97 7.29 7.29 0.00 0.00 0.00 0.00 08:48:44 07:50:06 ens3 0.83 0.71 0.17 0.14 0.00 0.00 0.00 0.00 08:48:44 07:50:06 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 08:48:44 08:00:18 lo 19.34 19.34 9.21 9.21 0.00 0.00 0.00 0.00 08:48:44 08:00:18 ens3 0.85 0.69 0.23 0.18 0.00 0.00 0.00 0.00 08:48:44 08:00:18 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 08:48:44 08:10:18 lo 28.92 28.92 11.43 11.43 0.00 0.00 0.00 0.00 08:48:44 08:10:18 ens3 0.69 0.47 0.18 0.13 0.00 0.00 0.00 0.00 08:48:44 08:10:18 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 08:48:44 08:20:10 lo 14.94 14.94 6.41 6.41 0.00 0.00 0.00 0.00 08:48:44 08:20:10 ens3 0.63 0.42 0.15 0.11 0.00 0.00 0.00 0.00 08:48:44 08:20:10 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 08:48:44 08:30:14 lo 17.65 17.65 10.41 10.41 0.00 0.00 0.00 0.00 08:48:44 08:30:14 ens3 0.82 0.54 0.20 0.15 0.00 0.00 0.00 0.00 08:48:44 08:30:14 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 08:48:44 08:40:18 lo 18.02 18.02 9.98 9.98 0.00 0.00 0.00 0.00 08:48:44 08:40:18 ens3 0.99 0.82 0.27 0.22 0.00 0.00 0.00 0.00 08:48:44 08:40:18 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 08:48:44 Average: lo 16.86 16.86 9.17 9.17 0.00 0.00 0.00 0.00 08:48:44 Average: ens3 4.62 3.37 66.05 0.65 0.00 0.00 0.00 0.00 08:48:44 Average: docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 08:48:44 08:48:44 08:48:44 ---> sar -P ALL: 08:48:44 Linux 5.15.0-174-generic (prd-ubuntu2204-docker-4c-16g-23919) 06/05/26 _x86_64_ (4 CPU) 08:48:44 08:48:44 06:55:38 LINUX RESTART (4 CPU) 08:48:44 08:48:44 07:00:01 CPU %user %nice %system %iowait %steal %idle 08:48:44 07:10:18 all 61.49 0.00 2.54 0.30 0.12 35.55 08:48:44 07:10:18 0 62.09 0.00 2.34 0.17 0.12 35.28 08:48:44 07:10:18 1 61.19 0.00 2.54 0.25 0.12 35.89 08:48:44 07:10:18 2 61.66 0.00 2.74 0.23 0.12 35.25 08:48:44 07:10:18 3 61.02 0.00 2.55 0.54 0.12 35.78 08:48:44 07:20:08 all 9.74 0.00 0.49 0.06 0.06 89.65 08:48:44 07:20:08 0 9.82 0.00 0.51 0.07 0.06 89.54 08:48:44 07:20:08 1 9.63 0.00 0.46 0.10 0.07 89.74 08:48:44 07:20:08 2 9.55 0.00 0.53 0.02 0.06 89.83 08:48:44 07:20:08 3 9.95 0.00 0.44 0.05 0.06 89.49 08:48:44 07:30:18 all 15.05 0.00 0.54 0.10 0.06 84.25 08:48:44 07:30:18 0 15.22 0.00 0.47 0.04 0.06 84.22 08:48:44 07:30:18 1 14.47 0.00 0.55 0.13 0.06 84.79 08:48:44 07:30:18 2 15.34 0.00 0.66 0.19 0.07 83.75 08:48:44 07:30:18 3 15.16 0.00 0.50 0.04 0.06 84.25 08:48:44 07:40:10 all 16.43 0.00 0.74 0.08 0.06 82.68 08:48:44 07:40:10 0 16.69 0.00 0.80 0.11 0.06 82.35 08:48:44 07:40:10 1 16.17 0.00 0.77 0.15 0.07 82.84 08:48:44 07:40:10 2 15.69 0.00 0.70 0.02 0.07 83.52 08:48:44 07:40:10 3 17.18 0.00 0.68 0.05 0.07 82.02 08:48:44 07:50:06 all 28.95 0.00 0.96 0.05 0.07 69.96 08:48:44 07:50:06 0 28.72 0.00 0.91 0.04 0.07 70.26 08:48:44 07:50:06 1 28.80 0.00 1.04 0.07 0.08 70.01 08:48:44 07:50:06 2 29.83 0.00 0.90 0.07 0.07 69.13 08:48:44 07:50:06 3 28.46 0.00 1.00 0.04 0.07 70.42 08:48:44 08:00:18 all 13.69 0.00 0.45 0.02 0.06 85.78 08:48:44 08:00:18 0 13.65 0.00 0.48 0.02 0.06 85.78 08:48:44 08:00:18 1 14.18 0.00 0.46 0.01 0.06 85.29 08:48:44 08:00:18 2 13.57 0.00 0.41 0.03 0.07 85.92 08:48:44 08:00:18 3 13.34 0.00 0.46 0.02 0.06 86.11 08:48:44 08:10:18 all 15.64 0.00 0.57 0.03 0.06 83.70 08:48:44 08:10:18 0 15.27 0.00 0.61 0.04 0.06 84.03 08:48:44 08:10:18 1 15.74 0.00 0.50 0.06 0.06 83.64 08:48:44 08:10:18 2 15.75 0.00 0.56 0.04 0.06 83.58 08:48:44 08:10:18 3 15.79 0.00 0.61 0.01 0.06 83.53 08:48:44 08:20:10 all 3.21 0.00 0.38 0.01 0.05 96.35 08:48:44 08:20:10 0 3.48 0.00 0.32 0.00 0.05 96.14 08:48:44 08:20:10 1 3.26 0.00 0.39 0.02 0.05 96.28 08:48:44 08:20:10 2 3.17 0.00 0.40 0.01 0.05 96.38 08:48:44 08:20:10 3 2.95 0.00 0.40 0.00 0.05 96.60 08:48:44 08:30:14 all 10.02 0.00 0.39 0.02 0.06 89.52 08:48:44 08:30:14 0 9.80 0.00 0.43 0.03 0.06 89.69 08:48:44 08:30:14 1 10.46 0.00 0.40 0.01 0.06 89.06 08:48:44 08:30:14 2 9.97 0.00 0.41 0.02 0.06 89.53 08:48:44 08:30:14 3 9.84 0.00 0.29 0.01 0.05 89.80 08:48:44 08:40:18 all 20.37 0.00 0.73 0.05 0.07 78.78 08:48:44 08:40:18 0 20.40 0.00 0.79 0.04 0.07 78.70 08:48:44 08:40:18 1 19.61 0.00 0.78 0.03 0.07 79.51 08:48:44 08:40:18 2 20.16 0.00 0.67 0.09 0.07 79.01 08:48:44 08:40:18 3 21.28 0.00 0.70 0.03 0.07 77.92 08:48:44 Average: all 19.59 0.00 0.78 0.07 0.07 79.49 08:48:44 Average: 0 19.64 0.00 0.77 0.06 0.07 79.47 08:48:44 Average: 1 19.49 0.00 0.80 0.08 0.07 79.57 08:48:44 Average: 2 19.60 0.00 0.80 0.07 0.07 79.45 08:48:44 Average: 3 19.62 0.00 0.77 0.08 0.07 79.46 08:48:44 08:48:44 08:48:44