09:31:00 Triggered by Gerrit: https://git.opendaylight.org/gerrit/c/transportpce/+/120829 09:31:00 Running as SYSTEM 09:31:00 [EnvInject] - Loading node environment variables. 09:31:00 Building remotely on prd-ubuntu2204-docker-4c-16g-23681 (ubuntu2204-docker-4c-16g) in workspace /w/workspace/transportpce-tox-verify-transportpce-master 09:31:00 [ssh-agent] Looking for ssh-agent implementation... 09:31:00 [ssh-agent] Exec ssh-agent (binary ssh-agent on a remote machine) 09:31:00 $ ssh-agent 09:31:00 SSH_AUTH_SOCK=/tmp/ssh-XXXXXXFZtpSf/agent.1571 09:31:00 SSH_AGENT_PID=1573 09:31:00 [ssh-agent] Started. 09:31:00 Running ssh-add (command line suppressed) 09:31:00 Identity added: /w/workspace/transportpce-tox-verify-transportpce-master@tmp/private_key_2163683383650971138.key (/w/workspace/transportpce-tox-verify-transportpce-master@tmp/private_key_2163683383650971138.key) 09:31:00 [ssh-agent] Using credentials jenkins (jenkins-ssh) 09:31:00 The recommended git tool is: NONE 09:31:02 using credential jenkins-ssh 09:31:02 Wiping out workspace first. 09:31:02 Cloning the remote Git repository 09:31:02 Cloning repository git://devvexx.opendaylight.org/mirror/transportpce 09:31:02 > git init /w/workspace/transportpce-tox-verify-transportpce-master # timeout=10 09:31:02 Fetching upstream changes from git://devvexx.opendaylight.org/mirror/transportpce 09:31:02 > git --version # timeout=10 09:31:02 > git --version # 'git version 2.34.1' 09:31:02 using GIT_SSH to set credentials jenkins-ssh 09:31:02 Verifying host key using known hosts file 09:31:02 You're using 'Known hosts file' strategy to verify ssh host keys, but your known_hosts file does not exist, please go to 'Manage Jenkins' -> 'Security' -> 'Git Host Key Verification Configuration' and configure host key verification. 09:31:02 > git fetch --tags --force --progress -- git://devvexx.opendaylight.org/mirror/transportpce +refs/heads/*:refs/remotes/origin/* # timeout=10 09:31:06 > git config remote.origin.url git://devvexx.opendaylight.org/mirror/transportpce # timeout=10 09:31:06 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 09:31:07 > git config remote.origin.url git://devvexx.opendaylight.org/mirror/transportpce # timeout=10 09:31:07 Fetching upstream changes from git://devvexx.opendaylight.org/mirror/transportpce 09:31:07 using GIT_SSH to set credentials jenkins-ssh 09:31:07 Verifying host key using known hosts file 09:31:07 You're using 'Known hosts file' strategy to verify ssh host keys, but your known_hosts file does not exist, please go to 'Manage Jenkins' -> 'Security' -> 'Git Host Key Verification Configuration' and configure host key verification. 09:31:07 > git fetch --tags --force --progress -- git://devvexx.opendaylight.org/mirror/transportpce refs/changes/29/120829/4 # timeout=10 09:31:07 > git rev-parse 06062df60fc4714174367099c18c1d5b73ff15fc^{commit} # timeout=10 09:31:07 JENKINS-19022: warning: possible memory leak due to Git plugin usage; see: https://plugins.jenkins.io/git/#remove-git-plugin-buildsbybranch-builddata-script 09:31:07 Checking out Revision 06062df60fc4714174367099c18c1d5b73ff15fc (refs/changes/29/120829/4) 09:31:07 > git config core.sparsecheckout # timeout=10 09:31:07 > git checkout -f 06062df60fc4714174367099c18c1d5b73ff15fc # timeout=10 09:31:07 Commit message: "Support for openconfig 2.0" 09:31:07 > git rev-parse FETCH_HEAD^{commit} # timeout=10 09:31:07 > git rev-list --no-walk 509d781065379100eb9da8d0414bc0043a05ebc0 # timeout=10 09:31:07 > git remote # timeout=10 09:31:07 > git submodule init # timeout=10 09:31:07 > git submodule sync # timeout=10 09:31:07 > git config --get remote.origin.url # timeout=10 09:31:07 > git submodule init # timeout=10 09:31:07 > git config -f .gitmodules --get-regexp ^submodule\.(.+)\.url # timeout=10 09:31:07 ERROR: No submodules found. 09:31:11 provisioning config files... 09:31:11 copy managed file [npmrc] to file:/home/jenkins/.npmrc 09:31:11 copy managed file [pipconf] to file:/home/jenkins/.config/pip/pip.conf 09:31:11 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins5059614297834842343.sh 09:31:11 ---> python-tools-install.sh 09:31:11 Setup pyenv: 09:31:11 * system (set by /opt/pyenv/version) 09:31:11 * 3.8.20 (set by /opt/pyenv/version) 09:31:11 * 3.9.20 (set by /opt/pyenv/version) 09:31:11 3.10.15 09:31:11 3.11.10 09:31:15 lf-activate-venv(): INFO: Creating python3 venv at /tmp/venv-b9bO 09:31:15 lf-activate-venv(): INFO: Save venv in file: /tmp/.os_lf_venv 09:31:15 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 09:31:15 lf-activate-venv(): INFO: Attempting to install with network-safe options... 09:31:19 lf-activate-venv(): INFO: Base packages installed successfully 09:31:19 lf-activate-venv(): INFO: Installing additional packages: lftools 09:31:45 lf-activate-venv(): INFO: Adding /tmp/venv-b9bO/bin to PATH 09:31:45 Generating Requirements File 09:32:04 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. 09:32:04 httplib2 0.30.2 requires pyparsing<4,>=3.0.4, but you have pyparsing 2.4.7 which is incompatible. 09:32:04 Python 3.11.10 09:32:04 pip 26.0.1 from /tmp/venv-b9bO/lib/python3.11/site-packages/pip (python 3.11) 09:32:05 appdirs==1.4.4 09:32:05 argcomplete==3.6.3 09:32:05 aspy.yaml==1.3.0 09:32:05 attrs==25.4.0 09:32:05 autopage==0.6.0 09:32:05 beautifulsoup4==4.14.3 09:32:05 boto3==1.42.58 09:32:05 botocore==1.42.58 09:32:05 bs4==0.0.2 09:32:05 certifi==2026.2.25 09:32:05 cffi==2.0.0 09:32:05 cfgv==3.5.0 09:32:05 chardet==6.0.0.post1 09:32:05 charset-normalizer==3.4.4 09:32:05 click==8.3.1 09:32:05 cliff==4.13.2 09:32:05 cmd2==3.2.2 09:32:05 cryptography==3.3.2 09:32:05 debtcollector==3.0.0 09:32:05 decorator==5.2.1 09:32:05 defusedxml==0.7.1 09:32:05 Deprecated==1.3.1 09:32:05 distlib==0.4.0 09:32:05 dnspython==2.8.0 09:32:05 docker==7.1.0 09:32:05 dogpile.cache==1.5.0 09:32:05 durationpy==0.10 09:32:05 email-validator==2.3.0 09:32:05 filelock==3.24.3 09:32:05 future==1.0.0 09:32:05 gitdb==4.0.12 09:32:05 GitPython==3.1.46 09:32:05 httplib2==0.30.2 09:32:05 identify==2.6.16 09:32:05 idna==3.11 09:32:05 importlib-resources==1.5.0 09:32:05 iso8601==2.1.0 09:32:05 Jinja2==3.1.6 09:32:05 jmespath==1.1.0 09:32:05 jsonpatch==1.33 09:32:05 jsonpointer==3.0.0 09:32:05 jsonschema==4.26.0 09:32:05 jsonschema-specifications==2025.9.1 09:32:05 keystoneauth1==5.13.1 09:32:05 kubernetes==35.0.0 09:32:05 lftools==0.37.21 09:32:05 lxml==6.0.2 09:32:05 markdown-it-py==4.0.0 09:32:05 MarkupSafe==3.0.3 09:32:05 mdurl==0.1.2 09:32:05 msgpack==1.1.2 09:32:05 multi_key_dict==2.0.3 09:32:05 munch==4.0.0 09:32:05 netaddr==1.3.0 09:32:05 niet==1.4.2 09:32:05 nodeenv==1.10.0 09:32:05 oauth2client==4.1.3 09:32:05 oauthlib==3.3.1 09:32:05 openstacksdk==4.10.0 09:32:05 os-service-types==1.8.2 09:32:05 osc-lib==4.4.0 09:32:05 oslo.config==10.3.0 09:32:05 oslo.context==6.3.0 09:32:05 oslo.i18n==6.7.2 09:32:05 oslo.log==8.1.0 09:32:05 oslo.serialization==5.9.1 09:32:05 oslo.utils==10.0.0 09:32:05 packaging==26.0 09:32:05 pbr==7.0.3 09:32:05 platformdirs==4.9.2 09:32:05 prettytable==3.17.0 09:32:05 psutil==7.2.2 09:32:05 pyasn1==0.6.2 09:32:05 pyasn1_modules==0.4.2 09:32:05 pycparser==3.0 09:32:05 pygerrit2==2.0.15 09:32:05 PyGithub==2.8.1 09:32:05 Pygments==2.19.2 09:32:05 PyJWT==2.11.0 09:32:05 PyNaCl==1.6.2 09:32:05 pyparsing==2.4.7 09:32:05 pyperclip==1.11.0 09:32:05 pyrsistent==0.20.0 09:32:05 python-cinderclient==9.8.0 09:32:05 python-dateutil==2.9.0.post0 09:32:05 python-discovery==1.1.0 09:32:05 python-heatclient==5.1.0 09:32:05 python-jenkins==1.8.3 09:32:05 python-keystoneclient==5.7.0 09:32:05 python-magnumclient==4.9.0 09:32:05 python-openstackclient==9.0.0 09:32:05 python-swiftclient==4.10.0 09:32:05 PyYAML==6.0.3 09:32:05 referencing==0.37.0 09:32:05 requests==2.32.5 09:32:05 requests-oauthlib==2.0.0 09:32:05 requestsexceptions==1.4.0 09:32:05 rfc3986==2.0.0 09:32:05 rich==14.3.3 09:32:05 rich-argparse==1.7.2 09:32:05 rpds-py==0.30.0 09:32:05 rsa==4.9.1 09:32:05 ruamel.yaml==0.19.1 09:32:05 ruamel.yaml.clib==0.2.15 09:32:05 s3transfer==0.16.0 09:32:05 simplejson==3.20.2 09:32:05 six==1.17.0 09:32:05 smmap==5.0.2 09:32:05 soupsieve==2.8.3 09:32:05 stevedore==5.7.0 09:32:05 tabulate==0.9.0 09:32:05 toml==0.10.2 09:32:05 tomlkit==0.14.0 09:32:05 tqdm==4.67.3 09:32:05 typing_extensions==4.15.0 09:32:05 urllib3==1.26.20 09:32:05 virtualenv==21.1.0 09:32:05 wcwidth==0.6.0 09:32:05 websocket-client==1.9.0 09:32:05 wrapt==2.1.1 09:32:05 xdg==6.0.0 09:32:05 xmltodict==1.0.4 09:32:05 yq==3.4.3 09:32:05 [EnvInject] - Injecting environment variables from a build step. 09:32:05 [EnvInject] - Injecting as environment variables the properties content 09:32:05 PYTHON=python3 09:32:05 09:32:05 [EnvInject] - Variables injected successfully. 09:32:05 [transportpce-tox-verify-transportpce-master] $ /bin/bash -l /tmp/jenkins9419150879747680213.sh 09:32:05 ---> tox-install.sh 09:32:05 + source /home/jenkins/lf-env.sh 09:32:05 + lf-activate-venv --venv-file /tmp/.toxenv tox virtualenv urllib3~=1.26.15 09:32:05 ++ mktemp -d /tmp/venv-XXXX 09:32:05 + lf_venv=/tmp/venv-yBMQ 09:32:05 + local venv_file=/tmp/.os_lf_venv 09:32:05 + local python=python3 09:32:05 + local options 09:32:05 + local set_path=true 09:32:05 + local install_args= 09:32:05 ++ 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 09:32:05 + options=' --venv-file '\''/tmp/.toxenv'\'' -- '\''tox'\'' '\''virtualenv'\'' '\''urllib3~=1.26.15'\''' 09:32:05 + eval set -- ' --venv-file '\''/tmp/.toxenv'\'' -- '\''tox'\'' '\''virtualenv'\'' '\''urllib3~=1.26.15'\''' 09:32:05 ++ set -- --venv-file /tmp/.toxenv -- tox virtualenv urllib3~=1.26.15 09:32:05 + true 09:32:05 + case $1 in 09:32:05 + venv_file=/tmp/.toxenv 09:32:05 + shift 2 09:32:05 + true 09:32:05 + case $1 in 09:32:05 + shift 09:32:05 + break 09:32:05 + case $python in 09:32:05 + local pkg_list= 09:32:05 + [[ -d /opt/pyenv ]] 09:32:05 + echo 'Setup pyenv:' 09:32:05 Setup pyenv: 09:32:05 + export PYENV_ROOT=/opt/pyenv 09:32:05 + PYENV_ROOT=/opt/pyenv 09:32:05 + export PATH=/opt/pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 09:32:05 + PATH=/opt/pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 09:32:05 + pyenv versions 09:32:05 system 09:32:05 3.8.20 09:32:05 3.9.20 09:32:05 3.10.15 09:32:05 * 3.11.10 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 09:32:05 + command -v pyenv 09:32:05 ++ pyenv init - --no-rehash 09:32:05 + eval 'PATH="$(bash --norc -ec '\''IFS=:; paths=($PATH); 09:32:05 for i in ${!paths[@]}; do 09:32:05 if [[ ${paths[i]} == "'\'''\''/opt/pyenv/shims'\'''\''" ]]; then unset '\''\'\'''\''paths[i]'\''\'\'''\''; 09:32:05 fi; done; 09:32:05 echo "${paths[*]}"'\'')" 09:32:05 export PATH="/opt/pyenv/shims:${PATH}" 09:32:05 export PYENV_SHELL=bash 09:32:05 source '\''/opt/pyenv/libexec/../completions/pyenv.bash'\'' 09:32:05 pyenv() { 09:32:05 local command 09:32:05 command="${1:-}" 09:32:05 if [ "$#" -gt 0 ]; then 09:32:05 shift 09:32:05 fi 09:32:05 09:32:05 case "$command" in 09:32:05 rehash|shell) 09:32:05 eval "$(pyenv "sh-$command" "$@")" 09:32:05 ;; 09:32:05 *) 09:32:05 command pyenv "$command" "$@" 09:32:05 ;; 09:32:05 esac 09:32:05 }' 09:32:05 +++ bash --norc -ec 'IFS=:; paths=($PATH); 09:32:05 for i in ${!paths[@]}; do 09:32:05 if [[ ${paths[i]} == "/opt/pyenv/shims" ]]; then unset '\''paths[i]'\''; 09:32:05 fi; done; 09:32:05 echo "${paths[*]}"' 09:32:05 ++ PATH=/opt/pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 09:32:05 ++ export PATH=/opt/pyenv/shims:/opt/pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 09:32:05 ++ PATH=/opt/pyenv/shims:/opt/pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 09:32:05 ++ export PYENV_SHELL=bash 09:32:05 ++ PYENV_SHELL=bash 09:32:05 ++ source /opt/pyenv/libexec/../completions/pyenv.bash 09:32:05 +++ complete -F _pyenv pyenv 09:32:05 ++ lf-pyver python3 09:32:05 ++ local py_version_xy=python3 09:32:05 ++ local py_version_xyz= 09:32:05 ++ pyenv versions 09:32:05 ++ local command 09:32:05 ++ command=versions 09:32:05 ++ '[' 1 -gt 0 ']' 09:32:05 ++ shift 09:32:05 ++ case "$command" in 09:32:05 ++ command pyenv versions 09:32:05 ++ awk '{ print $1 }' 09:32:05 ++ grep -E '^[0-9.]*[0-9]$' 09:32:05 ++ sed 's/^[ *]* //' 09:32:05 ++ [[ ! -s /tmp/.pyenv_versions ]] 09:32:05 +++ grep '^3' /tmp/.pyenv_versions 09:32:05 +++ tail -n 1 09:32:05 +++ sort -V 09:32:05 ++ py_version_xyz=3.11.10 09:32:05 ++ [[ -z 3.11.10 ]] 09:32:05 ++ echo 3.11.10 09:32:05 ++ return 0 09:32:05 + pyenv local 3.11.10 09:32:05 + local command 09:32:05 + command=local 09:32:05 + '[' 2 -gt 0 ']' 09:32:05 + shift 09:32:05 + case "$command" in 09:32:05 + command pyenv local 3.11.10 09:32:05 + for arg in "$@" 09:32:05 + case $arg in 09:32:05 + pkg_list+='tox ' 09:32:05 + for arg in "$@" 09:32:05 + case $arg in 09:32:05 + pkg_list+='virtualenv ' 09:32:05 + for arg in "$@" 09:32:05 + case $arg in 09:32:05 + pkg_list+='urllib3~=1.26.15 ' 09:32:05 + [[ -f /tmp/.toxenv ]] 09:32:05 + [[ ! -f /tmp/.toxenv ]] 09:32:05 + [[ -n '' ]] 09:32:05 + python3 -m venv /tmp/venv-yBMQ 09:32:09 + echo 'lf-activate-venv(): INFO: Creating python3 venv at /tmp/venv-yBMQ' 09:32:09 lf-activate-venv(): INFO: Creating python3 venv at /tmp/venv-yBMQ 09:32:09 + echo /tmp/venv-yBMQ 09:32:09 + echo 'lf-activate-venv(): INFO: Save venv in file: /tmp/.toxenv' 09:32:09 lf-activate-venv(): INFO: Save venv in file: /tmp/.toxenv 09:32:09 + echo 'lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv)' 09:32:09 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 09:32:09 + local 'pip_opts=--upgrade --quiet' 09:32:09 + pip_opts='--upgrade --quiet --trusted-host pypi.org' 09:32:09 + pip_opts='--upgrade --quiet --trusted-host pypi.org --trusted-host files.pythonhosted.org' 09:32:09 + pip_opts='--upgrade --quiet --trusted-host pypi.org --trusted-host files.pythonhosted.org --trusted-host pypi.python.org' 09:32:09 + [[ -n '' ]] 09:32:09 + [[ -n '' ]] 09:32:09 + echo 'lf-activate-venv(): INFO: Attempting to install with network-safe options...' 09:32:09 lf-activate-venv(): INFO: Attempting to install with network-safe options... 09:32:09 + /tmp/venv-yBMQ/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 09:32:13 + echo 'lf-activate-venv(): INFO: Base packages installed successfully' 09:32:13 lf-activate-venv(): INFO: Base packages installed successfully 09:32:13 + [[ -z tox virtualenv urllib3~=1.26.15 ]] 09:32:13 + echo 'lf-activate-venv(): INFO: Installing additional packages: tox virtualenv urllib3~=1.26.15 ' 09:32:13 lf-activate-venv(): INFO: Installing additional packages: tox virtualenv urllib3~=1.26.15 09:32:13 + /tmp/venv-yBMQ/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 09:32:15 + type python3 09:32:15 + true 09:32:15 + echo 'lf-activate-venv(): INFO: Adding /tmp/venv-yBMQ/bin to PATH' 09:32:15 lf-activate-venv(): INFO: Adding /tmp/venv-yBMQ/bin to PATH 09:32:15 + PATH=/tmp/venv-yBMQ/bin:/opt/pyenv/shims:/opt/pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin 09:32:15 + return 0 09:32:15 + python3 --version 09:32:15 Python 3.11.10 09:32:15 + python3 -m pip --version 09:32:15 pip 26.0.1 from /tmp/venv-yBMQ/lib/python3.11/site-packages/pip (python 3.11) 09:32:15 + python3 -m pip freeze 09:32:15 cachetools==7.0.1 09:32:15 colorama==0.4.6 09:32:15 distlib==0.4.0 09:32:15 filelock==3.24.3 09:32:15 packaging==26.0 09:32:15 platformdirs==4.9.2 09:32:15 pluggy==1.6.0 09:32:15 pyproject-api==1.10.0 09:32:15 python-discovery==1.1.0 09:32:15 tox==4.46.3 09:32:15 urllib3==1.26.20 09:32:15 virtualenv==21.1.0 09:32:15 [transportpce-tox-verify-transportpce-master] $ /bin/sh -xe /tmp/jenkins17981816286020036484.sh 09:32:15 [EnvInject] - Injecting environment variables from a build step. 09:32:15 [EnvInject] - Injecting as environment variables the properties content 09:32:15 PARALLEL=True 09:32:15 09:32:15 [EnvInject] - Variables injected successfully. 09:32:15 [transportpce-tox-verify-transportpce-master] $ /bin/bash -l /tmp/jenkins4194909096091523669.sh 09:32:15 ---> tox-run.sh 09:32:15 + PATH=/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 09:32:15 + ARCHIVE_TOX_DIR=/w/workspace/transportpce-tox-verify-transportpce-master/archives/tox 09:32:15 + ARCHIVE_DOC_DIR=/w/workspace/transportpce-tox-verify-transportpce-master/archives/docs 09:32:15 + mkdir -p /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox 09:32:15 + cd /w/workspace/transportpce-tox-verify-transportpce-master/. 09:32:15 + source /home/jenkins/lf-env.sh 09:32:15 + lf-activate-venv --venv-file /tmp/.toxenv tox virtualenv urllib3~=1.26.15 09:32:15 ++ mktemp -d /tmp/venv-XXXX 09:32:15 + lf_venv=/tmp/venv-PlSl 09:32:15 + local venv_file=/tmp/.os_lf_venv 09:32:15 + local python=python3 09:32:15 + local options 09:32:15 + local set_path=true 09:32:15 + local install_args= 09:32:15 ++ 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 09:32:15 + options=' --venv-file '\''/tmp/.toxenv'\'' -- '\''tox'\'' '\''virtualenv'\'' '\''urllib3~=1.26.15'\''' 09:32:15 + eval set -- ' --venv-file '\''/tmp/.toxenv'\'' -- '\''tox'\'' '\''virtualenv'\'' '\''urllib3~=1.26.15'\''' 09:32:15 ++ set -- --venv-file /tmp/.toxenv -- tox virtualenv urllib3~=1.26.15 09:32:15 + true 09:32:15 + case $1 in 09:32:15 + venv_file=/tmp/.toxenv 09:32:15 + shift 2 09:32:15 + true 09:32:15 + case $1 in 09:32:15 + shift 09:32:15 + break 09:32:15 + case $python in 09:32:15 + local pkg_list= 09:32:15 + [[ -d /opt/pyenv ]] 09:32:15 + echo 'Setup pyenv:' 09:32:15 Setup pyenv: 09:32:15 + export PYENV_ROOT=/opt/pyenv 09:32:15 + PYENV_ROOT=/opt/pyenv 09:32:15 + 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 09:32:15 + 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 09:32:15 + pyenv versions 09:32:15 system 09:32:15 3.8.20 09:32:15 3.9.20 09:32:15 3.10.15 09:32:15 * 3.11.10 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 09:32:15 + command -v pyenv 09:32:15 ++ pyenv init - --no-rehash 09:32:15 + eval 'PATH="$(bash --norc -ec '\''IFS=:; paths=($PATH); 09:32:15 for i in ${!paths[@]}; do 09:32:15 if [[ ${paths[i]} == "'\'''\''/opt/pyenv/shims'\'''\''" ]]; then unset '\''\'\'''\''paths[i]'\''\'\'''\''; 09:32:15 fi; done; 09:32:15 echo "${paths[*]}"'\'')" 09:32:15 export PATH="/opt/pyenv/shims:${PATH}" 09:32:15 export PYENV_SHELL=bash 09:32:15 source '\''/opt/pyenv/libexec/../completions/pyenv.bash'\'' 09:32:15 pyenv() { 09:32:15 local command 09:32:15 command="${1:-}" 09:32:15 if [ "$#" -gt 0 ]; then 09:32:15 shift 09:32:15 fi 09:32:15 09:32:15 case "$command" in 09:32:15 rehash|shell) 09:32:15 eval "$(pyenv "sh-$command" "$@")" 09:32:15 ;; 09:32:15 *) 09:32:15 command pyenv "$command" "$@" 09:32:15 ;; 09:32:15 esac 09:32:15 }' 09:32:15 +++ bash --norc -ec 'IFS=:; paths=($PATH); 09:32:15 for i in ${!paths[@]}; do 09:32:15 if [[ ${paths[i]} == "/opt/pyenv/shims" ]]; then unset '\''paths[i]'\''; 09:32:15 fi; done; 09:32:15 echo "${paths[*]}"' 09:32:15 ++ 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 09:32:15 ++ 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 09:32:15 ++ 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 09:32:15 ++ export PYENV_SHELL=bash 09:32:15 ++ PYENV_SHELL=bash 09:32:15 ++ source /opt/pyenv/libexec/../completions/pyenv.bash 09:32:15 +++ complete -F _pyenv pyenv 09:32:15 ++ lf-pyver python3 09:32:15 ++ local py_version_xy=python3 09:32:15 ++ local py_version_xyz= 09:32:15 ++ pyenv versions 09:32:15 ++ local command 09:32:15 ++ command=versions 09:32:15 ++ '[' 1 -gt 0 ']' 09:32:15 ++ shift 09:32:15 ++ case "$command" in 09:32:15 ++ command pyenv versions 09:32:15 ++ sed 's/^[ *]* //' 09:32:15 ++ grep -E '^[0-9.]*[0-9]$' 09:32:15 ++ awk '{ print $1 }' 09:32:15 ++ [[ ! -s /tmp/.pyenv_versions ]] 09:32:15 +++ grep '^3' /tmp/.pyenv_versions 09:32:15 +++ sort -V 09:32:15 +++ tail -n 1 09:32:15 ++ py_version_xyz=3.11.10 09:32:15 ++ [[ -z 3.11.10 ]] 09:32:15 ++ echo 3.11.10 09:32:15 ++ return 0 09:32:15 + pyenv local 3.11.10 09:32:15 + local command 09:32:15 + command=local 09:32:15 + '[' 2 -gt 0 ']' 09:32:15 + shift 09:32:15 + case "$command" in 09:32:15 + command pyenv local 3.11.10 09:32:15 + for arg in "$@" 09:32:15 + case $arg in 09:32:15 + pkg_list+='tox ' 09:32:15 + for arg in "$@" 09:32:15 + case $arg in 09:32:15 + pkg_list+='virtualenv ' 09:32:15 + for arg in "$@" 09:32:15 + case $arg in 09:32:15 + pkg_list+='urllib3~=1.26.15 ' 09:32:15 + [[ -f /tmp/.toxenv ]] 09:32:15 ++ cat /tmp/.toxenv 09:32:15 + lf_venv=/tmp/venv-yBMQ 09:32:15 + echo 'lf-activate-venv(): INFO: Reuse venv:/tmp/venv-yBMQ from' file:/tmp/.toxenv 09:32:15 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-yBMQ from file:/tmp/.toxenv 09:32:15 + echo 'lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv)' 09:32:15 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 09:32:15 + local 'pip_opts=--upgrade --quiet' 09:32:15 + pip_opts='--upgrade --quiet --trusted-host pypi.org' 09:32:15 + pip_opts='--upgrade --quiet --trusted-host pypi.org --trusted-host files.pythonhosted.org' 09:32:15 + pip_opts='--upgrade --quiet --trusted-host pypi.org --trusted-host files.pythonhosted.org --trusted-host pypi.python.org' 09:32:15 + [[ -n '' ]] 09:32:15 + [[ -n '' ]] 09:32:15 + echo 'lf-activate-venv(): INFO: Attempting to install with network-safe options...' 09:32:15 lf-activate-venv(): INFO: Attempting to install with network-safe options... 09:32:15 + /tmp/venv-yBMQ/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 09:32:16 + echo 'lf-activate-venv(): INFO: Base packages installed successfully' 09:32:16 lf-activate-venv(): INFO: Base packages installed successfully 09:32:16 + [[ -z tox virtualenv urllib3~=1.26.15 ]] 09:32:16 + echo 'lf-activate-venv(): INFO: Installing additional packages: tox virtualenv urllib3~=1.26.15 ' 09:32:16 lf-activate-venv(): INFO: Installing additional packages: tox virtualenv urllib3~=1.26.15 09:32:16 + /tmp/venv-yBMQ/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 09:32:18 + type python3 09:32:18 + true 09:32:18 + echo 'lf-activate-venv(): INFO: Adding /tmp/venv-yBMQ/bin to PATH' 09:32:18 lf-activate-venv(): INFO: Adding /tmp/venv-yBMQ/bin to PATH 09:32:18 + PATH=/tmp/venv-yBMQ/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 09:32:18 + return 0 09:32:18 + [[ -d /opt/pyenv ]] 09:32:18 + echo '---> Setting up pyenv' 09:32:18 ---> Setting up pyenv 09:32:18 + export PYENV_ROOT=/opt/pyenv 09:32:18 + PYENV_ROOT=/opt/pyenv 09:32:18 + export PATH=/opt/pyenv/bin:/tmp/venv-yBMQ/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 09:32:18 + PATH=/opt/pyenv/bin:/tmp/venv-yBMQ/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 09:32:18 ++ pwd 09:32:18 + PYTHONPATH=/w/workspace/transportpce-tox-verify-transportpce-master 09:32:18 + export PYTHONPATH 09:32:18 + export TOX_TESTENV_PASSENV=PYTHONPATH 09:32:18 + TOX_TESTENV_PASSENV=PYTHONPATH 09:32:18 + tox --version 09:32:18 4.46.3 from /tmp/venv-yBMQ/lib/python3.11/site-packages/tox/__init__.py 09:32:18 + PARALLEL=True 09:32:18 + TOX_OPTIONS_LIST= 09:32:18 + [[ -n '' ]] 09:32:18 + case ${PARALLEL,,} in 09:32:18 + TOX_OPTIONS_LIST=' --parallel auto --parallel-live' 09:32:18 + tox --parallel auto --parallel-live 09:32:18 + tee -a /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tox.log 09:32:20 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 09:32:20 docs: install_deps> python -I -m pip install -r docs/requirements.txt 09:32:20 checkbashisms: freeze> python -m pip freeze --all 09:32:20 docs-linkcheck: install_deps> python -I -m pip install -r docs/requirements.txt 09:32:20 checkbashisms: pip==26.0.1,setuptools==82.0.0 09:32:20 checkbashisms: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./fixCIcentOS8reposMirrors.sh 09:32:20 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)' 09:32:20 checkbashisms: commands[2] /w/workspace/transportpce-tox-verify-transportpce-master/tests> find . -not -path '*/\.*' -name '*.sh' -exec checkbashisms -f '{}' + 09:32:22 checkbashisms: OK ✔ in 3.41 seconds 09:32:22 pre-commit: install_deps> python -I -m pip install pre-commit 09:32:24 pre-commit: freeze> python -m pip freeze --all 09:32:24 pre-commit: cfgv==3.5.0,distlib==0.4.0,filelock==3.24.3,identify==2.6.16,nodeenv==1.10.0,pip==26.0.1,platformdirs==4.9.2,pre_commit==4.5.1,python-discovery==1.1.0,PyYAML==6.0.3,setuptools==82.0.0,virtualenv==21.1.0 09:32:24 pre-commit: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./fixCIcentOS8reposMirrors.sh 09:32:24 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)' 09:32:24 /usr/bin/cpan 09:32:24 pre-commit: commands[2] /w/workspace/transportpce-tox-verify-transportpce-master/tests> pre-commit run --all-files --show-diff-on-failure 09:32:25 [WARNING] hook id `remove-tabs` uses deprecated stage names (commit) which will be removed in a future version. run: `pre-commit migrate-config` to automatically fix this. 09:32:25 [WARNING] hook id `perltidy` uses deprecated stage names (commit) which will be removed in a future version. run: `pre-commit migrate-config` to automatically fix this. 09:32:25 [INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks. 09:32:25 [WARNING] repo `https://github.com/pre-commit/pre-commit-hooks` uses deprecated stage names (commit, push) which will be removed in a future version. Hint: often `pre-commit autoupdate --repo https://github.com/pre-commit/pre-commit-hooks` will fix this. if it does not -- consider reporting an issue to that repo. 09:32:25 [INFO] Initializing environment for https://github.com/jorisroovers/gitlint. 09:32:25 [INFO] Initializing environment for https://github.com/jorisroovers/gitlint:./gitlint-core[trusted-deps]. 09:32:26 [INFO] Initializing environment for https://github.com/Lucas-C/pre-commit-hooks. 09:32:26 buildcontroller: freeze> python -m pip freeze --all 09:32:26 [INFO] Initializing environment for https://github.com/pre-commit/mirrors-autopep8. 09:32:26 buildcontroller: bcrypt==5.0.0,certifi==2026.2.25,cffi==2.0.0,charset-normalizer==3.4.4,cryptography==46.0.5,dict2xml==1.7.8,idna==3.11,iniconfig==2.3.0,invoke==2.2.1,lxml==6.0.2,netconf-client==3.5.0,packaging==26.0,paramiko==4.0.0,pip==26.0.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.19.2,PyNaCl==1.6.2,pytest==9.0.2,requests==2.32.5,setuptools==82.0.0,urllib3==2.6.3 09:32:26 buildcontroller: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_controller.sh 09:32:26 + update-java-alternatives -l 09:32:26 java-1.11.0-openjdk-amd64 1111 /usr/lib/jvm/java-1.11.0-openjdk-amd64 09:32:26 java-1.17.0-openjdk-amd64 1711 /usr/lib/jvm/java-1.17.0-openjdk-amd64 09:32:26 java-1.21.0-openjdk-amd64 2111 /usr/lib/jvm/java-1.21.0-openjdk-amd64 09:32:26 + sudo update-java-alternatives -s java-1.21.0-openjdk-amd64 09:32:26 update-alternatives: error: no alternatives for jaotc 09:32:26 [INFO] Initializing environment for https://github.com/perltidy/perltidy. 09:32:26 update-alternatives: error: no alternatives for rmic 09:32:26 + java -version 09:32:26 + sed -n ;s/.* version "\(.*\)\.\(.*\)\..*".*$/\1/p; 09:32:26 + JAVA_VER=21 09:32:26 + echo 21 09:32:26 21 09:32:26 + sed -n ;s/javac \(.*\)\.\(.*\)\..*.*$/\1/p; 09:32:26 + javac -version 09:32:27 + JAVAC_VER=21 09:32:27 + echo 21 09:32:27 + [ 21 -ge 21 ] 09:32:27 + [ 21 -ge 21 ] 09:32:27 + echo ok, java is 21 or newer 09:32:27 + wget -nv https://dlcdn.apache.org/maven/maven-3/3.9.12/binaries/apache-maven-3.9.12-bin.tar.gz -P /tmp 09:32:27 21 09:32:27 ok, java is 21 or newer 09:32:27 [INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks. 09:32:27 [INFO] Once installed this environment will be reused. 09:32:27 [INFO] This may take a few minutes... 09:32:28 2026-02-27 09:32:28 URL:https://dlcdn.apache.org/maven/maven-3/3.9.12/binaries/apache-maven-3.9.12-bin.tar.gz [9233336/9233336] -> "/tmp/apache-maven-3.9.12-bin.tar.gz" [1] 09:32:28 + sudo mkdir -p /opt 09:32:28 + sudo tar xf /tmp/apache-maven-3.9.12-bin.tar.gz -C /opt 09:32:28 + sudo ln -s /opt/apache-maven-3.9.12 /opt/maven 09:32:28 + sudo ln -s /opt/maven/bin/mvn /usr/bin/mvn 09:32:28 + mvn --version 09:32:28 Apache Maven 3.9.12 (848fbb4bf2d427b72bdb2471c22fced7ebd9a7a1) 09:32:28 Maven home: /opt/maven 09:32:28 Java version: 21.0.9, vendor: Ubuntu, runtime: /usr/lib/jvm/java-21-openjdk-amd64 09:32:28 Default locale: en, platform encoding: UTF-8 09:32:28 OS name: "linux", version: "5.15.0-168-generic", arch: "amd64", family: "unix" 09:32:29 NOTE: Picked up JDK_JAVA_OPTIONS: 09:32:29 --add-opens=java.base/java.io=ALL-UNNAMED 09:32:29 --add-opens=java.base/java.lang=ALL-UNNAMED 09:32:29 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 09:32:29 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 09:32:29 --add-opens=java.base/java.net=ALL-UNNAMED 09:32:29 --add-opens=java.base/java.nio=ALL-UNNAMED 09:32:29 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 09:32:29 --add-opens=java.base/java.nio.file=ALL-UNNAMED 09:32:29 --add-opens=java.base/java.util=ALL-UNNAMED 09:32:29 --add-opens=java.base/java.util.jar=ALL-UNNAMED 09:32:29 --add-opens=java.base/java.util.stream=ALL-UNNAMED 09:32:29 --add-opens=java.base/java.util.zip=ALL-UNNAMED 09:32:29 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 09:32:29 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 09:32:29 -Xlog:disable 09:32:32 [INFO] Installing environment for https://github.com/Lucas-C/pre-commit-hooks. 09:32:32 [INFO] Once installed this environment will be reused. 09:32:32 [INFO] This may take a few minutes... 09:32:38 [INFO] Installing environment for https://github.com/pre-commit/mirrors-autopep8. 09:32:38 [INFO] Once installed this environment will be reused. 09:32:38 [INFO] This may take a few minutes... 09:32:42 [INFO] Installing environment for https://github.com/perltidy/perltidy. 09:32:42 [INFO] Once installed this environment will be reused. 09:32:42 [INFO] This may take a few minutes... 09:32:43 docs-linkcheck: freeze> python -m pip freeze --all 09:32:43 docs: freeze> python -m pip freeze --all 09:32:43 docs-linkcheck: alabaster==1.0.0,attrs==25.4.0,babel==2.18.0,blockdiag==3.0.0,certifi==2026.2.25,charset-normalizer==3.4.4,contourpy==1.3.3,cycler==0.12.1,docutils==0.21.2,fonttools==4.61.1,funcparserlib==2.0.0a0,future==1.0.0,idna==3.11,imagesize==1.4.1,Jinja2==3.1.6,jsonschema==3.2.0,kiwisolver==1.4.9,lfdocs_conf==0.10.0,MarkupSafe==3.0.3,matplotlib==3.10.8,numpy==2.4.2,nwdiag==3.0.0,packaging==26.0,pillow==12.1.1,pip==26.0.1,Pygments==2.19.2,pyparsing==3.3.2,pyrsistent==0.20.0,python-dateutil==2.9.0.post0,PyYAML==6.0.3,requests==2.32.5,requests-file==1.5.1,roman-numerals==4.1.0,roman-numerals-py==4.1.0,seqdiag==3.0.0,setuptools==82.0.0,six==1.17.0,snowballstemmer==3.0.1,Sphinx==8.2.3,sphinx-bootstrap-theme==0.8.1,sphinx-data-viewer==0.1.5,sphinx-tabs==3.4.7,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.6.3,webcolors==25.10.0 09:32:43 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 09:32:44 docs: alabaster==1.0.0,attrs==25.4.0,babel==2.18.0,blockdiag==3.0.0,certifi==2026.2.25,charset-normalizer==3.4.4,contourpy==1.3.3,cycler==0.12.1,docutils==0.21.2,fonttools==4.61.1,funcparserlib==2.0.0a0,future==1.0.0,idna==3.11,imagesize==1.4.1,Jinja2==3.1.6,jsonschema==3.2.0,kiwisolver==1.4.9,lfdocs_conf==0.10.0,MarkupSafe==3.0.3,matplotlib==3.10.8,numpy==2.4.2,nwdiag==3.0.0,packaging==26.0,pillow==12.1.1,pip==26.0.1,Pygments==2.19.2,pyparsing==3.3.2,pyrsistent==0.20.0,python-dateutil==2.9.0.post0,PyYAML==6.0.3,requests==2.32.5,requests-file==1.5.1,roman-numerals==4.1.0,roman-numerals-py==4.1.0,seqdiag==3.0.0,setuptools==82.0.0,six==1.17.0,snowballstemmer==3.0.1,Sphinx==8.2.3,sphinx-bootstrap-theme==0.8.1,sphinx-data-viewer==0.1.5,sphinx-tabs==3.4.7,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.6.3,webcolors==25.10.0 09:32:44 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 09:32:46 docs: OK ✔ in 28.01 seconds 09:32:46 pylint: install_deps> python -I -m pip install 'pylint>=2.6.0' 09:32:49 docs-linkcheck: OK ✔ in 29.87 seconds 09:32:49 pylint: freeze> python -m pip freeze --all 09:32:50 pylint: astroid==4.0.4,dill==0.4.1,isort==8.0.0,mccabe==0.7.0,pip==26.0.1,platformdirs==4.9.2,pylint==4.0.5,setuptools==82.0.0,tomlkit==0.14.0 09:32:50 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}$' '{}' + 09:32:54 trim trailing whitespace.................................................Passed 09:32:54 Tabs remover.............................................................Passed 09:32:54 autopep8.................................................................Passed 09:33:01 perltidy.................................................................Passed 09:33:01 pre-commit: commands[3] /w/workspace/transportpce-tox-verify-transportpce-master/tests> pre-commit run gitlint-ci --hook-stage manual 09:33:02 [WARNING] hook id `remove-tabs` uses deprecated stage names (commit) which will be removed in a future version. run: `pre-commit migrate-config` to automatically fix this. 09:33:02 [WARNING] hook id `perltidy` uses deprecated stage names (commit) which will be removed in a future version. run: `pre-commit migrate-config` to automatically fix this. 09:33:02 [INFO] Installing environment for https://github.com/jorisroovers/gitlint. 09:33:02 [INFO] Once installed this environment will be reused. 09:33:02 [INFO] This may take a few minutes... 09:33:10 gitlint..................................................................Passed 09:33:16 09:33:16 ------------------------------------ 09:33:16 Your code has been rated at 10.00/10 09:33:16 09:34:12 pre-commit: OK ✔ in 48.17 seconds 09:34:12 pylint: OK ✔ in 32.15 seconds 09:34:12 buildcontroller: OK ✔ in 1 minute 52.81 seconds 09:34:12 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 09:34:12 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 09:34:12 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 09:34:12 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 09:34:20 build_karaf_tests221: freeze> python -m pip freeze --all 09:34:20 build_karaf_tests200: freeze> python -m pip freeze --all 09:34:20 build_karaf_tests121: freeze> python -m pip freeze --all 09:34:20 build_karaf_tests71: freeze> python -m pip freeze --all 09:34:21 build_karaf_tests200: bcrypt==5.0.0,certifi==2026.2.25,cffi==2.0.0,charset-normalizer==3.4.4,cryptography==46.0.5,dict2xml==1.7.8,idna==3.11,iniconfig==2.3.0,invoke==2.2.1,lxml==6.0.2,netconf-client==3.5.0,packaging==26.0,paramiko==4.0.0,pip==26.0.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.19.2,PyNaCl==1.6.2,pytest==9.0.2,requests==2.32.5,setuptools==82.0.0,urllib3==2.6.3 09:34:21 build_karaf_tests200: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_karaf_for_tests.sh 09:34:21 build_karaf_tests221: bcrypt==5.0.0,certifi==2026.2.25,cffi==2.0.0,charset-normalizer==3.4.4,cryptography==46.0.5,dict2xml==1.7.8,idna==3.11,iniconfig==2.3.0,invoke==2.2.1,lxml==6.0.2,netconf-client==3.5.0,packaging==26.0,paramiko==4.0.0,pip==26.0.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.19.2,PyNaCl==1.6.2,pytest==9.0.2,requests==2.32.5,setuptools==82.0.0,urllib3==2.6.3 09:34:21 build_karaf_tests221: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_karaf_for_tests.sh 09:34:21 build karaf in karaf221 with ./karaf221.env 09:34:21 build karaf in karafoc200 with ./karafoc200.env 09:34:21 build_karaf_tests121: bcrypt==5.0.0,certifi==2026.2.25,cffi==2.0.0,charset-normalizer==3.4.4,cryptography==46.0.5,dict2xml==1.7.8,idna==3.11,iniconfig==2.3.0,invoke==2.2.1,lxml==6.0.2,netconf-client==3.5.0,packaging==26.0,paramiko==4.0.0,pip==26.0.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.19.2,PyNaCl==1.6.2,pytest==9.0.2,requests==2.32.5,setuptools==82.0.0,urllib3==2.6.3 09:34:21 build_karaf_tests121: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_karaf_for_tests.sh 09:34:21 build karaf in karaf121 with ./karaf121.env 09:34:21 build_karaf_tests71: bcrypt==5.0.0,certifi==2026.2.25,cffi==2.0.0,charset-normalizer==3.4.4,cryptography==46.0.5,dict2xml==1.7.8,idna==3.11,iniconfig==2.3.0,invoke==2.2.1,lxml==6.0.2,netconf-client==3.5.0,packaging==26.0,paramiko==4.0.0,pip==26.0.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.19.2,PyNaCl==1.6.2,pytest==9.0.2,requests==2.32.5,setuptools==82.0.0,urllib3==2.6.3 09:34:21 build_karaf_tests71: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_karaf_for_tests.sh 09:34:21 build karaf in karaf71 with ./karaf71.env 09:34:21 NOTE: Picked up JDK_JAVA_OPTIONS: 09:34:21 --add-opens=java.base/java.io=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.lang=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.net=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.nio=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.nio.file=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.util=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.util.jar=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.util.stream=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.util.zip=ALL-UNNAMED 09:34:21 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 09:34:21 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 09:34:21 -Xlog:disable 09:34:21 NOTE: Picked up JDK_JAVA_OPTIONS: 09:34:21 --add-opens=java.base/java.io=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.lang=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.net=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.nio=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.nio.file=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.util=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.util.jar=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.util.stream=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.util.zip=ALL-UNNAMED 09:34:21 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 09:34:21 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 09:34:21 -Xlog:disable 09:34:21 NOTE: Picked up JDK_JAVA_OPTIONS: 09:34:21 --add-opens=java.base/java.io=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.lang=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.net=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.nio=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.nio.file=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.util=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.util.jar=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.util.stream=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.util.zip=ALL-UNNAMED 09:34:21 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 09:34:21 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 09:34:21 -Xlog:disable 09:34:21 NOTE: Picked up JDK_JAVA_OPTIONS: 09:34:21 --add-opens=java.base/java.io=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.lang=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.net=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.nio=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.nio.file=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.util=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.util.jar=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.util.stream=ALL-UNNAMED 09:34:21 --add-opens=java.base/java.util.zip=ALL-UNNAMED 09:34:21 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 09:34:21 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 09:34:21 -Xlog:disable 09:35:10 build_karaf_tests71: OK ✔ in 59.15 seconds 09:35:10 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 09:35:11 build_karaf_tests121: OK ✔ in 1 minute 0.19 seconds 09:35:11 build_karaf_tests200: OK ✔ in 1 minute 0.2 seconds 09:35:11 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 09:35:12 build_karaf_tests221: OK ✔ in 1 minute 0.81 seconds 09:35:12 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 09:35:17 buildlighty: freeze> python -m pip freeze --all 09:35:17 buildlighty: bcrypt==5.0.0,certifi==2026.2.25,cffi==2.0.0,charset-normalizer==3.4.4,cryptography==46.0.5,dict2xml==1.7.8,idna==3.11,iniconfig==2.3.0,invoke==2.2.1,lxml==6.0.2,netconf-client==3.5.0,packaging==26.0,paramiko==4.0.0,pip==26.0.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.19.2,PyNaCl==1.6.2,pytest==9.0.2,requests==2.32.5,setuptools==82.0.0,urllib3==2.6.3 09:35:17 buildlighty: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/lighty> ./build.sh 09:35:18 NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED 09:35:18 sims: freeze> python -m pip freeze --all 09:35:18 sims: bcrypt==5.0.0,certifi==2026.2.25,cffi==2.0.0,charset-normalizer==3.4.4,cryptography==46.0.5,dict2xml==1.7.8,idna==3.11,iniconfig==2.3.0,invoke==2.2.1,lxml==6.0.2,netconf-client==3.5.0,packaging==26.0,paramiko==4.0.0,pip==26.0.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.19.2,PyNaCl==1.6.2,pytest==9.0.2,requests==2.32.5,setuptools==82.0.0,urllib3==2.6.3 09:35:18 sims: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./install_lightynode.sh 09:35:18 Using lighynode version 22.1.0.7 09:35:18 Installing lightynode device to ./lightynode/lightynode-openroadm-device directory 09:35:21 sims: OK ✔ in 9.63 seconds 09:35:21 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 09:35:27 tests71: freeze> python -m pip freeze --all 09:35:28 tests71: bcrypt==5.0.0,certifi==2026.2.25,cffi==2.0.0,charset-normalizer==3.4.4,cryptography==46.0.5,dict2xml==1.7.8,idna==3.11,iniconfig==2.3.0,invoke==2.2.1,lxml==6.0.2,netconf-client==3.5.0,packaging==26.0,paramiko==4.0.0,pip==26.0.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.19.2,PyNaCl==1.6.2,pytest==9.0.2,requests==2.32.5,setuptools==82.0.0,urllib3==2.6.3 09:35:28 tests71: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh 7.1 09:35:28 using environment variables from ./karaf71.env 09:35:28 pytest -q transportpce_tests/7.1/test01_portmapping.py 09:36:08 buildlighty: OK ✔ in 42.75 seconds 09:36:08 testsPCE: freeze> python -m pip freeze --all 09:36:08 testsPCE: bcrypt==5.0.0,certifi==2026.2.25,cffi==2.0.0,charset-normalizer==3.4.4,click==8.3.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.61.1,gnpy4tpce==2.4.7,idna==3.11,iniconfig==2.3.0,injector==0.24.0,invoke==2.2.1,itsdangerous==2.2.0,Jinja2==3.1.6,kiwisolver==1.4.9,lxml==6.0.2,MarkupSafe==3.0.3,matplotlib==3.10.8,netconf-client==3.5.0,networkx==2.8.8,numpy==1.26.4,packaging==26.0,pandas==1.5.3,paramiko==4.0.0,pbr==5.11.1,pillow==12.1.1,pip==26.0.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.19.2,PyNaCl==1.6.2,pyparsing==3.3.2,pytest==9.0.2,python-dateutil==2.9.0.post0,pytz==2025.2,requests==2.32.5,scipy==1.17.1,setuptools==50.3.2,six==1.17.0,urllib3==2.6.3,Werkzeug==2.0.3,xlrd==1.2.0 09:36:08 testsPCE: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh pce 09:36:08 pytest -q transportpce_tests/pce/test01_pce.py 09:36:11 ............ [100%] 09:36:25 12 passed in 56.66s 09:36:26 pytest -q transportpce_tests/7.1/test02_otn_renderer.py 09:37:01 ..................................................... [100%] 09:38:09 20 passed in 120.62s (0:02:00) 09:38:09 pytest -q transportpce_tests/pce/test02_pce_400G.py 09:38:11 .................................. [100%] 09:38:56 12 passed in 46.99s 09:38:56 pytest -q transportpce_tests/pce/test03_gnpy.py 09:38:57 ....... [100%] 09:39:12 62 passed in 166.66s (0:02:46) 09:39:12 pytest -q transportpce_tests/7.1/test03_renderer_or_modes.py 09:39:12 ........ [100%] 09:39:35 8 passed in 37.86s 09:39:35 pytest -q transportpce_tests/pce/test04_pce_bug_fix.py 09:39:45 ............... [100%] 09:40:14 3 passed in 38.53s 09:40:14 .testsPCE: OK ✔ in 5 minutes 1.87 seconds 09:40:14 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 09:40:14 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 09:40:14 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 09:40:16 ...tests121: freeze> python -m pip freeze --all 09:40:21 tests_tapi: freeze> python -m pip freeze --all 09:40:21 tests200: freeze> python -m pip freeze --all 09:40:21 tests121: bcrypt==5.0.0,certifi==2026.2.25,cffi==2.0.0,charset-normalizer==3.4.4,cryptography==46.0.5,dict2xml==1.7.8,idna==3.11,iniconfig==2.3.0,invoke==2.2.1,lxml==6.0.2,netconf-client==3.5.0,packaging==26.0,paramiko==4.0.0,pip==26.0.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.19.2,PyNaCl==1.6.2,pytest==9.0.2,requests==2.32.5,setuptools==82.0.0,urllib3==2.6.3 09:40:21 tests121: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh 1.2.1 09:40:21 using environment variables from ./karaf121.env 09:40:21 pytest -q transportpce_tests/1.2.1/test01_portmapping.py 09:40:21 tests_tapi: bcrypt==5.0.0,certifi==2026.2.25,cffi==2.0.0,charset-normalizer==3.4.4,cryptography==46.0.5,dict2xml==1.7.8,idna==3.11,iniconfig==2.3.0,invoke==2.2.1,lxml==6.0.2,netconf-client==3.5.0,packaging==26.0,paramiko==4.0.0,pip==26.0.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.19.2,PyNaCl==1.6.2,pytest==9.0.2,requests==2.32.5,setuptools==82.0.0,urllib3==2.6.3 09:40:21 tests_tapi: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh tapi 09:40:21 using environment variables from ./karaf221.env 09:40:21 tests200: bcrypt==5.0.0,certifi==2026.2.25,cffi==2.0.0,charset-normalizer==3.4.4,cryptography==46.0.5,dict2xml==1.7.8,idna==3.11,iniconfig==2.3.0,invoke==2.2.1,lxml==6.0.2,netconf-client==3.5.0,packaging==26.0,paramiko==4.0.0,pip==26.0.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.19.2,PyNaCl==1.6.2,pytest==9.0.2,requests==2.32.5,setuptools==82.0.0,urllib3==2.6.3 09:40:21 tests200: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh oc200 09:40:21 pytest -q transportpce_tests/tapi/test01_abstracted_topology.py 09:40:21 using environment variables from ./karafoc200.env 09:40:21 pytest -q transportpce_tests/oc200/test01_portmapping.py 09:40:22 .................................. [100%] 09:41:33 48 passed in 141.33s (0:02:21) 09:41:34 pytest -q transportpce_tests/7.1/test04_renderer_regen_mode.py 09:41:35 ........ [100%] 09:41:44 10 passed in 82.79s (0:01:22) 09:41:44 pytest -q transportpce_tests/oc200/test02_topology.py 09:42:20 .................................................................. [100%] 09:43:07 14 passed in 82.72s (0:01:22) 09:43:08 pytest -q transportpce_tests/oc200/test03_renderer.py 09:43:08 [100%] 09:43:08 22 passed in 94.21s (0:01:34) 09:43:24 ....................... [100%] 09:43:55 16 passed in 46.90s 09:44:08 ..F.....FFFFFFFFFFFFFFFFFFF [100%] 09:44:53 =================================== FAILURES =================================== 09:44:53 ___________ TestTransportPCEPortmapping.test_02_rdm_device_connected ___________ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01?content=nonconfig' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01', query='content=nonconfig', fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01?content=nonconfig' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_02_rdm_device_connected(self): 09:44:53 > response = test_utils.check_device_connection("ROADMA01") 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:54: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:409: in check_device_connection 09:44:53 response = get_request(url[RESTCONF_VERSION].format('{}', node)) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:117: in get_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_02_rdm_device_connected 09:44:53 ___________ TestTransportPCEPortmapping.test_03_rdm_portmapping_info ___________ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/node-info' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/transportpce-portmapping:network/nodes=ROADMA01/node-info', query=None, fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/node-info' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_03_rdm_portmapping_info(self): 09:44:53 > response = test_utils.get_portmapping_node_attr("ROADMA01", "node-info", None) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:60: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 09:44:53 response = get_request(target_url) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:117: in get_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_03_rdm_portmapping_info 09:44:53 ______ TestTransportPCEPortmapping.test_04_rdm_portmapping_DEG1_TTP_TXRX _______ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=DEG1-TTP-TXRX' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=DEG1-TTP-TXRX', query=None, fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=DEG1-TTP-TXRX' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_04_rdm_portmapping_DEG1_TTP_TXRX(self): 09:44:53 > response = test_utils.get_portmapping_node_attr("ROADMA01", "mapping", "DEG1-TTP-TXRX") 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:73: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 09:44:53 response = get_request(target_url) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:117: in get_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_04_rdm_portmapping_DEG1_TTP_TXRX 09:44:53 ______ TestTransportPCEPortmapping.test_05_rdm_portmapping_SRG1_PP7_TXRX _______ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=SRG1-PP7-TXRX' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=SRG1-PP7-TXRX', query=None, fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=SRG1-PP7-TXRX' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_05_rdm_portmapping_SRG1_PP7_TXRX(self): 09:44:53 > response = test_utils.get_portmapping_node_attr("ROADMA01", "mapping", "SRG1-PP7-TXRX") 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:82: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 09:44:53 response = get_request(target_url) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:117: in get_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_05_rdm_portmapping_SRG1_PP7_TXRX 09:44:53 ______ TestTransportPCEPortmapping.test_06_rdm_portmapping_SRG3_PP1_TXRX _______ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=SRG3-PP1-TXRX' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=SRG3-PP1-TXRX', query=None, fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=SRG3-PP1-TXRX' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_06_rdm_portmapping_SRG3_PP1_TXRX(self): 09:44:53 > response = test_utils.get_portmapping_node_attr("ROADMA01", "mapping", "SRG3-PP1-TXRX") 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:91: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 09:44:53 response = get_request(target_url) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:117: in get_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_06_rdm_portmapping_SRG3_PP1_TXRX 09:44:53 __________ TestTransportPCEPortmapping.test_07_xpdr_device_connection __________ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'PUT' 09:44:53 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01' 09:44:53 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}}]}' 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '709', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01', query=None, fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'PUT' 09:44:53 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_07_xpdr_device_connection(self): 09:44:53 > response = test_utils.mount_device("XPDRA01", ('xpdra', self.NODE_VERSION)) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:100: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:381: in mount_device 09:44:53 response = put_request(url[RESTCONF_VERSION].format('{}', node), body) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:125: in put_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_07_xpdr_device_connection 09:44:53 __________ TestTransportPCEPortmapping.test_08_xpdr_device_connected ___________ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01?content=nonconfig' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01', query='content=nonconfig', fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01?content=nonconfig' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_08_xpdr_device_connected(self): 09:44:53 > response = test_utils.check_device_connection("XPDRA01") 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:104: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:409: in check_device_connection 09:44:53 response = get_request(url[RESTCONF_VERSION].format('{}', node)) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:117: in get_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_08_xpdr_device_connected 09:44:53 __________ TestTransportPCEPortmapping.test_09_xpdr_portmapping_info ___________ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/node-info' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/transportpce-portmapping:network/nodes=XPDRA01/node-info', query=None, fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/node-info' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_09_xpdr_portmapping_info(self): 09:44:53 > response = test_utils.get_portmapping_node_attr("XPDRA01", "node-info", None) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:110: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 09:44:53 response = get_request(target_url) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:117: in get_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_09_xpdr_portmapping_info 09:44:53 ________ TestTransportPCEPortmapping.test_10_xpdr_portmapping_NETWORK1 _________ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-NETWORK1' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-NETWORK1', query=None, fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-NETWORK1' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_10_xpdr_portmapping_NETWORK1(self): 09:44:53 > response = test_utils.get_portmapping_node_attr("XPDRA01", "mapping", "XPDR1-NETWORK1") 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:123: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 09:44:53 response = get_request(target_url) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:117: in get_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_10_xpdr_portmapping_NETWORK1 09:44:53 ________ TestTransportPCEPortmapping.test_11_xpdr_portmapping_NETWORK2 _________ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-NETWORK2' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-NETWORK2', query=None, fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-NETWORK2' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_11_xpdr_portmapping_NETWORK2(self): 09:44:53 > response = test_utils.get_portmapping_node_attr("XPDRA01", "mapping", "XPDR1-NETWORK2") 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:135: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 09:44:53 response = get_request(target_url) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:117: in get_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_11_xpdr_portmapping_NETWORK2 09:44:53 _________ TestTransportPCEPortmapping.test_12_xpdr_portmapping_CLIENT1 _________ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT1' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT1', query=None, fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT1' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_12_xpdr_portmapping_CLIENT1(self): 09:44:53 > response = test_utils.get_portmapping_node_attr("XPDRA01", "mapping", "XPDR1-CLIENT1") 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:147: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 09:44:53 response = get_request(target_url) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:117: in get_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_12_xpdr_portmapping_CLIENT1 09:44:53 _________ TestTransportPCEPortmapping.test_13_xpdr_portmapping_CLIENT2 _________ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT2' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT2', query=None, fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT2' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_13_xpdr_portmapping_CLIENT2(self): 09:44:53 > response = test_utils.get_portmapping_node_attr("XPDRA01", "mapping", "XPDR1-CLIENT2") 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:159: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 09:44:53 response = get_request(target_url) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:117: in get_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_13_xpdr_portmapping_CLIENT2 09:44:53 _________ TestTransportPCEPortmapping.test_14_xpdr_portmapping_CLIENT3 _________ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT3' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT3', query=None, fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT3' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_14_xpdr_portmapping_CLIENT3(self): 09:44:53 > response = test_utils.get_portmapping_node_attr("XPDRA01", "mapping", "XPDR1-CLIENT3") 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:170: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 09:44:53 response = get_request(target_url) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:117: in get_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_14_xpdr_portmapping_CLIENT3 09:44:53 _________ TestTransportPCEPortmapping.test_15_xpdr_portmapping_CLIENT4 _________ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT4' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT4', query=None, fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT4' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_15_xpdr_portmapping_CLIENT4(self): 09:44:53 > response = test_utils.get_portmapping_node_attr("XPDRA01", "mapping", "XPDR1-CLIENT4") 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:182: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 09:44:53 response = get_request(target_url) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:117: in get_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_15_xpdr_portmapping_CLIENT4 09:44:53 ________ TestTransportPCEPortmapping.test_16_xpdr_device_disconnection _________ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'DELETE' 09:44:53 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '0', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01', query=None, fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'DELETE' 09:44:53 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_16_xpdr_device_disconnection(self): 09:44:53 > response = test_utils.unmount_device("XPDRA01") 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:193: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:398: in unmount_device 09:44:53 response = delete_request(url[RESTCONF_VERSION].format('{}', node)) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:134: in delete_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_16_xpdr_device_disconnection 09:44:53 _________ TestTransportPCEPortmapping.test_17_xpdr_device_disconnected _________ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01?content=nonconfig' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01', query='content=nonconfig', fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01?content=nonconfig' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_17_xpdr_device_disconnected(self): 09:44:53 > response = test_utils.check_device_connection("XPDRA01") 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:197: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:409: in check_device_connection 09:44:53 response = get_request(url[RESTCONF_VERSION].format('{}', node)) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:117: in get_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_17_xpdr_device_disconnected 09:44:53 ________ TestTransportPCEPortmapping.test_18_xpdr_device_not_connected _________ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/node-info' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/transportpce-portmapping:network/nodes=XPDRA01/node-info', query=None, fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/node-info' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_18_xpdr_device_not_connected(self): 09:44:53 > response = test_utils.get_portmapping_node_attr("XPDRA01", "node-info", None) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:205: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 09:44:53 response = get_request(target_url) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:117: in get_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_18_xpdr_device_not_connected 09:44:53 _________ TestTransportPCEPortmapping.test_19_rdm_device_disconnection _________ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'DELETE' 09:44:53 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '0', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01', query=None, fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'DELETE' 09:44:53 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_19_rdm_device_disconnection(self): 09:44:53 > response = test_utils.unmount_device("ROADMA01") 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:213: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:398: in unmount_device 09:44:53 response = delete_request(url[RESTCONF_VERSION].format('{}', node)) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:134: in delete_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_19_rdm_device_disconnection 09:44:53 _________ TestTransportPCEPortmapping.test_20_rdm_device_disconnected __________ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01?content=nonconfig' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01', query='content=nonconfig', fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01?content=nonconfig' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_20_rdm_device_disconnected(self): 09:44:53 > response = test_utils.check_device_connection("ROADMA01") 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:217: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:409: in check_device_connection 09:44:53 response = get_request(url[RESTCONF_VERSION].format('{}', node)) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:117: in get_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_20_rdm_device_disconnected 09:44:53 _________ TestTransportPCEPortmapping.test_21_rdm_device_not_connected _________ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 > sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:44:53 raise err 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 address = ('localhost', 8191), timeout = 30, source_address = None 09:44:53 socket_options = [(6, 1, 1)] 09:44:53 09:44:53 def create_connection( 09:44:53 address: tuple[str, int], 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 source_address: tuple[str, int] | None = None, 09:44:53 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:44:53 ) -> socket.socket: 09:44:53 """Connect to *address* and return the socket object. 09:44:53 09:44:53 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:44:53 port)``) and return the socket object. Passing the optional 09:44:53 *timeout* parameter will set the timeout on the socket instance 09:44:53 before attempting to connect. If no *timeout* is supplied, the 09:44:53 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:44:53 is used. If *source_address* is set it must be a tuple of (host, port) 09:44:53 for the socket to bind as a source address before making the connection. 09:44:53 An host of '' or port 0 tells the OS to use the default. 09:44:53 """ 09:44:53 09:44:53 host, port = address 09:44:53 if host.startswith("["): 09:44:53 host = host.strip("[]") 09:44:53 err = None 09:44:53 09:44:53 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:44:53 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:44:53 # The original create_connection function always returns all records. 09:44:53 family = allowed_gai_family() 09:44:53 09:44:53 try: 09:44:53 host.encode("idna") 09:44:53 except UnicodeError: 09:44:53 raise LocationParseError(f"'{host}', label empty or too long") from None 09:44:53 09:44:53 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:44:53 af, socktype, proto, canonname, sa = res 09:44:53 sock = None 09:44:53 try: 09:44:53 sock = socket.socket(af, socktype, proto) 09:44:53 09:44:53 # If provided, set socket level options before connecting. 09:44:53 _set_socket_options(sock, socket_options) 09:44:53 09:44:53 if timeout is not _DEFAULT_TIMEOUT: 09:44:53 sock.settimeout(timeout) 09:44:53 if source_address: 09:44:53 sock.bind(source_address) 09:44:53 > sock.connect(sa) 09:44:53 E ConnectionRefusedError: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/node-info' 09:44:53 body = None 09:44:53 headers = {'User-Agent': 'python-requests/2.32.5', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:44:53 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 redirect = False, assert_same_host = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 09:44:53 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:44:53 decode_content = False, response_kw = {} 09:44:53 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/transportpce-portmapping:network/nodes=ROADMA01/node-info', query=None, fragment=None) 09:44:53 destination_scheme = None, conn = None, release_this_conn = True 09:44:53 http_tunnel_required = False, err = None, clean_exit = False 09:44:53 09:44:53 def urlopen( # type: ignore[override] 09:44:53 self, 09:44:53 method: str, 09:44:53 url: str, 09:44:53 body: _TYPE_BODY | None = None, 09:44:53 headers: typing.Mapping[str, str] | None = None, 09:44:53 retries: Retry | bool | int | None = None, 09:44:53 redirect: bool = True, 09:44:53 assert_same_host: bool = True, 09:44:53 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:44:53 pool_timeout: int | None = None, 09:44:53 release_conn: bool | None = None, 09:44:53 chunked: bool = False, 09:44:53 body_pos: _TYPE_BODY_POSITION | None = None, 09:44:53 preload_content: bool = True, 09:44:53 decode_content: bool = True, 09:44:53 **response_kw: typing.Any, 09:44:53 ) -> BaseHTTPResponse: 09:44:53 """ 09:44:53 Get a connection from the pool and perform an HTTP request. This is the 09:44:53 lowest level call for making a request, so you'll need to specify all 09:44:53 the raw details. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 More commonly, it's appropriate to use a convenience method 09:44:53 such as :meth:`request`. 09:44:53 09:44:53 .. note:: 09:44:53 09:44:53 `release_conn` will only behave as expected if 09:44:53 `preload_content=False` because we want to make 09:44:53 `preload_content=False` the default behaviour someday soon without 09:44:53 breaking backwards compatibility. 09:44:53 09:44:53 :param method: 09:44:53 HTTP request method (such as GET, POST, PUT, etc.) 09:44:53 09:44:53 :param url: 09:44:53 The URL to perform the request on. 09:44:53 09:44:53 :param body: 09:44:53 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:44:53 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:44:53 09:44:53 :param headers: 09:44:53 Dictionary of custom headers to send, such as User-Agent, 09:44:53 If-None-Match, etc. If None, pool headers are used. If provided, 09:44:53 these headers completely replace any pool-specific headers. 09:44:53 09:44:53 :param retries: 09:44:53 Configure the number of retries to allow before raising a 09:44:53 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:44:53 09:44:53 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:44:53 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:44:53 over different types of retries. 09:44:53 Pass an integer number to retry connection errors that many times, 09:44:53 but no other types of errors. Pass zero to never retry. 09:44:53 09:44:53 If ``False``, then retries are disabled and any exception is raised 09:44:53 immediately. Also, instead of raising a MaxRetryError on redirects, 09:44:53 the redirect response will be returned. 09:44:53 09:44:53 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:44:53 09:44:53 :param redirect: 09:44:53 If True, automatically handle redirects (status codes 301, 302, 09:44:53 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:44:53 will disable redirect, too. 09:44:53 09:44:53 :param assert_same_host: 09:44:53 If ``True``, will make sure that the host of the pool requests is 09:44:53 consistent else will raise HostChangedError. When ``False``, you can 09:44:53 use the pool on an HTTP proxy and request foreign hosts. 09:44:53 09:44:53 :param timeout: 09:44:53 If specified, overrides the default timeout for this one 09:44:53 request. It may be a float (in seconds) or an instance of 09:44:53 :class:`urllib3.util.Timeout`. 09:44:53 09:44:53 :param pool_timeout: 09:44:53 If set and the pool is set to block=True, then this method will 09:44:53 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:44:53 connection is available within the time period. 09:44:53 09:44:53 :param bool preload_content: 09:44:53 If True, the response's body will be preloaded into memory. 09:44:53 09:44:53 :param bool decode_content: 09:44:53 If True, will attempt to decode the body based on the 09:44:53 'content-encoding' header. 09:44:53 09:44:53 :param release_conn: 09:44:53 If False, then the urlopen call will not release the connection 09:44:53 back into the pool once a response is received (but will release if 09:44:53 you read the entire contents of the response such as when 09:44:53 `preload_content=True`). This is useful if you're not preloading 09:44:53 the response's content immediately. You will need to call 09:44:53 ``r.release_conn()`` on the response ``r`` to return the connection 09:44:53 back into the pool. If None, it takes the value of ``preload_content`` 09:44:53 which defaults to ``True``. 09:44:53 09:44:53 :param bool chunked: 09:44:53 If True, urllib3 will send the body using chunked transfer 09:44:53 encoding. Otherwise, urllib3 will send the body using the standard 09:44:53 content-length form. Defaults to False. 09:44:53 09:44:53 :param int body_pos: 09:44:53 Position to seek to in file-like body in the event of a retry or 09:44:53 redirect. Typically this won't need to be set because urllib3 will 09:44:53 auto-populate the value when needed. 09:44:53 """ 09:44:53 parsed_url = parse_url(url) 09:44:53 destination_scheme = parsed_url.scheme 09:44:53 09:44:53 if headers is None: 09:44:53 headers = self.headers 09:44:53 09:44:53 if not isinstance(retries, Retry): 09:44:53 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:44:53 09:44:53 if release_conn is None: 09:44:53 release_conn = preload_content 09:44:53 09:44:53 # Check host 09:44:53 if assert_same_host and not self.is_same_host(url): 09:44:53 raise HostChangedError(self, url, retries) 09:44:53 09:44:53 # Ensure that the URL we're connecting to is properly encoded 09:44:53 if url.startswith("/"): 09:44:53 url = to_str(_encode_target(url)) 09:44:53 else: 09:44:53 url = to_str(parsed_url.url) 09:44:53 09:44:53 conn = None 09:44:53 09:44:53 # Track whether `conn` needs to be released before 09:44:53 # returning/raising/recursing. Update this variable if necessary, and 09:44:53 # leave `release_conn` constant throughout the function. That way, if 09:44:53 # the function recurses, the original value of `release_conn` will be 09:44:53 # passed down into the recursive call, and its value will be respected. 09:44:53 # 09:44:53 # See issue #651 [1] for details. 09:44:53 # 09:44:53 # [1] 09:44:53 release_this_conn = release_conn 09:44:53 09:44:53 http_tunnel_required = connection_requires_http_tunnel( 09:44:53 self.proxy, self.proxy_config, destination_scheme 09:44:53 ) 09:44:53 09:44:53 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:44:53 # have to copy the headers dict so we can safely change it without those 09:44:53 # changes being reflected in anyone else's copy. 09:44:53 if not http_tunnel_required: 09:44:53 headers = headers.copy() # type: ignore[attr-defined] 09:44:53 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:44:53 09:44:53 # Must keep the exception bound to a separate variable or else Python 3 09:44:53 # complains about UnboundLocalError. 09:44:53 err = None 09:44:53 09:44:53 # Keep track of whether we cleanly exited the except block. This 09:44:53 # ensures we do proper cleanup in finally. 09:44:53 clean_exit = False 09:44:53 09:44:53 # Rewind body position, if needed. Record current position 09:44:53 # for future rewinds in the event of a redirect/retry. 09:44:53 body_pos = set_file_position(body, body_pos) 09:44:53 09:44:53 try: 09:44:53 # Request a connection from the queue. 09:44:53 timeout_obj = self._get_timeout(timeout) 09:44:53 conn = self._get_conn(timeout=pool_timeout) 09:44:53 09:44:53 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:44:53 09:44:53 # Is this a closed/new connection that requires CONNECT tunnelling? 09:44:53 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:44:53 try: 09:44:53 self._prepare_proxy(conn) 09:44:53 except (BaseSSLError, OSError, SocketTimeout) as e: 09:44:53 self._raise_timeout( 09:44:53 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:44:53 ) 09:44:53 raise 09:44:53 09:44:53 # If we're going to release the connection in ``finally:``, then 09:44:53 # the response doesn't need to know about the connection. Otherwise 09:44:53 # it will also try to release it and we'll have a double-release 09:44:53 # mess. 09:44:53 response_conn = conn if not release_conn else None 09:44:53 09:44:53 # Make the request on the HTTPConnection object 09:44:53 > response = self._make_request( 09:44:53 conn, 09:44:53 method, 09:44:53 url, 09:44:53 timeout=timeout_obj, 09:44:53 body=body, 09:44:53 headers=headers, 09:44:53 chunked=chunked, 09:44:53 retries=retries, 09:44:53 response_conn=response_conn, 09:44:53 preload_content=preload_content, 09:44:53 decode_content=decode_content, 09:44:53 **response_kw, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 09:44:53 conn.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 09:44:53 self.endheaders() 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 09:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 09:44:53 self.send(msg) 09:44:53 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 09:44:53 self.connect() 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 09:44:53 self.sock = self._new_conn() 09:44:53 ^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 09:44:53 def _new_conn(self) -> socket.socket: 09:44:53 """Establish a socket connection and set nodelay settings on it. 09:44:53 09:44:53 :return: New socket connection. 09:44:53 """ 09:44:53 try: 09:44:53 sock = connection.create_connection( 09:44:53 (self._dns_host, self.port), 09:44:53 self.timeout, 09:44:53 source_address=self.source_address, 09:44:53 socket_options=self.socket_options, 09:44:53 ) 09:44:53 except socket.gaierror as e: 09:44:53 raise NameResolutionError(self.host, self, e) from e 09:44:53 except SocketTimeout as e: 09:44:53 raise ConnectTimeoutError( 09:44:53 self, 09:44:53 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:44:53 ) from e 09:44:53 09:44:53 except OSError as e: 09:44:53 > raise NewConnectionError( 09:44:53 self, f"Failed to establish a new connection: {e}" 09:44:53 ) from e 09:44:53 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 09:44:53 09:44:53 The above exception was the direct cause of the following exception: 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 > resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 09:44:53 retries = retries.increment( 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:44:53 method = 'GET' 09:44:53 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/node-info' 09:44:53 response = None 09:44:53 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 09:44:53 _pool = 09:44:53 _stacktrace = 09:44:53 09:44:53 def increment( 09:44:53 self, 09:44:53 method: str | None = None, 09:44:53 url: str | None = None, 09:44:53 response: BaseHTTPResponse | None = None, 09:44:53 error: Exception | None = None, 09:44:53 _pool: ConnectionPool | None = None, 09:44:53 _stacktrace: TracebackType | None = None, 09:44:53 ) -> Self: 09:44:53 """Return a new Retry object with incremented retry counters. 09:44:53 09:44:53 :param response: A response object, or None, if the server did not 09:44:53 return a response. 09:44:53 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:44:53 :param Exception error: An error encountered during the request, or 09:44:53 None if the response was received successfully. 09:44:53 09:44:53 :return: A new ``Retry`` object. 09:44:53 """ 09:44:53 if self.total is False and error: 09:44:53 # Disabled, indicate to re-raise the error. 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 09:44:53 total = self.total 09:44:53 if total is not None: 09:44:53 total -= 1 09:44:53 09:44:53 connect = self.connect 09:44:53 read = self.read 09:44:53 redirect = self.redirect 09:44:53 status_count = self.status 09:44:53 other = self.other 09:44:53 cause = "unknown" 09:44:53 status = None 09:44:53 redirect_location = None 09:44:53 09:44:53 if error and self._is_connection_error(error): 09:44:53 # Connect retry? 09:44:53 if connect is False: 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif connect is not None: 09:44:53 connect -= 1 09:44:53 09:44:53 elif error and self._is_read_error(error): 09:44:53 # Read retry? 09:44:53 if read is False or method is None or not self._is_method_retryable(method): 09:44:53 raise reraise(type(error), error, _stacktrace) 09:44:53 elif read is not None: 09:44:53 read -= 1 09:44:53 09:44:53 elif error: 09:44:53 # Other retry? 09:44:53 if other is not None: 09:44:53 other -= 1 09:44:53 09:44:53 elif response and response.get_redirect_location(): 09:44:53 # Redirect retry? 09:44:53 if redirect is not None: 09:44:53 redirect -= 1 09:44:53 cause = "too many redirects" 09:44:53 response_redirect_location = response.get_redirect_location() 09:44:53 if response_redirect_location: 09:44:53 redirect_location = response_redirect_location 09:44:53 status = response.status 09:44:53 09:44:53 else: 09:44:53 # Incrementing because of a server error like a 500 in 09:44:53 # status_forcelist and the given method is in the allowed_methods 09:44:53 cause = ResponseError.GENERIC_ERROR 09:44:53 if response and response.status: 09:44:53 if status_count is not None: 09:44:53 status_count -= 1 09:44:53 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:44:53 status = response.status 09:44:53 09:44:53 history = self.history + ( 09:44:53 RequestHistory(method, url, error, status, redirect_location), 09:44:53 ) 09:44:53 09:44:53 new_retry = self.new( 09:44:53 total=total, 09:44:53 connect=connect, 09:44:53 read=read, 09:44:53 redirect=redirect, 09:44:53 status=status_count, 09:44:53 other=other, 09:44:53 history=history, 09:44:53 ) 09:44:53 09:44:53 if new_retry.is_exhausted(): 09:44:53 reason = error or ResponseError(cause) 09:44:53 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 09:44:53 09:44:53 During handling of the above exception, another exception occurred: 09:44:53 09:44:53 self = 09:44:53 09:44:53 def test_21_rdm_device_not_connected(self): 09:44:53 > response = test_utils.get_portmapping_node_attr("ROADMA01", "node-info", None) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 09:44:53 transportpce_tests/1.2.1/test01_portmapping.py:225: 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 09:44:53 response = get_request(target_url) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 transportpce_tests/common/test_utils.py:117: in get_request 09:44:53 return requests.request( 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:44:53 return session.request(method=method, url=url, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:44:53 resp = self.send(prep, **send_kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:44:53 r = adapter.send(request, **kwargs) 09:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 09:44:53 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:44:53 09:44:53 self = 09:44:53 request = , stream = False 09:44:53 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 09:44:53 proxies = OrderedDict() 09:44:53 09:44:53 def send( 09:44:53 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:44:53 ): 09:44:53 """Sends PreparedRequest object. Returns Response object. 09:44:53 09:44:53 :param request: The :class:`PreparedRequest ` being sent. 09:44:53 :param stream: (optional) Whether to stream the request content. 09:44:53 :param timeout: (optional) How long to wait for the server to send 09:44:53 data before giving up, as a float, or a :ref:`(connect timeout, 09:44:53 read timeout) ` tuple. 09:44:53 :type timeout: float or tuple or urllib3 Timeout object 09:44:53 :param verify: (optional) Either a boolean, in which case it controls whether 09:44:53 we verify the server's TLS certificate, or a string, in which case it 09:44:53 must be a path to a CA bundle to use 09:44:53 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:44:53 :param proxies: (optional) The proxies dictionary to apply to the request. 09:44:53 :rtype: requests.Response 09:44:53 """ 09:44:53 09:44:53 try: 09:44:53 conn = self.get_connection_with_tls_context( 09:44:53 request, verify, proxies=proxies, cert=cert 09:44:53 ) 09:44:53 except LocationValueError as e: 09:44:53 raise InvalidURL(e, request=request) 09:44:53 09:44:53 self.cert_verify(conn, request.url, verify, cert) 09:44:53 url = self.request_url(request, proxies) 09:44:53 self.add_headers( 09:44:53 request, 09:44:53 stream=stream, 09:44:53 timeout=timeout, 09:44:53 verify=verify, 09:44:53 cert=cert, 09:44:53 proxies=proxies, 09:44:53 ) 09:44:53 09:44:53 chunked = not (request.body is None or "Content-Length" in request.headers) 09:44:53 09:44:53 if isinstance(timeout, tuple): 09:44:53 try: 09:44:53 connect, read = timeout 09:44:53 timeout = TimeoutSauce(connect=connect, read=read) 09:44:53 except ValueError: 09:44:53 raise ValueError( 09:44:53 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:44:53 f"or a single float to set both timeouts to the same value." 09:44:53 ) 09:44:53 elif isinstance(timeout, TimeoutSauce): 09:44:53 pass 09:44:53 else: 09:44:53 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:44:53 09:44:53 try: 09:44:53 resp = conn.urlopen( 09:44:53 method=request.method, 09:44:53 url=url, 09:44:53 body=request.body, 09:44:53 headers=request.headers, 09:44:53 redirect=False, 09:44:53 assert_same_host=False, 09:44:53 preload_content=False, 09:44:53 decode_content=False, 09:44:53 retries=self.max_retries, 09:44:53 timeout=timeout, 09:44:53 chunked=chunked, 09:44:53 ) 09:44:53 09:44:53 except (ProtocolError, OSError) as err: 09:44:53 raise ConnectionError(err, request=request) 09:44:53 09:44:53 except MaxRetryError as e: 09:44:53 if isinstance(e.reason, ConnectTimeoutError): 09:44:53 # TODO: Remove this in 3.0.0: see #2811 09:44:53 if not isinstance(e.reason, NewConnectionError): 09:44:53 raise ConnectTimeout(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, ResponseError): 09:44:53 raise RetryError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _ProxyError): 09:44:53 raise ProxyError(e, request=request) 09:44:53 09:44:53 if isinstance(e.reason, _SSLError): 09:44:53 # This branch is for urllib3 v1.22 and later. 09:44:53 raise SSLError(e, request=request) 09:44:53 09:44:53 > raise ConnectionError(e, request=request) 09:44:53 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")) 09:44:53 09:44:53 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 09:44:53 ----------------------------- Captured stdout call ----------------------------- 09:44:53 execution of test_21_rdm_device_not_connected 09:44:53 --------------------------- Captured stdout teardown --------------------------- 09:44:53 all processes killed 09:44:53 ODL log file stored 09:44:53 =========================== short test summary info ============================ 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_02_rdm_device_connected 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_03_rdm_portmapping_info 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_04_rdm_portmapping_DEG1_TTP_TXRX 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_05_rdm_portmapping_SRG1_PP7_TXRX 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_06_rdm_portmapping_SRG3_PP1_TXRX 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_07_xpdr_device_connection 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_08_xpdr_device_connected 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_09_xpdr_portmapping_info 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_10_xpdr_portmapping_NETWORK1 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_11_xpdr_portmapping_NETWORK2 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_12_xpdr_portmapping_CLIENT1 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_13_xpdr_portmapping_CLIENT2 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_14_xpdr_portmapping_CLIENT3 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_15_xpdr_portmapping_CLIENT4 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_16_xpdr_device_disconnection 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_17_xpdr_device_disconnected 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_18_xpdr_device_not_connected 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_19_rdm_device_disconnection 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_20_rdm_device_disconnected 09:44:53 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_21_rdm_device_not_connected 09:44:53 20 failed, 1 passed in 271.72s (0:04:31) 09:44:53 tests71: OK ✔ in 7 minutes 47.6 seconds 09:44:53 tests200: OK ✔ in 3 minutes 41.13 seconds 09:44:53 tests121: exit 1 (272.06 seconds) /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh 1.2.1 pid=8961 09:47:28 ........ [100%] 09:48:47 51 passed in 505.95s (0:08:25) 09:48:47 pytest -q transportpce_tests/tapi/test02_full_topology.py 09:49:39 .................................... [100%] 09:57:15 36 passed in 507.62s (0:08:27) 09:57:15 pytest -q transportpce_tests/tapi/test03_tapi_device_change_notifications.py 09:58:03 ....................................................................... [100%] 10:02:33 71 passed in 317.69s (0:05:17) 10:02:33 pytest -q transportpce_tests/tapi/test04_topo_extension.py 10:03:23 ................... [100%] 10:04:57 19 passed in 143.64s (0:02:23) 10:04:57 pytest -q transportpce_tests/tapi/test05_pce_tapi.py 10:06:59 ...................... [100%] 10:12:35 22 passed in 457.40s (0:07:37) 10:12:35 tests121: FAIL ✖ in 4 minutes 39.37 seconds 10:12:35 tests_tapi: OK ✔ in 32 minutes 21.25 seconds 10:12:35 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 10:12:42 tests221: freeze> python -m pip freeze --all 10:12:42 tests221: bcrypt==5.0.0,certifi==2026.2.25,cffi==2.0.0,charset-normalizer==3.4.4,cryptography==46.0.5,dict2xml==1.7.8,idna==3.11,iniconfig==2.3.0,invoke==2.2.1,lxml==6.0.2,netconf-client==3.5.0,packaging==26.0,paramiko==4.0.0,pip==26.0.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.19.2,PyNaCl==1.6.2,pytest==9.0.2,requests==2.32.5,setuptools==82.0.0,urllib3==2.6.3 10:12:42 tests221: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh 2.2.1 10:12:42 using environment variables from ./karaf221.env 10:12:42 pytest -q transportpce_tests/2.2.1/test01_portmapping.py 10:13:17 ................................... [100%] 10:13:57 35 passed in 74.61s (0:01:14) 10:13:57 pytest -q transportpce_tests/2.2.1/test02_topo_portmapping.py 10:14:29 ...... [100%] 10:14:42 6 passed in 45.11s 10:14:42 pytest -q transportpce_tests/2.2.1/test03_topology.py 10:15:26 ............................................ [100%] 10:17:01 44 passed in 138.55s (0:02:18) 10:17:01 pytest -q transportpce_tests/2.2.1/test04_otn_topology.py 10:17:36 ............ [100%] 10:18:00 12 passed in 58.66s 10:18:00 pytest -q transportpce_tests/2.2.1/test05_flex_grid.py 10:18:26 ................ [100%] 10:19:55 16 passed in 114.27s (0:01:54) 10:19:55 pytest -q transportpce_tests/2.2.1/test06_renderer_service_path_nominal.py 10:20:25 ............................... [100%] 10:20:32 31 passed in 37.11s 10:20:32 pytest -q transportpce_tests/2.2.1/test07_otn_renderer.py 10:21:08 .......................... [100%] 10:22:04 26 passed in 91.30s (0:01:31) 10:22:04 pytest -q transportpce_tests/2.2.1/test08_otn_sh_renderer.py 10:22:40 ...................... [100%] 10:23:44 22 passed in 99.70s (0:01:39) 10:23:44 pytest -q transportpce_tests/2.2.1/test09_olm.py 10:24:24 ........................................ [100%] 10:26:46 40 passed in 181.84s (0:03:01) 10:26:46 pytest -q transportpce_tests/2.2.1/test11_otn_end2end.py 10:27:28 ........................................................................ [ 74%] 10:33:05 ......................... [100%] 10:37:57 97 passed in 670.74s (0:11:10) 10:37:57 pytest -q transportpce_tests/2.2.1/test12_end2end.py 10:38:38 ...................................................... [100%] 10:45:26 54 passed in 448.74s (0:07:28) 10:45:26 pytest -q transportpce_tests/2.2.1/test14_otn_switch_end2end.py 10:46:20 ........................................................................ [ 71%] 10:51:28 ............................. [100%] 10:56:37 101 passed in 670.95s (0:11:10) 10:56:37 pytest -q transportpce_tests/2.2.1/test15_otn_end2end_with_intermediate_switch.py 10:57:31 ........................................................................ [ 67%] 11:03:18 ................................... [100%] 11:06:39 107 passed in 600.89s (0:10:00) 11:06:39 pytest -q transportpce_tests/2.2.1/test16_freq_end2end.py 11:07:21 ............................................. [100%] 11:09:58 45 passed in 199.21s (0:03:19) 11:09:58 tests221: OK ✔ in 57 minutes 23.18 seconds 11:09:58 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 11:10:06 tests_hybrid: freeze> python -m pip freeze --all 11:10:06 tests_hybrid: bcrypt==5.0.0,certifi==2026.2.25,cffi==2.0.0,charset-normalizer==3.4.4,cryptography==46.0.5,dict2xml==1.7.8,idna==3.11,iniconfig==2.3.0,invoke==2.2.1,lxml==6.0.2,netconf-client==3.5.0,packaging==26.0,paramiko==4.0.0,pip==26.0.1,pluggy==1.6.0,psutil==7.2.2,pycparser==3.0,Pygments==2.19.2,PyNaCl==1.6.2,pytest==9.0.2,requests==2.32.5,setuptools==82.0.0,urllib3==2.6.3 11:10:06 tests_hybrid: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh hybrid 11:10:06 using environment variables from ./karaf221.env 11:10:06 pytest -q transportpce_tests/hybrid/test01_device_change_notifications.py 11:10:46 ................................................... [100%] 11:15:33 51 passed in 326.36s (0:05:26) 11:15:33 pytest -q transportpce_tests/hybrid/test02_B100G_end2end.py 11:16:15 ........................................................................ [ 66%] 11:20:36 ..................................... [100%] 11:22:42 109 passed in 428.35s (0:07:08) 11:22:42 pytest -q transportpce_tests/hybrid/test03_autonomous_reroute.py 11:23:29 ..................................................... [100%] 11:27:01 53 passed in 258.87s (0:04:18) 11:27:01 buildcontroller: OK (112.81=setup[7.99]+cmd[104.82] seconds) 11:27:01 sims: OK (9.63=setup[6.92]+cmd[2.71] seconds) 11:27:01 build_karaf_tests121: OK (60.19=setup[9.63]+cmd[50.56] seconds) 11:27:01 testsPCE: OK (301.87=setup[56.43]+cmd[245.44] seconds) 11:27:01 tests121: FAIL code 1 (279.37=setup[7.31]+cmd[272.06] seconds) 11:27:01 build_karaf_tests221: OK (60.81=setup[9.60]+cmd[51.21] seconds) 11:27:01 tests_tapi: OK (1941.25=setup[7.35]+cmd[1933.90] seconds) 11:27:01 tests221: OK (3443.18=setup[7.25]+cmd[3435.93] seconds) 11:27:01 build_karaf_tests71: OK (59.15=setup[9.65]+cmd[49.50] seconds) 11:27:01 tests71: OK (467.60=setup[6.88]+cmd[460.72] seconds) 11:27:01 build_karaf_tests200: OK (60.20=setup[9.59]+cmd[50.61] seconds) 11:27:01 tests200: OK (221.13=setup[7.35]+cmd[213.78] seconds) 11:27:01 tests_hybrid: OK (1022.85=setup[8.37]+cmd[1014.48] seconds) 11:27:01 buildlighty: OK (42.75=setup[7.35]+cmd[35.39] seconds) 11:27:01 docs: OK (28.01=setup[25.43]+cmd[2.58] seconds) 11:27:01 docs-linkcheck: OK (29.87=setup[25.06]+cmd[4.81] seconds) 11:27:01 checkbashisms: OK (3.40=setup[2.13]+cmd[0.01,0.05,1.22] seconds) 11:27:01 pre-commit: OK (48.17=setup[2.93]+cmd[0.00,0.00,36.85,8.39] seconds) 11:27:01 pylint: OK (32.15=setup[3.44]+cmd[28.71] seconds) 11:27:01 evaluation failed :( (6882.83 seconds) 11:27:01 + tox_status=1 11:27:01 + echo '---> Completed tox runs' 11:27:01 ---> Completed tox runs 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/build_karaf_tests121/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=build_karaf_tests121 11:27:01 + cp -r .tox/build_karaf_tests121/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/build_karaf_tests121 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/build_karaf_tests200/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=build_karaf_tests200 11:27:01 + cp -r .tox/build_karaf_tests200/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/build_karaf_tests200 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/build_karaf_tests221/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=build_karaf_tests221 11:27:01 + cp -r .tox/build_karaf_tests221/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/build_karaf_tests221 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/build_karaf_tests71/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=build_karaf_tests71 11:27:01 + cp -r .tox/build_karaf_tests71/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/build_karaf_tests71 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/buildcontroller/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=buildcontroller 11:27:01 + cp -r .tox/buildcontroller/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/buildcontroller 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/buildlighty/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=buildlighty 11:27:01 + cp -r .tox/buildlighty/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/buildlighty 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/checkbashisms/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=checkbashisms 11:27:01 + cp -r .tox/checkbashisms/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/checkbashisms 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/docs-linkcheck/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=docs-linkcheck 11:27:01 + cp -r .tox/docs-linkcheck/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/docs-linkcheck 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/docs/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=docs 11:27:01 + cp -r .tox/docs/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/docs 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/pre-commit/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=pre-commit 11:27:01 + cp -r .tox/pre-commit/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/pre-commit 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/pylint/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=pylint 11:27:01 + cp -r .tox/pylint/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/pylint 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/sims/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=sims 11:27:01 + cp -r .tox/sims/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/sims 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/tests121/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=tests121 11:27:01 + cp -r .tox/tests121/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests121 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/tests200/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=tests200 11:27:01 + cp -r .tox/tests200/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests200 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/tests221/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=tests221 11:27:01 + cp -r .tox/tests221/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests221 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/tests71/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=tests71 11:27:01 + cp -r .tox/tests71/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests71 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/testsPCE/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=testsPCE 11:27:01 + cp -r .tox/testsPCE/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/testsPCE 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/tests_hybrid/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=tests_hybrid 11:27:01 + cp -r .tox/tests_hybrid/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests_hybrid 11:27:01 + for i in .tox/*/log 11:27:01 ++ echo .tox/tests_tapi/log 11:27:01 ++ awk -F/ '{print $2}' 11:27:01 + tox_env=tests_tapi 11:27:01 + cp -r .tox/tests_tapi/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests_tapi 11:27:01 + DOC_DIR=docs/_build/html 11:27:01 + [[ -d docs/_build/html ]] 11:27:01 + echo '---> Archiving generated docs' 11:27:01 ---> Archiving generated docs 11:27:01 + mv docs/_build/html /w/workspace/transportpce-tox-verify-transportpce-master/archives/docs 11:27:01 + echo '---> tox-run.sh ends' 11:27:01 ---> tox-run.sh ends 11:27:01 + test 1 -eq 0 11:27:01 + exit 1 11:27:01 ++ '[' 1 = 1 ']' 11:27:01 ++ '[' -x /usr/bin/clear_console ']' 11:27:01 ++ /usr/bin/clear_console -q 11:27:01 Build step 'Execute shell' marked build as failure 11:27:01 $ ssh-agent -k 11:27:02 unset SSH_AUTH_SOCK; 11:27:02 unset SSH_AGENT_PID; 11:27:02 echo Agent pid 1573 killed; 11:27:02 [ssh-agent] Stopped. 11:27:02 [PostBuildScript] - [INFO] Executing post build scripts. 11:27:02 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins14240710832914936201.sh 11:27:02 ---> sysstat.sh 11:27:02 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins16356335427955316952.sh 11:27:02 ---> package-listing.sh 11:27:02 ++ facter osfamily 11:27:02 ++ tr '[:upper:]' '[:lower:]' 11:27:02 + OS_FAMILY=debian 11:27:02 + workspace=/w/workspace/transportpce-tox-verify-transportpce-master 11:27:02 + START_PACKAGES=/tmp/packages_start.txt 11:27:02 + END_PACKAGES=/tmp/packages_end.txt 11:27:02 + DIFF_PACKAGES=/tmp/packages_diff.txt 11:27:02 + PACKAGES=/tmp/packages_start.txt 11:27:02 + '[' /w/workspace/transportpce-tox-verify-transportpce-master ']' 11:27:02 + PACKAGES=/tmp/packages_end.txt 11:27:02 + case "${OS_FAMILY}" in 11:27:02 + dpkg -l 11:27:02 + grep '^ii' 11:27:03 + '[' -f /tmp/packages_start.txt ']' 11:27:03 + '[' -f /tmp/packages_end.txt ']' 11:27:03 + diff /tmp/packages_start.txt /tmp/packages_end.txt 11:27:03 + '[' /w/workspace/transportpce-tox-verify-transportpce-master ']' 11:27:03 + mkdir -p /w/workspace/transportpce-tox-verify-transportpce-master/archives/ 11:27:03 + cp -f /tmp/packages_diff.txt /tmp/packages_end.txt /tmp/packages_start.txt /w/workspace/transportpce-tox-verify-transportpce-master/archives/ 11:27:03 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins9723750875423028513.sh 11:27:03 ---> capture-instance-metadata.sh 11:27:03 Setup pyenv: 11:27:03 system 11:27:03 3.8.20 11:27:03 3.9.20 11:27:03 3.10.15 11:27:03 * 3.11.10 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 11:27:03 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-b9bO from file:/tmp/.os_lf_venv 11:27:03 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 11:27:03 lf-activate-venv(): INFO: Attempting to install with network-safe options... 11:27:05 lf-activate-venv(): INFO: Base packages installed successfully 11:27:05 lf-activate-venv(): INFO: Installing additional packages: lftools 11:27:18 lf-activate-venv(): INFO: Adding /tmp/venv-b9bO/bin to PATH 11:27:18 INFO: Running in OpenStack, capturing instance metadata 11:27:18 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins2145140422817572161.sh 11:27:18 provisioning config files... 11:27:19 Could not find credentials [logs] for transportpce-tox-verify-transportpce-master #4460 11:27:19 copy managed file [jenkins-log-archives-settings] to file:/w/workspace/transportpce-tox-verify-transportpce-master@tmp/config2594886178092526020tmp 11:27:19 Regular expression run condition: Expression=[^.*logs-s3.*], Label=[odl-logs-s3-cloudfront-index] 11:27:19 Run condition [Regular expression match] enabling perform for step [Provide Configuration files] 11:27:19 provisioning config files... 11:27:19 copy managed file [jenkins-s3-log-ship] to file:/home/jenkins/.aws/credentials 11:27:19 [EnvInject] - Injecting environment variables from a build step. 11:27:19 [EnvInject] - Injecting as environment variables the properties content 11:27:19 SERVER_ID=logs 11:27:19 11:27:19 [EnvInject] - Variables injected successfully. 11:27:19 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins14520583494413158035.sh 11:27:19 ---> create-netrc.sh 11:27:19 WARN: Log server credential not found. 11:27:19 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins9714566099698988503.sh 11:27:19 ---> python-tools-install.sh 11:27:19 Setup pyenv: 11:27:19 system 11:27:19 3.8.20 11:27:19 3.9.20 11:27:19 3.10.15 11:27:19 * 3.11.10 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 11:27:20 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-b9bO from file:/tmp/.os_lf_venv 11:27:20 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 11:27:20 lf-activate-venv(): INFO: Attempting to install with network-safe options... 11:27:21 lf-activate-venv(): INFO: Base packages installed successfully 11:27:21 lf-activate-venv(): INFO: Installing additional packages: lftools 11:27:30 lf-activate-venv(): INFO: Adding /tmp/venv-b9bO/bin to PATH 11:27:30 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins8890059870363856761.sh 11:27:30 ---> sudo-logs.sh 11:27:30 Archiving 'sudo' log.. 11:27:31 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins14458331532043434457.sh 11:27:31 ---> job-cost.sh 11:27:31 INFO: Activating Python virtual environment... 11:27:31 Setup pyenv: 11:27:31 system 11:27:31 3.8.20 11:27:31 3.9.20 11:27:31 3.10.15 11:27:31 * 3.11.10 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 11:27:31 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-b9bO from file:/tmp/.os_lf_venv 11:27:31 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 11:27:31 lf-activate-venv(): INFO: Attempting to install with network-safe options... 11:27:33 lf-activate-venv(): INFO: Base packages installed successfully 11:27:33 lf-activate-venv(): INFO: Installing additional packages: zipp==1.1.0 python-openstackclient urllib3~=1.26.15 11:27:39 lf-activate-venv(): INFO: Adding /tmp/venv-b9bO/bin to PATH 11:27:39 INFO: No stack-cost file found 11:27:39 INFO: Instance uptime: 7041s 11:27:39 INFO: Fetching instance metadata (attempt 1 of 3)... 11:27:39 DEBUG: URL: http://169.254.169.254/latest/meta-data/instance-type 11:27:39 INFO: Successfully fetched instance metadata 11:27:39 INFO: Instance type: v3-standard-4 11:27:39 INFO: Retrieving pricing info for: v3-standard-4 11:27:39 INFO: Fetching Vexxhost pricing API (attempt 1 of 3)... 11:27:39 DEBUG: URL: https://pricing.vexxhost.net/v1/pricing/v3-standard-4/cost?seconds=7041 11:27:40 INFO: Successfully fetched Vexxhost pricing API 11:27:40 INFO: Retrieved cost: 0.22 11:27:40 INFO: Retrieved resource: v3-standard-4 11:27:40 INFO: Creating archive directory: /w/workspace/transportpce-tox-verify-transportpce-master/archives/cost 11:27:40 INFO: Archiving costs to: /w/workspace/transportpce-tox-verify-transportpce-master/archives/cost.csv 11:27:40 INFO: Successfully archived job cost data 11:27:40 DEBUG: Cost data: transportpce-tox-verify-transportpce-master,4460,2026-02-27 11:27:40,v3-standard-4,7041,0.22,0.00,FAILURE 11:27:40 [transportpce-tox-verify-transportpce-master] $ /bin/bash -l /tmp/jenkins13335200572265465700.sh 11:27:40 ---> logs-deploy.sh 11:27:40 Setup pyenv: 11:27:40 system 11:27:40 3.8.20 11:27:40 3.9.20 11:27:40 3.10.15 11:27:40 * 3.11.10 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 11:27:40 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-b9bO from file:/tmp/.os_lf_venv 11:27:40 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 11:27:40 lf-activate-venv(): INFO: Attempting to install with network-safe options... 11:27:42 lf-activate-venv(): INFO: Base packages installed successfully 11:27:42 lf-activate-venv(): INFO: Installing additional packages: lftools urllib3~=1.26.15 11:27:51 lf-activate-venv(): INFO: Adding /tmp/venv-b9bO/bin to PATH 11:27:51 WARNING: Nexus logging server not set 11:27:51 INFO: S3 path logs/releng/vex-yul-odl-jenkins-1/transportpce-tox-verify-transportpce-master/4460/ 11:27:51 INFO: archiving logs to S3 11:27:51 /tmp/venv-b9bO/lib/python3.11/site-packages/requests/__init__.py:113: RequestsDependencyWarning: urllib3 (1.26.20) or chardet (6.0.0.post1)/charset_normalizer (3.4.4) doesn't match a supported version! 11:27:51 warnings.warn( 11:27:53 ---> uname -a: 11:27:53 Linux prd-ubuntu2204-docker-4c-16g-23681 5.15.0-168-generic #178-Ubuntu SMP Fri Jan 9 19:05:03 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux 11:27:53 11:27:53 11:27:53 ---> lscpu: 11:27:53 Architecture: x86_64 11:27:53 CPU op-mode(s): 32-bit, 64-bit 11:27:53 Address sizes: 40 bits physical, 48 bits virtual 11:27:53 Byte Order: Little Endian 11:27:53 CPU(s): 4 11:27:53 On-line CPU(s) list: 0-3 11:27:53 Vendor ID: AuthenticAMD 11:27:53 Model name: AMD EPYC-Rome Processor 11:27:53 CPU family: 23 11:27:53 Model: 49 11:27:53 Thread(s) per core: 1 11:27:53 Core(s) per socket: 1 11:27:53 Socket(s): 4 11:27:53 Stepping: 0 11:27:53 BogoMIPS: 5599.99 11:27:53 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 11:27:53 Virtualization: AMD-V 11:27:53 Hypervisor vendor: KVM 11:27:53 Virtualization type: full 11:27:53 L1d cache: 128 KiB (4 instances) 11:27:53 L1i cache: 128 KiB (4 instances) 11:27:53 L2 cache: 2 MiB (4 instances) 11:27:53 L3 cache: 64 MiB (4 instances) 11:27:53 NUMA node(s): 1 11:27:53 NUMA node0 CPU(s): 0-3 11:27:53 Vulnerability Gather data sampling: Not affected 11:27:53 Vulnerability Indirect target selection: Not affected 11:27:53 Vulnerability Itlb multihit: Not affected 11:27:53 Vulnerability L1tf: Not affected 11:27:53 Vulnerability Mds: Not affected 11:27:53 Vulnerability Meltdown: Not affected 11:27:53 Vulnerability Mmio stale data: Not affected 11:27:53 Vulnerability Reg file data sampling: Not affected 11:27:53 Vulnerability Retbleed: Mitigation; untrained return thunk; SMT disabled 11:27:53 Vulnerability Spec rstack overflow: Mitigation; SMT disabled 11:27:53 Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp 11:27:53 Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization 11:27:53 Vulnerability Spectre v2: Mitigation; Retpolines; IBPB conditional; STIBP disabled; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected 11:27:53 Vulnerability Srbds: Not affected 11:27:53 Vulnerability Tsa: Not affected 11:27:53 Vulnerability Tsx async abort: Not affected 11:27:53 Vulnerability Vmscape: Not affected 11:27:53 11:27:53 11:27:53 ---> nproc: 11:27:53 4 11:27:53 11:27:53 11:27:53 ---> df -h: 11:27:53 Filesystem Size Used Avail Use% Mounted on 11:27:53 tmpfs 1.6G 1.1M 1.6G 1% /run 11:27:53 /dev/vda1 78G 17G 61G 22% / 11:27:53 tmpfs 7.9G 0 7.9G 0% /dev/shm 11:27:53 tmpfs 5.0M 0 5.0M 0% /run/lock 11:27:53 /dev/vda15 105M 6.1M 99M 6% /boot/efi 11:27:53 tmpfs 1.6G 4.0K 1.6G 1% /run/user/1001 11:27:53 11:27:53 11:27:53 ---> free -m: 11:27:53 total used free shared buff/cache available 11:27:53 Mem: 15989 713 11727 3 3548 14929 11:27:53 Swap: 1023 0 1023 11:27:53 11:27:53 11:27:53 ---> ip addr: 11:27:53 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 11:27:53 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 11:27:53 inet 127.0.0.1/8 scope host lo 11:27:53 valid_lft forever preferred_lft forever 11:27:53 inet6 ::1/128 scope host 11:27:53 valid_lft forever preferred_lft forever 11:27:53 2: ens3: mtu 1458 qdisc mq state UP group default qlen 1000 11:27:53 link/ether fa:16:3e:51:cb:e1 brd ff:ff:ff:ff:ff:ff 11:27:53 altname enp0s3 11:27:53 inet 10.30.171.115/23 metric 100 brd 10.30.171.255 scope global dynamic ens3 11:27:53 valid_lft 79353sec preferred_lft 79353sec 11:27:53 inet6 fe80::f816:3eff:fe51:cbe1/64 scope link 11:27:53 valid_lft forever preferred_lft forever 11:27:53 3: docker0: mtu 1458 qdisc noqueue state DOWN group default 11:27:53 link/ether 9e:d8:7c:a0:a8:47 brd ff:ff:ff:ff:ff:ff 11:27:53 inet 10.250.0.254/24 brd 10.250.0.255 scope global docker0 11:27:53 valid_lft forever preferred_lft forever 11:27:53 11:27:53 11:27:53 ---> sar -b -r -n DEV: 11:27:53 Linux 5.15.0-168-generic (prd-ubuntu2204-docker-4c-16g-23681) 02/27/26 _x86_64_ (4 CPU) 11:27:53 11:27:53 09:30:28 LINUX RESTART (4 CPU) 11:27:53 11:27:53 09:40:17 tps rtps wtps dtps bread/s bwrtn/s bdscd/s 11:27:53 09:50:18 37.95 5.58 30.65 1.72 185.14 3568.29 1741.91 11:27:53 10:00:29 5.01 0.09 4.72 0.19 5.14 121.13 282.19 11:27:53 10:10:29 7.24 0.05 6.84 0.35 5.25 214.73 677.59 11:27:53 10:20:29 19.71 1.98 16.96 0.78 97.49 764.91 1060.01 11:27:53 10:30:29 11.91 0.01 11.38 0.51 0.99 360.65 511.68 11:27:53 10:40:29 5.04 0.00 4.88 0.16 0.16 129.79 118.24 11:27:53 10:50:20 5.52 0.20 5.13 0.19 7.95 165.77 386.83 11:27:53 11:00:10 20.84 0.04 5.05 15.76 1.56 152.41 213121.83 11:27:53 11:10:07 5.98 0.01 5.72 0.25 0.48 184.46 82.33 11:27:53 11:20:29 8.55 0.05 8.19 0.30 1.50 509.79 453.88 11:27:53 Average: 12.75 0.80 9.96 1.99 30.54 618.05 21462.99 11:27:53 11:27:53 09:40:17 kbmemfree kbavail kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty 11:27:53 09:50:18 7996880 10300160 5638756 34.44 258212 2107284 6638576 38.11 1682028 6202480 48 11:27:53 10:00:29 8898812 11211440 4727440 28.87 259356 2115568 5434652 31.19 1692536 5303656 236 11:27:53 10:10:29 7396972 9728092 6209868 37.93 260740 2132688 6926908 39.76 1698804 6783840 1068 11:27:53 10:20:29 10440676 12941452 2998696 18.31 266708 2296328 3696744 21.22 1729636 3734596 296 11:27:53 10:30:29 8784468 11338708 4600388 28.10 268284 2348216 5232192 30.03 1732952 5379176 76 11:27:53 10:40:29 8958304 11529896 4409052 26.93 269036 2364812 5162196 29.63 1734356 5199256 304 11:27:53 10:50:20 7392980 9988440 5949560 36.34 270604 2387124 6646056 38.15 1738104 6751144 344 11:27:53 11:00:10 7474208 10095812 5842204 35.68 271660 2412208 6607396 37.93 1746280 6667504 112 11:27:53 11:10:07 12583924 15323764 617080 3.77 275316 2526188 1310828 7.52 1776536 1534952 94584 11:27:53 11:20:29 8655068 11421932 4517084 27.59 276152 2552176 5137968 29.49 1786156 5454176 216 11:27:53 Average: 8858229 11387970 4551013 27.80 267607 2324259 5279352 30.30 1731739 5301078 9728 11:27:53 11:27:53 09:40:17 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil 11:27:53 09:50:18 lo 19.46 19.46 15.48 15.48 0.00 0.00 0.00 0.00 11:27:53 09:50:18 ens3 2.32 1.65 0.58 2.47 0.00 0.00 0.00 0.00 11:27:53 09:50:18 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:27:53 10:00:29 lo 10.33 10.33 5.07 5.07 0.00 0.00 0.00 0.00 11:27:53 10:00:29 ens3 0.58 0.37 0.11 0.07 0.00 0.00 0.00 0.00 11:27:53 10:00:29 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:27:53 10:10:29 lo 12.32 12.32 7.26 7.26 0.00 0.00 0.00 0.00 11:27:53 10:10:29 ens3 1.43 0.58 0.44 0.29 0.00 0.00 0.00 0.00 11:27:53 10:10:29 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:27:53 10:20:29 lo 12.20 12.20 5.74 5.74 0.00 0.00 0.00 0.00 11:27:53 10:20:29 ens3 1.82 0.96 0.50 0.35 0.00 0.00 0.00 0.00 11:27:53 10:20:29 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:27:53 10:30:29 lo 18.92 18.92 10.37 10.37 0.00 0.00 0.00 0.00 11:27:53 10:30:29 ens3 1.01 0.73 0.23 0.18 0.00 0.00 0.00 0.00 11:27:53 10:30:29 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:27:53 10:40:29 lo 15.13 15.13 6.11 6.11 0.00 0.00 0.00 0.00 11:27:53 10:40:29 ens3 1.12 0.50 0.30 0.19 0.00 0.00 0.00 0.00 11:27:53 10:40:29 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:27:53 10:50:20 lo 27.41 27.41 11.42 11.42 0.00 0.00 0.00 0.00 11:27:53 10:50:20 ens3 0.87 0.51 0.21 0.14 0.00 0.00 0.00 0.00 11:27:53 10:50:20 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:27:53 11:00:10 lo 14.52 14.52 7.68 7.68 0.00 0.00 0.00 0.00 11:27:53 11:00:10 ens3 0.59 0.39 0.11 0.08 0.00 0.00 0.00 0.00 11:27:53 11:00:10 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:27:53 11:10:07 lo 15.24 15.24 8.47 8.47 0.00 0.00 0.00 0.00 11:27:53 11:10:07 ens3 1.18 0.79 0.40 0.30 0.00 0.00 0.00 0.00 11:27:53 11:10:07 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:27:53 11:20:29 lo 15.00 15.00 7.90 7.90 0.00 0.00 0.00 0.00 11:27:53 11:20:29 ens3 0.71 0.54 0.17 0.13 0.00 0.00 0.00 0.00 11:27:53 11:20:29 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:27:53 Average: lo 16.03 16.03 8.54 8.54 0.00 0.00 0.00 0.00 11:27:53 Average: ens3 1.16 0.70 0.30 0.42 0.00 0.00 0.00 0.00 11:27:53 Average: docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:27:53 11:27:53 11:27:53 ---> sar -P ALL: 11:27:53 Linux 5.15.0-168-generic (prd-ubuntu2204-docker-4c-16g-23681) 02/27/26 _x86_64_ (4 CPU) 11:27:53 11:27:53 09:30:28 LINUX RESTART (4 CPU) 11:27:53 11:27:53 09:40:17 CPU %user %nice %system %iowait %steal %idle 11:27:53 09:50:18 all 34.87 0.00 1.46 0.07 0.09 63.51 11:27:53 09:50:18 0 34.47 0.00 1.36 0.09 0.09 63.99 11:27:53 09:50:18 1 34.19 0.00 1.65 0.07 0.10 63.99 11:27:53 09:50:18 2 34.87 0.00 1.44 0.09 0.10 63.51 11:27:53 09:50:18 3 35.94 0.00 1.39 0.04 0.09 62.54 11:27:53 10:00:29 all 8.90 0.00 0.50 0.01 0.07 90.52 11:27:53 10:00:29 0 8.36 0.00 0.45 0.02 0.06 91.10 11:27:53 10:00:29 1 8.81 0.00 0.50 0.01 0.07 90.61 11:27:53 10:00:29 2 9.30 0.00 0.59 0.02 0.07 90.01 11:27:53 10:00:29 3 9.12 0.00 0.44 0.00 0.06 90.37 11:27:53 10:10:29 all 16.26 0.00 0.66 0.36 0.08 82.65 11:27:53 10:10:29 0 16.38 0.00 0.70 0.01 0.08 82.83 11:27:53 10:10:29 1 16.86 0.00 0.61 0.58 0.08 81.87 11:27:53 10:10:29 2 15.62 0.00 0.67 0.35 0.08 83.29 11:27:53 10:10:29 3 16.16 0.00 0.66 0.48 0.07 82.63 11:27:53 10:20:29 all 25.02 0.00 0.91 0.07 0.09 73.91 11:27:53 10:20:29 0 25.15 0.00 0.95 0.09 0.08 73.73 11:27:53 10:20:29 1 24.30 0.00 0.84 0.08 0.09 74.69 11:27:53 10:20:29 2 25.63 0.00 1.04 0.06 0.09 73.18 11:27:53 10:20:29 3 25.01 0.00 0.82 0.05 0.09 74.03 11:27:53 10:30:29 all 20.68 0.00 0.71 0.04 0.08 78.49 11:27:53 10:30:29 0 20.51 0.00 0.74 0.03 0.09 78.63 11:27:53 10:30:29 1 21.28 0.00 0.80 0.04 0.09 77.79 11:27:53 10:30:29 2 20.52 0.00 0.61 0.03 0.08 78.76 11:27:53 10:30:29 3 20.39 0.00 0.68 0.04 0.08 78.80 11:27:53 10:40:29 all 7.79 0.00 0.43 0.05 0.07 91.67 11:27:53 10:40:29 0 8.13 0.00 0.39 0.14 0.07 91.26 11:27:53 10:40:29 1 7.65 0.00 0.45 0.01 0.07 91.82 11:27:53 10:40:29 2 7.59 0.00 0.38 0.02 0.07 91.93 11:27:53 10:40:29 3 7.78 0.00 0.49 0.01 0.07 91.66 11:27:53 10:50:20 all 10.13 0.00 0.39 0.02 0.08 89.37 11:27:53 10:50:20 0 9.72 0.00 0.40 0.03 0.07 89.77 11:27:53 10:50:20 1 10.38 0.00 0.39 0.01 0.09 89.13 11:27:53 10:50:20 2 10.50 0.00 0.42 0.04 0.08 88.95 11:27:53 10:50:20 3 9.94 0.00 0.34 0.01 0.07 89.63 11:27:53 11:00:10 all 9.30 0.00 0.44 0.04 0.08 90.14 11:27:53 11:00:10 0 9.42 0.00 0.36 0.10 0.08 90.05 11:27:53 11:00:10 1 9.32 0.00 0.43 0.04 0.08 90.14 11:27:53 11:00:10 2 9.24 0.00 0.51 0.02 0.08 90.15 11:27:53 11:00:10 3 9.22 0.00 0.48 0.01 0.08 90.22 11:27:53 11:10:07 all 7.89 0.00 0.49 0.03 0.08 91.51 11:27:53 11:10:07 0 7.14 0.00 0.49 0.06 0.07 92.23 11:27:53 11:10:07 1 8.03 0.00 0.44 0.01 0.08 91.44 11:27:53 11:10:07 2 8.56 0.00 0.58 0.02 0.08 90.75 11:27:53 11:10:07 3 7.85 0.00 0.45 0.02 0.07 91.61 11:27:53 11:20:29 all 12.63 0.00 0.53 0.03 0.08 86.74 11:27:53 11:20:29 0 12.73 0.00 0.48 0.03 0.07 86.68 11:27:53 11:20:29 1 12.46 0.00 0.53 0.02 0.08 86.90 11:27:53 11:20:29 2 12.86 0.00 0.60 0.04 0.08 86.42 11:27:53 11:20:29 3 12.46 0.00 0.50 0.02 0.07 86.95 11:27:53 Average: all 15.34 0.00 0.65 0.07 0.08 83.85 11:27:53 Average: 0 15.20 0.00 0.63 0.06 0.08 84.03 11:27:53 Average: 1 15.33 0.00 0.66 0.09 0.08 83.84 11:27:53 Average: 2 15.47 0.00 0.69 0.07 0.08 83.69 11:27:53 Average: 3 15.38 0.00 0.63 0.07 0.08 83.85 11:27:53 11:27:53 11:27:53