03:10:21 Triggered by Gerrit: https://git.opendaylight.org/gerrit/c/transportpce/+/120829 03:10:21 Running as SYSTEM 03:10:21 [EnvInject] - Loading node environment variables. 03:10:21 Building remotely on prd-ubuntu2204-docker-4c-16g-38770 (ubuntu2204-docker-4c-16g) in workspace /w/workspace/transportpce-tox-verify-transportpce-master 03:10:22 [ssh-agent] Looking for ssh-agent implementation... 03:10:22 [ssh-agent] Exec ssh-agent (binary ssh-agent on a remote machine) 03:10:22 $ ssh-agent 03:10:22 SSH_AUTH_SOCK=/tmp/ssh-XXXXXX9NUHfd/agent.1576 03:10:22 SSH_AGENT_PID=1578 03:10:22 [ssh-agent] Started. 03:10:22 Running ssh-add (command line suppressed) 03:10:22 Identity added: /w/workspace/transportpce-tox-verify-transportpce-master@tmp/private_key_12616941162692323445.key (/w/workspace/transportpce-tox-verify-transportpce-master@tmp/private_key_12616941162692323445.key) 03:10:22 [ssh-agent] Using credentials jenkins (jenkins-ssh) 03:10:22 The recommended git tool is: NONE 03:10:24 using credential jenkins-ssh 03:10:24 Wiping out workspace first. 03:10:24 Cloning the remote Git repository 03:10:24 Cloning repository git://devvexx.opendaylight.org/mirror/transportpce 03:10:24 > git init /w/workspace/transportpce-tox-verify-transportpce-master # timeout=10 03:10:24 Fetching upstream changes from git://devvexx.opendaylight.org/mirror/transportpce 03:10:24 > git --version # timeout=10 03:10:24 > git --version # 'git version 2.34.1' 03:10:24 using GIT_SSH to set credentials jenkins-ssh 03:10:24 Verifying host key using known hosts file, will automatically accept unseen keys 03:10:24 > git fetch --tags --force --progress -- git://devvexx.opendaylight.org/mirror/transportpce +refs/heads/*:refs/remotes/origin/* # timeout=10 03:10:28 > git config remote.origin.url git://devvexx.opendaylight.org/mirror/transportpce # timeout=10 03:10:28 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 03:10:28 > git config remote.origin.url git://devvexx.opendaylight.org/mirror/transportpce # timeout=10 03:10:28 Fetching upstream changes from git://devvexx.opendaylight.org/mirror/transportpce 03:10:28 using GIT_SSH to set credentials jenkins-ssh 03:10:28 Verifying host key using known hosts file, will automatically accept unseen keys 03:10:28 > git fetch --tags --force --progress -- git://devvexx.opendaylight.org/mirror/transportpce refs/changes/29/120829/6 # timeout=10 03:10:28 > git rev-parse d8023c2ab3b6bdff600a90cd68d489816e374312^{commit} # timeout=10 03:10:28 JENKINS-19022: warning: possible memory leak due to Git plugin usage; see: https://plugins.jenkins.io/git/#remove-git-plugin-buildsbybranch-builddata-script 03:10:28 Checking out Revision d8023c2ab3b6bdff600a90cd68d489816e374312 (refs/changes/29/120829/6) 03:10:28 > git config core.sparsecheckout # timeout=10 03:10:28 > git checkout -f d8023c2ab3b6bdff600a90cd68d489816e374312 # timeout=10 03:10:29 Commit message: "Support for openconfig 2.0" 03:10:29 > git rev-parse FETCH_HEAD^{commit} # timeout=10 03:10:29 > git rev-list --no-walk 509d781065379100eb9da8d0414bc0043a05ebc0 # timeout=10 03:10:29 > git remote # timeout=10 03:10:29 > git submodule init # timeout=10 03:10:29 > git submodule sync # timeout=10 03:10:29 > git config --get remote.origin.url # timeout=10 03:10:29 > git submodule init # timeout=10 03:10:29 > git config -f .gitmodules --get-regexp ^submodule\.(.+)\.url # timeout=10 03:10:29 ERROR: No submodules found. 03:10:32 provisioning config files... 03:10:32 copy managed file [npmrc] to file:/home/jenkins/.npmrc 03:10:32 copy managed file [pipconf] to file:/home/jenkins/.config/pip/pip.conf 03:10:32 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins16442075713739955625.sh 03:10:32 ---> python-tools-install.sh 03:10:32 Setup pyenv: 03:10:32 * system (set by /opt/pyenv/version) 03:10:32 * 3.8.20 (set by /opt/pyenv/version) 03:10:32 * 3.9.20 (set by /opt/pyenv/version) 03:10:32 3.10.15 03:10:32 3.11.10 03:10:37 lf-activate-venv(): INFO: Creating python3 venv at /tmp/venv-z9Lp 03:10:37 lf-activate-venv(): INFO: Save venv in file: /tmp/.os_lf_venv 03:10:37 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 03:10:37 lf-activate-venv(): INFO: Attempting to install with network-safe options... 03:10:41 lf-activate-venv(): INFO: Base packages installed successfully 03:10:41 lf-activate-venv(): INFO: Installing additional packages: lftools 03:11:08 lf-activate-venv(): INFO: Adding /tmp/venv-z9Lp/bin to PATH 03:11:08 Generating Requirements File 03:11:30 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. 03:11:30 httplib2 0.30.2 requires pyparsing<4,>=3.0.4, but you have pyparsing 2.4.7 which is incompatible. 03:11:30 Python 3.11.10 03:11:31 pip 26.0.1 from /tmp/venv-z9Lp/lib/python3.11/site-packages/pip (python 3.11) 03:11:31 appdirs==1.4.4 03:11:31 argcomplete==3.6.3 03:11:31 aspy.yaml==1.3.0 03:11:31 attrs==25.4.0 03:11:31 autopage==0.6.0 03:11:31 beautifulsoup4==4.14.3 03:11:31 boto3==1.42.61 03:11:31 botocore==1.42.61 03:11:31 bs4==0.0.2 03:11:31 certifi==2026.2.25 03:11:31 cffi==2.0.0 03:11:31 cfgv==3.5.0 03:11:31 chardet==7.0.1 03:11:31 charset-normalizer==3.4.4 03:11:31 click==8.3.1 03:11:31 cliff==4.13.2 03:11:31 cmd2==3.4.0 03:11:31 cryptography==3.3.2 03:11:31 debtcollector==3.0.0 03:11:31 decorator==5.2.1 03:11:31 defusedxml==0.7.1 03:11:31 Deprecated==1.3.1 03:11:31 distlib==0.4.0 03:11:31 dnspython==2.8.0 03:11:31 docker==7.1.0 03:11:31 dogpile.cache==1.5.0 03:11:31 durationpy==0.10 03:11:31 email-validator==2.3.0 03:11:31 filelock==3.25.0 03:11:31 future==1.0.0 03:11:31 gitdb==4.0.12 03:11:31 GitPython==3.1.46 03:11:31 httplib2==0.30.2 03:11:31 identify==2.6.17 03:11:31 idna==3.11 03:11:31 importlib-resources==1.5.0 03:11:31 iso8601==2.1.0 03:11:31 Jinja2==3.1.6 03:11:31 jmespath==1.1.0 03:11:31 jsonpatch==1.33 03:11:31 jsonpointer==3.0.0 03:11:31 jsonschema==4.26.0 03:11:31 jsonschema-specifications==2025.9.1 03:11:31 keystoneauth1==5.13.1 03:11:31 kubernetes==35.0.0 03:11:31 lftools==0.37.22 03:11:31 lxml==6.0.2 03:11:31 markdown-it-py==4.0.0 03:11:31 MarkupSafe==3.0.3 03:11:31 mdurl==0.1.2 03:11:31 msgpack==1.1.2 03:11:31 multi_key_dict==2.0.3 03:11:31 munch==4.0.0 03:11:31 netaddr==1.3.0 03:11:31 niet==1.4.2 03:11:31 nodeenv==1.10.0 03:11:31 oauth2client==4.1.3 03:11:31 oauthlib==3.3.1 03:11:31 openstacksdk==4.10.0 03:11:31 os-service-types==1.8.2 03:11:31 osc-lib==4.4.0 03:11:31 oslo.config==10.3.0 03:11:31 oslo.context==6.3.0 03:11:31 oslo.i18n==6.7.2 03:11:31 oslo.log==8.1.0 03:11:31 oslo.serialization==5.9.1 03:11:31 oslo.utils==10.0.0 03:11:31 packaging==26.0 03:11:31 pbr==7.0.3 03:11:31 platformdirs==4.9.2 03:11:31 prettytable==3.17.0 03:11:31 psutil==7.2.2 03:11:31 pyasn1==0.6.2 03:11:31 pyasn1_modules==0.4.2 03:11:31 pycparser==3.0 03:11:31 pygerrit2==2.0.15 03:11:31 PyGithub==2.8.1 03:11:31 Pygments==2.19.2 03:11:31 PyJWT==2.11.0 03:11:31 PyNaCl==1.6.2 03:11:31 pyparsing==2.4.7 03:11:31 pyperclip==1.11.0 03:11:31 pyrsistent==0.20.0 03:11:31 python-cinderclient==9.9.0 03:11:31 python-dateutil==2.9.0.post0 03:11:31 python-discovery==1.1.0 03:11:31 python-heatclient==5.1.0 03:11:31 python-jenkins==1.8.3 03:11:31 python-keystoneclient==5.8.0 03:11:31 python-magnumclient==4.10.0 03:11:31 python-openstackclient==9.0.0 03:11:31 python-swiftclient==4.10.0 03:11:31 PyYAML==6.0.3 03:11:31 referencing==0.37.0 03:11:31 requests==2.32.5 03:11:31 requests-oauthlib==2.0.0 03:11:31 requestsexceptions==1.4.0 03:11:31 rfc3986==2.0.0 03:11:31 rich==14.3.3 03:11:31 rich-argparse==1.7.2 03:11:31 rpds-py==0.30.0 03:11:31 rsa==4.9.1 03:11:31 ruamel.yaml==0.19.1 03:11:31 ruamel.yaml.clib==0.2.15 03:11:31 s3transfer==0.16.0 03:11:31 simplejson==3.20.2 03:11:31 six==1.17.0 03:11:31 smmap==5.0.2 03:11:31 soupsieve==2.8.3 03:11:31 stevedore==5.7.0 03:11:31 tabulate==0.10.0 03:11:31 toml==0.10.2 03:11:31 tomlkit==0.14.0 03:11:31 tqdm==4.67.3 03:11:31 typing_extensions==4.15.0 03:11:31 urllib3==1.26.20 03:11:31 virtualenv==21.1.0 03:11:31 wcwidth==0.6.0 03:11:31 websocket-client==1.9.0 03:11:31 wrapt==2.1.1 03:11:31 xdg==6.0.0 03:11:31 xmltodict==1.0.4 03:11:31 yq==3.4.3 03:11:31 [EnvInject] - Injecting environment variables from a build step. 03:11:31 [EnvInject] - Injecting as environment variables the properties content 03:11:31 PYTHON=python3 03:11:31 03:11:31 [EnvInject] - Variables injected successfully. 03:11:31 [transportpce-tox-verify-transportpce-master] $ /bin/bash -l /tmp/jenkins4978670226589411605.sh 03:11:31 ---> tox-install.sh 03:11:31 + source /home/jenkins/lf-env.sh 03:11:31 + lf-activate-venv --venv-file /tmp/.toxenv tox virtualenv urllib3~=1.26.15 03:11:31 ++ mktemp -d /tmp/venv-XXXX 03:11:31 + lf_venv=/tmp/venv-joan 03:11:31 + local venv_file=/tmp/.os_lf_venv 03:11:31 + local python=python3 03:11:31 + local options 03:11:31 + local set_path=true 03:11:31 + local install_args= 03:11:31 ++ 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 03:11:31 + options=' --venv-file '\''/tmp/.toxenv'\'' -- '\''tox'\'' '\''virtualenv'\'' '\''urllib3~=1.26.15'\''' 03:11:31 + eval set -- ' --venv-file '\''/tmp/.toxenv'\'' -- '\''tox'\'' '\''virtualenv'\'' '\''urllib3~=1.26.15'\''' 03:11:31 ++ set -- --venv-file /tmp/.toxenv -- tox virtualenv urllib3~=1.26.15 03:11:31 + true 03:11:31 + case $1 in 03:11:31 + venv_file=/tmp/.toxenv 03:11:31 + shift 2 03:11:31 + true 03:11:31 + case $1 in 03:11:31 + shift 03:11:31 + break 03:11:31 + case $python in 03:11:31 + local pkg_list= 03:11:31 + [[ -d /opt/pyenv ]] 03:11:31 + echo 'Setup pyenv:' 03:11:31 Setup pyenv: 03:11:31 + export PYENV_ROOT=/opt/pyenv 03:11:31 + PYENV_ROOT=/opt/pyenv 03:11:31 + 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 03:11:31 + 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 03:11:31 + pyenv versions 03:11:31 system 03:11:31 3.8.20 03:11:31 3.9.20 03:11:31 3.10.15 03:11:31 * 3.11.10 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 03:11:31 + command -v pyenv 03:11:31 ++ pyenv init - --no-rehash 03:11:31 + eval 'PATH="$(bash --norc -ec '\''IFS=:; paths=($PATH); 03:11:31 for i in ${!paths[@]}; do 03:11:31 if [[ ${paths[i]} == "'\'''\''/opt/pyenv/shims'\'''\''" ]]; then unset '\''\'\'''\''paths[i]'\''\'\'''\''; 03:11:31 fi; done; 03:11:31 echo "${paths[*]}"'\'')" 03:11:31 export PATH="/opt/pyenv/shims:${PATH}" 03:11:31 export PYENV_SHELL=bash 03:11:31 source '\''/opt/pyenv/libexec/../completions/pyenv.bash'\'' 03:11:31 pyenv() { 03:11:31 local command 03:11:31 command="${1:-}" 03:11:31 if [ "$#" -gt 0 ]; then 03:11:31 shift 03:11:31 fi 03:11:31 03:11:31 case "$command" in 03:11:31 rehash|shell) 03:11:31 eval "$(pyenv "sh-$command" "$@")" 03:11:31 ;; 03:11:31 *) 03:11:31 command pyenv "$command" "$@" 03:11:31 ;; 03:11:31 esac 03:11:31 }' 03:11:31 +++ bash --norc -ec 'IFS=:; paths=($PATH); 03:11:31 for i in ${!paths[@]}; do 03:11:31 if [[ ${paths[i]} == "/opt/pyenv/shims" ]]; then unset '\''paths[i]'\''; 03:11:31 fi; done; 03:11:31 echo "${paths[*]}"' 03:11:31 ++ 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 03:11:31 ++ 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 03:11:31 ++ 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 03:11:31 ++ export PYENV_SHELL=bash 03:11:31 ++ PYENV_SHELL=bash 03:11:31 ++ source /opt/pyenv/libexec/../completions/pyenv.bash 03:11:31 +++ complete -F _pyenv pyenv 03:11:31 ++ lf-pyver python3 03:11:31 ++ local py_version_xy=python3 03:11:31 ++ local py_version_xyz= 03:11:31 ++ pyenv versions 03:11:31 ++ local command 03:11:31 ++ command=versions 03:11:31 ++ '[' 1 -gt 0 ']' 03:11:31 ++ shift 03:11:31 ++ case "$command" in 03:11:31 ++ command pyenv versions 03:11:31 ++ sed 's/^[ *]* //' 03:11:31 ++ awk '{ print $1 }' 03:11:31 ++ grep -E '^[0-9.]*[0-9]$' 03:11:31 ++ [[ ! -s /tmp/.pyenv_versions ]] 03:11:31 +++ sort -V 03:11:31 +++ grep '^3' /tmp/.pyenv_versions 03:11:31 +++ tail -n 1 03:11:31 ++ py_version_xyz=3.11.10 03:11:31 ++ [[ -z 3.11.10 ]] 03:11:31 ++ echo 3.11.10 03:11:31 ++ return 0 03:11:31 + pyenv local 3.11.10 03:11:31 + local command 03:11:31 + command=local 03:11:31 + '[' 2 -gt 0 ']' 03:11:31 + shift 03:11:31 + case "$command" in 03:11:31 + command pyenv local 3.11.10 03:11:31 + for arg in "$@" 03:11:31 + case $arg in 03:11:31 + pkg_list+='tox ' 03:11:31 + for arg in "$@" 03:11:31 + case $arg in 03:11:31 + pkg_list+='virtualenv ' 03:11:31 + for arg in "$@" 03:11:31 + case $arg in 03:11:31 + pkg_list+='urllib3~=1.26.15 ' 03:11:31 + [[ -f /tmp/.toxenv ]] 03:11:31 + [[ ! -f /tmp/.toxenv ]] 03:11:31 + [[ -n '' ]] 03:11:31 + python3 -m venv /tmp/venv-joan 03:11:36 + echo 'lf-activate-venv(): INFO: Creating python3 venv at /tmp/venv-joan' 03:11:36 lf-activate-venv(): INFO: Creating python3 venv at /tmp/venv-joan 03:11:36 + echo /tmp/venv-joan 03:11:36 + echo 'lf-activate-venv(): INFO: Save venv in file: /tmp/.toxenv' 03:11:36 lf-activate-venv(): INFO: Save venv in file: /tmp/.toxenv 03:11:36 + echo 'lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv)' 03:11:36 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 03:11:36 + local 'pip_opts=--upgrade --quiet' 03:11:36 + pip_opts='--upgrade --quiet --trusted-host pypi.org' 03:11:36 + pip_opts='--upgrade --quiet --trusted-host pypi.org --trusted-host files.pythonhosted.org' 03:11:36 + pip_opts='--upgrade --quiet --trusted-host pypi.org --trusted-host files.pythonhosted.org --trusted-host pypi.python.org' 03:11:36 + [[ -n '' ]] 03:11:36 + [[ -n '' ]] 03:11:36 + echo 'lf-activate-venv(): INFO: Attempting to install with network-safe options...' 03:11:36 lf-activate-venv(): INFO: Attempting to install with network-safe options... 03:11:36 + /tmp/venv-joan/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 03:11:40 + echo 'lf-activate-venv(): INFO: Base packages installed successfully' 03:11:40 lf-activate-venv(): INFO: Base packages installed successfully 03:11:40 + [[ -z tox virtualenv urllib3~=1.26.15 ]] 03:11:40 + echo 'lf-activate-venv(): INFO: Installing additional packages: tox virtualenv urllib3~=1.26.15 ' 03:11:40 lf-activate-venv(): INFO: Installing additional packages: tox virtualenv urllib3~=1.26.15 03:11:40 + /tmp/venv-joan/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 03:11:42 + type python3 03:11:42 + true 03:11:42 + echo 'lf-activate-venv(): INFO: Adding /tmp/venv-joan/bin to PATH' 03:11:42 lf-activate-venv(): INFO: Adding /tmp/venv-joan/bin to PATH 03:11:42 + PATH=/tmp/venv-joan/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 03:11:42 + return 0 03:11:42 + python3 --version 03:11:42 Python 3.11.10 03:11:42 + python3 -m pip --version 03:11:42 pip 26.0.1 from /tmp/venv-joan/lib/python3.11/site-packages/pip (python 3.11) 03:11:42 + python3 -m pip freeze 03:11:43 cachetools==7.0.2 03:11:43 colorama==0.4.6 03:11:43 distlib==0.4.0 03:11:43 filelock==3.25.0 03:11:43 packaging==26.0 03:11:43 platformdirs==4.9.2 03:11:43 pluggy==1.6.0 03:11:43 pyproject-api==1.10.0 03:11:43 python-discovery==1.1.0 03:11:43 tox==4.47.3 03:11:43 urllib3==1.26.20 03:11:43 virtualenv==21.1.0 03:11:43 [transportpce-tox-verify-transportpce-master] $ /bin/sh -xe /tmp/jenkins9877688264474400482.sh 03:11:43 [EnvInject] - Injecting environment variables from a build step. 03:11:43 [EnvInject] - Injecting as environment variables the properties content 03:11:43 PARALLEL=True 03:11:43 03:11:43 [EnvInject] - Variables injected successfully. 03:11:43 [transportpce-tox-verify-transportpce-master] $ /bin/bash -l /tmp/jenkins555369002981673764.sh 03:11:43 ---> tox-run.sh 03:11:43 + 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 03:11:43 + ARCHIVE_TOX_DIR=/w/workspace/transportpce-tox-verify-transportpce-master/archives/tox 03:11:43 + ARCHIVE_DOC_DIR=/w/workspace/transportpce-tox-verify-transportpce-master/archives/docs 03:11:43 + mkdir -p /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox 03:11:43 + cd /w/workspace/transportpce-tox-verify-transportpce-master/. 03:11:43 + source /home/jenkins/lf-env.sh 03:11:43 + lf-activate-venv --venv-file /tmp/.toxenv tox virtualenv urllib3~=1.26.15 03:11:43 ++ mktemp -d /tmp/venv-XXXX 03:11:43 + lf_venv=/tmp/venv-rj5t 03:11:43 + local venv_file=/tmp/.os_lf_venv 03:11:43 + local python=python3 03:11:43 + local options 03:11:43 + local set_path=true 03:11:43 + local install_args= 03:11:43 ++ 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 03:11:43 + options=' --venv-file '\''/tmp/.toxenv'\'' -- '\''tox'\'' '\''virtualenv'\'' '\''urllib3~=1.26.15'\''' 03:11:43 + eval set -- ' --venv-file '\''/tmp/.toxenv'\'' -- '\''tox'\'' '\''virtualenv'\'' '\''urllib3~=1.26.15'\''' 03:11:43 ++ set -- --venv-file /tmp/.toxenv -- tox virtualenv urllib3~=1.26.15 03:11:43 + true 03:11:43 + case $1 in 03:11:43 + venv_file=/tmp/.toxenv 03:11:43 + shift 2 03:11:43 + true 03:11:43 + case $1 in 03:11:43 + shift 03:11:43 + break 03:11:43 + case $python in 03:11:43 + local pkg_list= 03:11:43 + [[ -d /opt/pyenv ]] 03:11:43 + echo 'Setup pyenv:' 03:11:43 Setup pyenv: 03:11:43 + export PYENV_ROOT=/opt/pyenv 03:11:43 + PYENV_ROOT=/opt/pyenv 03:11:43 + 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 03:11:43 + 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 03:11:43 + pyenv versions 03:11:43 system 03:11:43 3.8.20 03:11:43 3.9.20 03:11:43 3.10.15 03:11:43 * 3.11.10 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 03:11:43 + command -v pyenv 03:11:43 ++ pyenv init - --no-rehash 03:11:43 + eval 'PATH="$(bash --norc -ec '\''IFS=:; paths=($PATH); 03:11:43 for i in ${!paths[@]}; do 03:11:43 if [[ ${paths[i]} == "'\'''\''/opt/pyenv/shims'\'''\''" ]]; then unset '\''\'\'''\''paths[i]'\''\'\'''\''; 03:11:43 fi; done; 03:11:43 echo "${paths[*]}"'\'')" 03:11:43 export PATH="/opt/pyenv/shims:${PATH}" 03:11:43 export PYENV_SHELL=bash 03:11:43 source '\''/opt/pyenv/libexec/../completions/pyenv.bash'\'' 03:11:43 pyenv() { 03:11:43 local command 03:11:43 command="${1:-}" 03:11:43 if [ "$#" -gt 0 ]; then 03:11:43 shift 03:11:43 fi 03:11:43 03:11:43 case "$command" in 03:11:43 rehash|shell) 03:11:43 eval "$(pyenv "sh-$command" "$@")" 03:11:43 ;; 03:11:43 *) 03:11:43 command pyenv "$command" "$@" 03:11:43 ;; 03:11:43 esac 03:11:43 }' 03:11:43 +++ bash --norc -ec 'IFS=:; paths=($PATH); 03:11:43 for i in ${!paths[@]}; do 03:11:43 if [[ ${paths[i]} == "/opt/pyenv/shims" ]]; then unset '\''paths[i]'\''; 03:11:43 fi; done; 03:11:43 echo "${paths[*]}"' 03:11:43 ++ 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 03:11:43 ++ 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 03:11:43 ++ 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 03:11:43 ++ export PYENV_SHELL=bash 03:11:43 ++ PYENV_SHELL=bash 03:11:43 ++ source /opt/pyenv/libexec/../completions/pyenv.bash 03:11:43 +++ complete -F _pyenv pyenv 03:11:43 ++ lf-pyver python3 03:11:43 ++ local py_version_xy=python3 03:11:43 ++ local py_version_xyz= 03:11:43 ++ pyenv versions 03:11:43 ++ local command 03:11:43 ++ command=versions 03:11:43 ++ '[' 1 -gt 0 ']' 03:11:43 ++ shift 03:11:43 ++ case "$command" in 03:11:43 ++ command pyenv versions 03:11:43 ++ awk '{ print $1 }' 03:11:43 ++ grep -E '^[0-9.]*[0-9]$' 03:11:43 ++ sed 's/^[ *]* //' 03:11:43 ++ [[ ! -s /tmp/.pyenv_versions ]] 03:11:43 +++ grep '^3' /tmp/.pyenv_versions 03:11:43 +++ sort -V 03:11:43 +++ tail -n 1 03:11:43 ++ py_version_xyz=3.11.10 03:11:43 ++ [[ -z 3.11.10 ]] 03:11:43 ++ echo 3.11.10 03:11:43 ++ return 0 03:11:43 + pyenv local 3.11.10 03:11:43 + local command 03:11:43 + command=local 03:11:43 + '[' 2 -gt 0 ']' 03:11:43 + shift 03:11:43 + case "$command" in 03:11:43 + command pyenv local 3.11.10 03:11:43 + for arg in "$@" 03:11:43 + case $arg in 03:11:43 + pkg_list+='tox ' 03:11:43 + for arg in "$@" 03:11:43 + case $arg in 03:11:43 + pkg_list+='virtualenv ' 03:11:43 + for arg in "$@" 03:11:43 + case $arg in 03:11:43 + pkg_list+='urllib3~=1.26.15 ' 03:11:43 + [[ -f /tmp/.toxenv ]] 03:11:43 ++ cat /tmp/.toxenv 03:11:43 + lf_venv=/tmp/venv-joan 03:11:43 + echo 'lf-activate-venv(): INFO: Reuse venv:/tmp/venv-joan from' file:/tmp/.toxenv 03:11:43 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-joan from file:/tmp/.toxenv 03:11:43 + echo 'lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv)' 03:11:43 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 03:11:43 + local 'pip_opts=--upgrade --quiet' 03:11:43 + pip_opts='--upgrade --quiet --trusted-host pypi.org' 03:11:43 + pip_opts='--upgrade --quiet --trusted-host pypi.org --trusted-host files.pythonhosted.org' 03:11:43 + pip_opts='--upgrade --quiet --trusted-host pypi.org --trusted-host files.pythonhosted.org --trusted-host pypi.python.org' 03:11:43 + [[ -n '' ]] 03:11:43 + [[ -n '' ]] 03:11:43 + echo 'lf-activate-venv(): INFO: Attempting to install with network-safe options...' 03:11:43 lf-activate-venv(): INFO: Attempting to install with network-safe options... 03:11:43 + /tmp/venv-joan/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 03:11:44 + echo 'lf-activate-venv(): INFO: Base packages installed successfully' 03:11:44 lf-activate-venv(): INFO: Base packages installed successfully 03:11:44 + [[ -z tox virtualenv urllib3~=1.26.15 ]] 03:11:44 + echo 'lf-activate-venv(): INFO: Installing additional packages: tox virtualenv urllib3~=1.26.15 ' 03:11:44 lf-activate-venv(): INFO: Installing additional packages: tox virtualenv urllib3~=1.26.15 03:11:44 + /tmp/venv-joan/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 03:11:45 + type python3 03:11:45 + true 03:11:45 + echo 'lf-activate-venv(): INFO: Adding /tmp/venv-joan/bin to PATH' 03:11:45 lf-activate-venv(): INFO: Adding /tmp/venv-joan/bin to PATH 03:11:45 + PATH=/tmp/venv-joan/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 03:11:45 + return 0 03:11:45 + [[ -d /opt/pyenv ]] 03:11:45 + echo '---> Setting up pyenv' 03:11:45 ---> Setting up pyenv 03:11:45 + export PYENV_ROOT=/opt/pyenv 03:11:45 + PYENV_ROOT=/opt/pyenv 03:11:45 + export PATH=/opt/pyenv/bin:/tmp/venv-joan/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 03:11:45 + PATH=/opt/pyenv/bin:/tmp/venv-joan/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 03:11:45 ++ pwd 03:11:45 + PYTHONPATH=/w/workspace/transportpce-tox-verify-transportpce-master 03:11:45 + export PYTHONPATH 03:11:45 + export TOX_TESTENV_PASSENV=PYTHONPATH 03:11:45 + TOX_TESTENV_PASSENV=PYTHONPATH 03:11:45 + tox --version 03:11:46 4.47.3 from /tmp/venv-joan/lib/python3.11/site-packages/tox/__init__.py 03:11:46 + PARALLEL=True 03:11:46 + TOX_OPTIONS_LIST= 03:11:46 + [[ -n '' ]] 03:11:46 + case ${PARALLEL,,} in 03:11:46 + TOX_OPTIONS_LIST=' --parallel auto --parallel-live' 03:11:46 + tox --parallel auto --parallel-live 03:11:46 + tee -a /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tox.log 03:11:47 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 03:11:47 docs-linkcheck: install_deps> python -I -m pip install -r docs/requirements.txt 03:11:47 checkbashisms: freeze> python -m pip freeze --all 03:11:47 docs: install_deps> python -I -m pip install -r docs/requirements.txt 03:11:48 checkbashisms: pip==26.0.1,setuptools==82.0.0 03:11:48 checkbashisms: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./fixCIcentOS8reposMirrors.sh 03:11:48 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)' 03:11:48 checkbashisms: commands[2] /w/workspace/transportpce-tox-verify-transportpce-master/tests> find . -not -path '*/\.*' -name '*.sh' -exec checkbashisms -f '{}' + 03:11:49 checkbashisms: OK ✔ in 3.15 seconds 03:11:49 pre-commit: install_deps> python -I -m pip install pre-commit 03:11:52 pre-commit: freeze> python -m pip freeze --all 03:11:52 pre-commit: cfgv==3.5.0,distlib==0.4.0,filelock==3.25.0,identify==2.6.17,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 03:11:52 pre-commit: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./fixCIcentOS8reposMirrors.sh 03:11:52 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)' 03:11:52 /usr/bin/cpan 03:11:52 pre-commit: commands[2] /w/workspace/transportpce-tox-verify-transportpce-master/tests> pre-commit run --all-files --show-diff-on-failure 03:11:53 [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. 03:11:53 [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. 03:11:53 [INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks. 03:11:53 [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. 03:11:53 [INFO] Initializing environment for https://github.com/jorisroovers/gitlint. 03:11:54 [INFO] Initializing environment for https://github.com/jorisroovers/gitlint:./gitlint-core[trusted-deps]. 03:11:54 [INFO] Initializing environment for https://github.com/Lucas-C/pre-commit-hooks. 03:11:55 buildcontroller: freeze> python -m pip freeze --all 03:11:55 [INFO] Initializing environment for https://github.com/pre-commit/mirrors-autopep8. 03:11:55 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 03:11:55 buildcontroller: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_controller.sh 03:11:55 + update-java-alternatives -l 03:11:55 java-1.11.0-openjdk-amd64 1111 /usr/lib/jvm/java-1.11.0-openjdk-amd64 03:11:55 java-1.17.0-openjdk-amd64 1711 /usr/lib/jvm/java-1.17.0-openjdk-amd64 03:11:55 java-1.21.0-openjdk-amd64 2111 /usr/lib/jvm/java-1.21.0-openjdk-amd64 03:11:55 + sudo update-java-alternatives -s java-1.21.0-openjdk-amd64 03:11:55 [INFO] Initializing environment for https://github.com/perltidy/perltidy. 03:11:55 update-alternatives: error: no alternatives for jaotc 03:11:55 update-alternatives: error: no alternatives for rmic 03:11:55 + + sed -n ;s/.* version "\(.*\)\.\(.*\)\..*".*$/\1/p; 03:11:55 java -version 03:11:55 21 03:11:55 + JAVA_VER=21 03:11:55 + echo 21 03:11:55 + javac -version 03:11:55 + sed -n ;s/javac \(.*\)\.\(.*\)\..*.*$/\1/p; 03:11:55 + JAVAC_VER=21 03:11:55 + echo 21 03:11:55 + [ 21 -ge 21 ] 03:11:55 + [ 21 -ge 21 ] 03:11:55 21 03:11:55 ok, java is 21 or newer 03:11:55 + echo ok, java is 21 or newer 03:11:55 + wget -nv https://dlcdn.apache.org/maven/maven-3/3.9.12/binaries/apache-maven-3.9.12-bin.tar.gz -P /tmp 03:11:56 [INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks. 03:11:56 [INFO] Once installed this environment will be reused. 03:11:56 [INFO] This may take a few minutes... 03:11:56 2026-03-05 03:11:56 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] 03:11:56 + sudo mkdir -p /opt 03:11:56 + sudo tar xf /tmp/apache-maven-3.9.12-bin.tar.gz -C /opt 03:11:56 + sudo ln -s /opt/apache-maven-3.9.12 /opt/maven 03:11:57 + sudo ln -s /opt/maven/bin/mvn /usr/bin/mvn 03:11:57 + mvn --version 03:11:57 Apache Maven 3.9.12 (848fbb4bf2d427b72bdb2471c22fced7ebd9a7a1) 03:11:57 Maven home: /opt/maven 03:11:57 Java version: 21.0.10, vendor: Ubuntu, runtime: /usr/lib/jvm/java-21-openjdk-amd64 03:11:57 Default locale: en, platform encoding: UTF-8 03:11:57 OS name: "linux", version: "5.15.0-171-generic", arch: "amd64", family: "unix" 03:11:57 NOTE: Picked up JDK_JAVA_OPTIONS: 03:11:57 --add-opens=java.base/java.io=ALL-UNNAMED 03:11:57 --add-opens=java.base/java.lang=ALL-UNNAMED 03:11:57 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 03:11:57 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 03:11:57 --add-opens=java.base/java.net=ALL-UNNAMED 03:11:57 --add-opens=java.base/java.nio=ALL-UNNAMED 03:11:57 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 03:11:57 --add-opens=java.base/java.nio.file=ALL-UNNAMED 03:11:57 --add-opens=java.base/java.util=ALL-UNNAMED 03:11:57 --add-opens=java.base/java.util.jar=ALL-UNNAMED 03:11:57 --add-opens=java.base/java.util.stream=ALL-UNNAMED 03:11:57 --add-opens=java.base/java.util.zip=ALL-UNNAMED 03:11:57 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 03:11:57 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 03:11:57 -Xlog:disable 03:12:00 [INFO] Installing environment for https://github.com/Lucas-C/pre-commit-hooks. 03:12:00 [INFO] Once installed this environment will be reused. 03:12:00 [INFO] This may take a few minutes... 03:12:08 [INFO] Installing environment for https://github.com/pre-commit/mirrors-autopep8. 03:12:08 [INFO] Once installed this environment will be reused. 03:12:08 [INFO] This may take a few minutes... 03:12:13 [INFO] Installing environment for https://github.com/perltidy/perltidy. 03:12:13 [INFO] Once installed this environment will be reused. 03:12:13 [INFO] This may take a few minutes... 03:12:17 docs-linkcheck: freeze> python -m pip freeze --all 03:12:17 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==2.0.0,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.5.0,sphinx_rtd_theme==3.1.0,sphinxcontrib-applehelp==2.0.0,sphinxcontrib-blockdiag==3.0.0,sphinxcontrib-devhelp==2.0.0,sphinxcontrib-htmlhelp==2.1.0,sphinxcontrib-jquery==4.1,sphinxcontrib-jsmath==1.0.1,sphinxcontrib-needs==0.7.9,sphinxcontrib-nwdiag==2.0.0,sphinxcontrib-plantuml==0.31,sphinxcontrib-qthelp==2.0.0,sphinxcontrib-seqdiag==3.0.0,sphinxcontrib-serializinghtml==2.0.0,sphinxcontrib-swaggerdoc==0.1.7,urllib3==2.6.3,webcolors==25.10.0 03:12:17 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 03:12:18 docs: freeze> python -m pip freeze --all 03:12:19 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==2.0.0,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.5.0,sphinx_rtd_theme==3.1.0,sphinxcontrib-applehelp==2.0.0,sphinxcontrib-blockdiag==3.0.0,sphinxcontrib-devhelp==2.0.0,sphinxcontrib-htmlhelp==2.1.0,sphinxcontrib-jquery==4.1,sphinxcontrib-jsmath==1.0.1,sphinxcontrib-needs==0.7.9,sphinxcontrib-nwdiag==2.0.0,sphinxcontrib-plantuml==0.31,sphinxcontrib-qthelp==2.0.0,sphinxcontrib-seqdiag==3.0.0,sphinxcontrib-serializinghtml==2.0.0,sphinxcontrib-swaggerdoc==0.1.7,urllib3==2.6.3,webcolors==25.10.0 03:12:19 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 03:12:22 docs: OK ✔ in 35.35 seconds 03:12:22 pylint: install_deps> python -I -m pip install 'pylint>=2.6.0' 03:12:26 trim trailing whitespace.................................................Passed 03:12:26 Tabs remover.............................................................Passed 03:12:26 autopep8.................................................................docs-linkcheck: OK ✔ in 36.67 seconds 03:12:28 pylint: freeze> python -m pip freeze --all 03:12:29 pylint: astroid==4.0.4,dill==0.4.1,isort==8.0.1,mccabe==0.7.0,pip==26.0.1,platformdirs==4.9.2,pylint==4.0.5,setuptools==82.0.0,tomlkit==0.14.0 03:12:29 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}$' '{}' + 03:12:32 Passed 03:12:32 perltidy.................................................................Passed 03:12:33 pre-commit: commands[3] /w/workspace/transportpce-tox-verify-transportpce-master/tests> pre-commit run gitlint-ci --hook-stage manual 03:12:33 [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. 03:12:33 [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. 03:12:33 [INFO] Installing environment for https://github.com/jorisroovers/gitlint. 03:12:33 [INFO] Once installed this environment will be reused. 03:12:33 [INFO] This may take a few minutes... 03:12:41 gitlint..................................................................Passed 03:12:52 03:12:52 ------------------------------------ 03:12:52 Your code has been rated at 10.00/10 03:12:52 03:13:34 pre-commit: OK ✔ in 51.79 seconds 03:13:34 pylint: OK ✔ in 32.14 seconds 03:13:34 buildcontroller: OK ✔ in 1 minute 47.44 seconds 03:13:34 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 03:13:34 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 03:13:34 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 03:13:34 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 03:13:42 build_karaf_tests200: freeze> python -m pip freeze --all 03:13:42 build_karaf_tests121: freeze> python -m pip freeze --all 03:13:42 build_karaf_tests71: freeze> python -m pip freeze --all 03:13:42 build_karaf_tests221: freeze> python -m pip freeze --all 03:13:43 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 03:13:43 build_karaf_tests200: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_karaf_for_tests.sh 03:13:43 build karaf in karafoc200 with ./karafoc200.env 03:13:43 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 03:13:43 build_karaf_tests121: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_karaf_for_tests.sh 03:13:43 build karaf in karaf121 with ./karaf121.env 03:13:43 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 03:13:43 build_karaf_tests71: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_karaf_for_tests.sh 03:13:43 build karaf in karaf71 with ./karaf71.env 03:13:43 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 03:13:43 build_karaf_tests221: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_karaf_for_tests.sh 03:13:43 build karaf in karaf221 with ./karaf221.env 03:13:43 NOTE: Picked up JDK_JAVA_OPTIONS: 03:13:43 --add-opens=java.base/java.io=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.lang=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.net=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.nio=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.nio.file=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.util=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.util.jar=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.util.stream=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.util.zip=ALL-UNNAMED 03:13:43 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 03:13:43 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 03:13:43 -Xlog:disable 03:13:43 NOTE: Picked up JDK_JAVA_OPTIONS: 03:13:43 --add-opens=java.base/java.io=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.lang=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.net=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.nio=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.nio.file=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.util=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.util.jar=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.util.stream=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.util.zip=ALL-UNNAMED 03:13:43 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 03:13:43 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 03:13:43 -Xlog:disable 03:13:43 NOTE: Picked up JDK_JAVA_OPTIONS: 03:13:43 --add-opens=java.base/java.io=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.lang=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.net=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.nio=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.nio.file=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.util=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.util.jar=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.util.stream=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.util.zip=ALL-UNNAMED 03:13:43 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 03:13:43 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 03:13:43 -Xlog:disable 03:13:43 NOTE: Picked up JDK_JAVA_OPTIONS: 03:13:43 --add-opens=java.base/java.io=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.lang=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.net=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.nio=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.nio.file=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.util=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.util.jar=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.util.stream=ALL-UNNAMED 03:13:43 --add-opens=java.base/java.util.zip=ALL-UNNAMED 03:13:43 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 03:13:43 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 03:13:43 -Xlog:disable 03:14:44 build_karaf_tests71: OK ✔ in 1 minute 10.62 seconds 03:14:44 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 03:14:48 build_karaf_tests221: OK ✔ in 1 minute 14.32 seconds 03:14:48 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 03:14:48 build_karaf_tests200: OK ✔ in 1 minute 14.53 seconds 03:14:48 build_karaf_tests121: OK ✔ in 1 minute 14.58 seconds 03:14:48 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 03:14:55 sims: freeze> python -m pip freeze --all 03:14:56 buildlighty: freeze> python -m pip freeze --all 03:14:56 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 03:14:56 sims: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./install_lightynode.sh 03:14:56 Using lighynode version 22.1.0.7 03:14:56 Installing lightynode device to ./lightynode/lightynode-openroadm-device directory 03:14:56 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 03:14:56 buildlighty: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/lighty> ./build.sh 03:14:56 NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED 03:14:59 sims: OK ✔ in 10.62 seconds 03:14:59 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 03:15:04 tests71: freeze> python -m pip freeze --all 03:15:05 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 03:15:05 tests71: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh 7.1 03:15:05 using environment variables from ./karaf71.env 03:15:05 pytest -q transportpce_tests/7.1/test01_portmapping.py 03:15:50 .buildlighty: OK ✔ in 43.44 seconds 03:15:50 testsPCE: freeze> python -m pip freeze --all 03:15:51 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==2026.1.post1,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 03:15:51 testsPCE: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh pce 03:15:51 pytest -q transportpce_tests/pce/test01_pce.py 03:15:51 ........... [100%] 03:16:03 12 passed in 58.31s 03:16:03 pytest -q transportpce_tests/7.1/test02_otn_renderer.py 03:16:39 ...................................................... [100%] 03:17:50 20 passed in 119.64s (0:01:59) 03:17:51 pytest -q transportpce_tests/pce/test02_pce_400G.py 03:17:51 .................................. [100%] 03:18:37 12 passed in 46.42s 03:18:37 pytest -q transportpce_tests/pce/test03_gnpy.py 03:18:38 ...... [100%] 03:18:50 62 passed in 166.17s (0:02:46) 03:18:50 pytest -q transportpce_tests/7.1/test03_renderer_or_modes.py 03:18:54 ........ [100%] 03:19:16 8 passed in 38.15s 03:19:16 pytest -q transportpce_tests/pce/test04_pce_bug_fix.py 03:19:23 ................. [100%] 03:19:53 3 passed in 37.50s 03:19:54 testsPCE: OK ✔ in 5 minutes 5.52 seconds 03:19:54 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 03:19:54 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 03:19:54 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 03:19:55 ....tests200: freeze> python -m pip freeze --all 03:20:03 tests121: freeze> python -m pip freeze --all 03:20:03 tests_tapi: freeze> python -m pip freeze --all 03:20:03 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 03:20:03 tests121: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh 1.2.1 03:20:03 using environment variables from ./karaf121.env 03:20:03 pytest -q transportpce_tests/1.2.1/test01_portmapping.py 03:20:03 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 03:20:03 tests_tapi: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh tapi 03:20:03 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 03:20:03 tests200: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh oc200 03:20:03 using environment variables from ./karaf221.env 03:20:03 pytest -q transportpce_tests/tapi/test01_abstracted_topology.py 03:20:03 using environment variables from ./karafoc200.env 03:20:03 pytest -q transportpce_tests/oc200/test01_portmapping.py 03:20:03 ................................ [100%] 03:21:10 48 passed in 139.67s (0:02:19) 03:21:10 pytest -q transportpce_tests/7.1/test04_renderer_regen_mode.py 03:21:17 ........ [100%] 03:21:27 10 passed in 83.38s (0:01:23) 03:21:27 pytest -q transportpce_tests/oc200/test02_topology.py 03:21:57 .................................................................. [100%] 03:22:46 22 passed in 95.21s (0:01:35) 03:22:48 [100%] 03:22:48 14 passed in 80.89s (0:01:20) 03:22:48 pytest -q transportpce_tests/oc200/test03_renderer.py 03:23:04 ....................... [100%] 03:23:35 16 passed in 47.18s 03:23:48 ..........F.FF.FF.FF.FFFFFFFFFFFFF [100%] 03:24:34 =================================== FAILURES =================================== 03:24:34 ___________ TestTransportPCEPortmapping.test_02_rdm_device_connected ___________ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01?content=nonconfig' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01?content=nonconfig' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_02_rdm_device_connected(self): 03:24:34 > response = test_utils.check_device_connection("ROADMA01") 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:54: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:409: in check_device_connection 03:24:34 response = get_request(url[RESTCONF_VERSION].format('{}', node)) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:117: in get_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_02_rdm_device_connected 03:24:34 ___________ TestTransportPCEPortmapping.test_03_rdm_portmapping_info ___________ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/node-info' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/node-info' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_03_rdm_portmapping_info(self): 03:24:34 > response = test_utils.get_portmapping_node_attr("ROADMA01", "node-info", None) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:60: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 03:24:34 response = get_request(target_url) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:117: in get_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_03_rdm_portmapping_info 03:24:34 ______ TestTransportPCEPortmapping.test_04_rdm_portmapping_DEG1_TTP_TXRX _______ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=DEG1-TTP-TXRX' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=DEG1-TTP-TXRX' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_04_rdm_portmapping_DEG1_TTP_TXRX(self): 03:24:34 > response = test_utils.get_portmapping_node_attr("ROADMA01", "mapping", "DEG1-TTP-TXRX") 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:73: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 03:24:34 response = get_request(target_url) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:117: in get_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_04_rdm_portmapping_DEG1_TTP_TXRX 03:24:34 ______ TestTransportPCEPortmapping.test_05_rdm_portmapping_SRG1_PP7_TXRX _______ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=SRG1-PP7-TXRX' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=SRG1-PP7-TXRX' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_05_rdm_portmapping_SRG1_PP7_TXRX(self): 03:24:34 > response = test_utils.get_portmapping_node_attr("ROADMA01", "mapping", "SRG1-PP7-TXRX") 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:82: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 03:24:34 response = get_request(target_url) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:117: in get_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_05_rdm_portmapping_SRG1_PP7_TXRX 03:24:34 ______ TestTransportPCEPortmapping.test_06_rdm_portmapping_SRG3_PP1_TXRX _______ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=SRG3-PP1-TXRX' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/mapping=SRG3-PP1-TXRX' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_06_rdm_portmapping_SRG3_PP1_TXRX(self): 03:24:34 > response = test_utils.get_portmapping_node_attr("ROADMA01", "mapping", "SRG3-PP1-TXRX") 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:91: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 03:24:34 response = get_request(target_url) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:117: in get_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_06_rdm_portmapping_SRG3_PP1_TXRX 03:24:34 __________ TestTransportPCEPortmapping.test_07_xpdr_device_connection __________ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'PUT' 03:24:34 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01' 03:24:34 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}}]}' 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'PUT' 03:24:34 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_07_xpdr_device_connection(self): 03:24:34 > response = test_utils.mount_device("XPDRA01", ('xpdra', self.NODE_VERSION)) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:100: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:381: in mount_device 03:24:34 response = put_request(url[RESTCONF_VERSION].format('{}', node), body) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:125: in put_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_07_xpdr_device_connection 03:24:34 __________ TestTransportPCEPortmapping.test_08_xpdr_device_connected ___________ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01?content=nonconfig' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01?content=nonconfig' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_08_xpdr_device_connected(self): 03:24:34 > response = test_utils.check_device_connection("XPDRA01") 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:104: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:409: in check_device_connection 03:24:34 response = get_request(url[RESTCONF_VERSION].format('{}', node)) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:117: in get_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_08_xpdr_device_connected 03:24:34 __________ TestTransportPCEPortmapping.test_09_xpdr_portmapping_info ___________ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/node-info' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/node-info' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_09_xpdr_portmapping_info(self): 03:24:34 > response = test_utils.get_portmapping_node_attr("XPDRA01", "node-info", None) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:110: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 03:24:34 response = get_request(target_url) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:117: in get_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_09_xpdr_portmapping_info 03:24:34 ________ TestTransportPCEPortmapping.test_10_xpdr_portmapping_NETWORK1 _________ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-NETWORK1' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-NETWORK1' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_10_xpdr_portmapping_NETWORK1(self): 03:24:34 > response = test_utils.get_portmapping_node_attr("XPDRA01", "mapping", "XPDR1-NETWORK1") 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:123: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 03:24:34 response = get_request(target_url) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:117: in get_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_10_xpdr_portmapping_NETWORK1 03:24:34 ________ TestTransportPCEPortmapping.test_11_xpdr_portmapping_NETWORK2 _________ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-NETWORK2' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-NETWORK2' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_11_xpdr_portmapping_NETWORK2(self): 03:24:34 > response = test_utils.get_portmapping_node_attr("XPDRA01", "mapping", "XPDR1-NETWORK2") 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:135: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 03:24:34 response = get_request(target_url) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:117: in get_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_11_xpdr_portmapping_NETWORK2 03:24:34 _________ TestTransportPCEPortmapping.test_12_xpdr_portmapping_CLIENT1 _________ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT1' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT1' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_12_xpdr_portmapping_CLIENT1(self): 03:24:34 > response = test_utils.get_portmapping_node_attr("XPDRA01", "mapping", "XPDR1-CLIENT1") 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:147: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 03:24:34 response = get_request(target_url) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:117: in get_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_12_xpdr_portmapping_CLIENT1 03:24:34 _________ TestTransportPCEPortmapping.test_13_xpdr_portmapping_CLIENT2 _________ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT2' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT2' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_13_xpdr_portmapping_CLIENT2(self): 03:24:34 > response = test_utils.get_portmapping_node_attr("XPDRA01", "mapping", "XPDR1-CLIENT2") 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:159: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 03:24:34 response = get_request(target_url) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:117: in get_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_13_xpdr_portmapping_CLIENT2 03:24:34 _________ TestTransportPCEPortmapping.test_14_xpdr_portmapping_CLIENT3 _________ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT3' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT3' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_14_xpdr_portmapping_CLIENT3(self): 03:24:34 > response = test_utils.get_portmapping_node_attr("XPDRA01", "mapping", "XPDR1-CLIENT3") 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:170: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 03:24:34 response = get_request(target_url) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:117: in get_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_14_xpdr_portmapping_CLIENT3 03:24:34 _________ TestTransportPCEPortmapping.test_15_xpdr_portmapping_CLIENT4 _________ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT4' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/mapping=XPDR1-CLIENT4' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_15_xpdr_portmapping_CLIENT4(self): 03:24:34 > response = test_utils.get_portmapping_node_attr("XPDRA01", "mapping", "XPDR1-CLIENT4") 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:182: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 03:24:34 response = get_request(target_url) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:117: in get_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_15_xpdr_portmapping_CLIENT4 03:24:34 ________ TestTransportPCEPortmapping.test_16_xpdr_device_disconnection _________ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'DELETE' 03:24:34 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'DELETE' 03:24:34 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_16_xpdr_device_disconnection(self): 03:24:34 > response = test_utils.unmount_device("XPDRA01") 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:193: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:398: in unmount_device 03:24:34 response = delete_request(url[RESTCONF_VERSION].format('{}', node)) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:134: in delete_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_16_xpdr_device_disconnection 03:24:34 _________ TestTransportPCEPortmapping.test_17_xpdr_device_disconnected _________ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01?content=nonconfig' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01?content=nonconfig' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_17_xpdr_device_disconnected(self): 03:24:34 > response = test_utils.check_device_connection("XPDRA01") 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:197: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:409: in check_device_connection 03:24:34 response = get_request(url[RESTCONF_VERSION].format('{}', node)) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:117: in get_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_17_xpdr_device_disconnected 03:24:34 ________ TestTransportPCEPortmapping.test_18_xpdr_device_not_connected _________ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/node-info' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=XPDRA01/node-info' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_18_xpdr_device_not_connected(self): 03:24:34 > response = test_utils.get_portmapping_node_attr("XPDRA01", "node-info", None) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:205: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 03:24:34 response = get_request(target_url) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:117: in get_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_18_xpdr_device_not_connected 03:24:34 _________ TestTransportPCEPortmapping.test_19_rdm_device_disconnection _________ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'DELETE' 03:24:34 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'DELETE' 03:24:34 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_19_rdm_device_disconnection(self): 03:24:34 > response = test_utils.unmount_device("ROADMA01") 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:213: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:398: in unmount_device 03:24:34 response = delete_request(url[RESTCONF_VERSION].format('{}', node)) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:134: in delete_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_19_rdm_device_disconnection 03:24:34 _________ TestTransportPCEPortmapping.test_20_rdm_device_disconnected __________ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01?content=nonconfig' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01?content=nonconfig' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_20_rdm_device_disconnected(self): 03:24:34 > response = test_utils.check_device_connection("ROADMA01") 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:217: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:409: in check_device_connection 03:24:34 response = get_request(url[RESTCONF_VERSION].format('{}', node)) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:117: in get_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_20_rdm_device_disconnected 03:24:34 _________ TestTransportPCEPortmapping.test_21_rdm_device_not_connected _________ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 > sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:204: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 03:24:34 raise err 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 address = ('localhost', 8191), timeout = 30, source_address = None 03:24:34 socket_options = [(6, 1, 1)] 03:24:34 03:24:34 def create_connection( 03:24:34 address: tuple[str, int], 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 source_address: tuple[str, int] | None = None, 03:24:34 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 03:24:34 ) -> socket.socket: 03:24:34 """Connect to *address* and return the socket object. 03:24:34 03:24:34 Convenience function. Connect to *address* (a 2-tuple ``(host, 03:24:34 port)``) and return the socket object. Passing the optional 03:24:34 *timeout* parameter will set the timeout on the socket instance 03:24:34 before attempting to connect. If no *timeout* is supplied, the 03:24:34 global default timeout setting returned by :func:`socket.getdefaulttimeout` 03:24:34 is used. If *source_address* is set it must be a tuple of (host, port) 03:24:34 for the socket to bind as a source address before making the connection. 03:24:34 An host of '' or port 0 tells the OS to use the default. 03:24:34 """ 03:24:34 03:24:34 host, port = address 03:24:34 if host.startswith("["): 03:24:34 host = host.strip("[]") 03:24:34 err = None 03:24:34 03:24:34 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 03:24:34 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 03:24:34 # The original create_connection function always returns all records. 03:24:34 family = allowed_gai_family() 03:24:34 03:24:34 try: 03:24:34 host.encode("idna") 03:24:34 except UnicodeError: 03:24:34 raise LocationParseError(f"'{host}', label empty or too long") from None 03:24:34 03:24:34 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 03:24:34 af, socktype, proto, canonname, sa = res 03:24:34 sock = None 03:24:34 try: 03:24:34 sock = socket.socket(af, socktype, proto) 03:24:34 03:24:34 # If provided, set socket level options before connecting. 03:24:34 _set_socket_options(sock, socket_options) 03:24:34 03:24:34 if timeout is not _DEFAULT_TIMEOUT: 03:24:34 sock.settimeout(timeout) 03:24:34 if source_address: 03:24:34 sock.bind(source_address) 03:24:34 > sock.connect(sa) 03:24:34 E ConnectionRefusedError: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/node-info' 03:24:34 body = None 03:24:34 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='} 03:24:34 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 redirect = False, assert_same_host = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), pool_timeout = None 03:24:34 release_conn = False, chunked = False, body_pos = None, preload_content = False 03:24:34 decode_content = False, response_kw = {} 03:24:34 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) 03:24:34 destination_scheme = None, conn = None, release_this_conn = True 03:24:34 http_tunnel_required = False, err = None, clean_exit = False 03:24:34 03:24:34 def urlopen( # type: ignore[override] 03:24:34 self, 03:24:34 method: str, 03:24:34 url: str, 03:24:34 body: _TYPE_BODY | None = None, 03:24:34 headers: typing.Mapping[str, str] | None = None, 03:24:34 retries: Retry | bool | int | None = None, 03:24:34 redirect: bool = True, 03:24:34 assert_same_host: bool = True, 03:24:34 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 03:24:34 pool_timeout: int | None = None, 03:24:34 release_conn: bool | None = None, 03:24:34 chunked: bool = False, 03:24:34 body_pos: _TYPE_BODY_POSITION | None = None, 03:24:34 preload_content: bool = True, 03:24:34 decode_content: bool = True, 03:24:34 **response_kw: typing.Any, 03:24:34 ) -> BaseHTTPResponse: 03:24:34 """ 03:24:34 Get a connection from the pool and perform an HTTP request. This is the 03:24:34 lowest level call for making a request, so you'll need to specify all 03:24:34 the raw details. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 More commonly, it's appropriate to use a convenience method 03:24:34 such as :meth:`request`. 03:24:34 03:24:34 .. note:: 03:24:34 03:24:34 `release_conn` will only behave as expected if 03:24:34 `preload_content=False` because we want to make 03:24:34 `preload_content=False` the default behaviour someday soon without 03:24:34 breaking backwards compatibility. 03:24:34 03:24:34 :param method: 03:24:34 HTTP request method (such as GET, POST, PUT, etc.) 03:24:34 03:24:34 :param url: 03:24:34 The URL to perform the request on. 03:24:34 03:24:34 :param body: 03:24:34 Data to send in the request body, either :class:`str`, :class:`bytes`, 03:24:34 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 03:24:34 03:24:34 :param headers: 03:24:34 Dictionary of custom headers to send, such as User-Agent, 03:24:34 If-None-Match, etc. If None, pool headers are used. If provided, 03:24:34 these headers completely replace any pool-specific headers. 03:24:34 03:24:34 :param retries: 03:24:34 Configure the number of retries to allow before raising a 03:24:34 :class:`~urllib3.exceptions.MaxRetryError` exception. 03:24:34 03:24:34 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 03:24:34 :class:`~urllib3.util.retry.Retry` object for fine-grained control 03:24:34 over different types of retries. 03:24:34 Pass an integer number to retry connection errors that many times, 03:24:34 but no other types of errors. Pass zero to never retry. 03:24:34 03:24:34 If ``False``, then retries are disabled and any exception is raised 03:24:34 immediately. Also, instead of raising a MaxRetryError on redirects, 03:24:34 the redirect response will be returned. 03:24:34 03:24:34 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 03:24:34 03:24:34 :param redirect: 03:24:34 If True, automatically handle redirects (status codes 301, 302, 03:24:34 303, 307, 308). Each redirect counts as a retry. Disabling retries 03:24:34 will disable redirect, too. 03:24:34 03:24:34 :param assert_same_host: 03:24:34 If ``True``, will make sure that the host of the pool requests is 03:24:34 consistent else will raise HostChangedError. When ``False``, you can 03:24:34 use the pool on an HTTP proxy and request foreign hosts. 03:24:34 03:24:34 :param timeout: 03:24:34 If specified, overrides the default timeout for this one 03:24:34 request. It may be a float (in seconds) or an instance of 03:24:34 :class:`urllib3.util.Timeout`. 03:24:34 03:24:34 :param pool_timeout: 03:24:34 If set and the pool is set to block=True, then this method will 03:24:34 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 03:24:34 connection is available within the time period. 03:24:34 03:24:34 :param bool preload_content: 03:24:34 If True, the response's body will be preloaded into memory. 03:24:34 03:24:34 :param bool decode_content: 03:24:34 If True, will attempt to decode the body based on the 03:24:34 'content-encoding' header. 03:24:34 03:24:34 :param release_conn: 03:24:34 If False, then the urlopen call will not release the connection 03:24:34 back into the pool once a response is received (but will release if 03:24:34 you read the entire contents of the response such as when 03:24:34 `preload_content=True`). This is useful if you're not preloading 03:24:34 the response's content immediately. You will need to call 03:24:34 ``r.release_conn()`` on the response ``r`` to return the connection 03:24:34 back into the pool. If None, it takes the value of ``preload_content`` 03:24:34 which defaults to ``True``. 03:24:34 03:24:34 :param bool chunked: 03:24:34 If True, urllib3 will send the body using chunked transfer 03:24:34 encoding. Otherwise, urllib3 will send the body using the standard 03:24:34 content-length form. Defaults to False. 03:24:34 03:24:34 :param int body_pos: 03:24:34 Position to seek to in file-like body in the event of a retry or 03:24:34 redirect. Typically this won't need to be set because urllib3 will 03:24:34 auto-populate the value when needed. 03:24:34 """ 03:24:34 parsed_url = parse_url(url) 03:24:34 destination_scheme = parsed_url.scheme 03:24:34 03:24:34 if headers is None: 03:24:34 headers = self.headers 03:24:34 03:24:34 if not isinstance(retries, Retry): 03:24:34 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 03:24:34 03:24:34 if release_conn is None: 03:24:34 release_conn = preload_content 03:24:34 03:24:34 # Check host 03:24:34 if assert_same_host and not self.is_same_host(url): 03:24:34 raise HostChangedError(self, url, retries) 03:24:34 03:24:34 # Ensure that the URL we're connecting to is properly encoded 03:24:34 if url.startswith("/"): 03:24:34 url = to_str(_encode_target(url)) 03:24:34 else: 03:24:34 url = to_str(parsed_url.url) 03:24:34 03:24:34 conn = None 03:24:34 03:24:34 # Track whether `conn` needs to be released before 03:24:34 # returning/raising/recursing. Update this variable if necessary, and 03:24:34 # leave `release_conn` constant throughout the function. That way, if 03:24:34 # the function recurses, the original value of `release_conn` will be 03:24:34 # passed down into the recursive call, and its value will be respected. 03:24:34 # 03:24:34 # See issue #651 [1] for details. 03:24:34 # 03:24:34 # [1] 03:24:34 release_this_conn = release_conn 03:24:34 03:24:34 http_tunnel_required = connection_requires_http_tunnel( 03:24:34 self.proxy, self.proxy_config, destination_scheme 03:24:34 ) 03:24:34 03:24:34 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 03:24:34 # have to copy the headers dict so we can safely change it without those 03:24:34 # changes being reflected in anyone else's copy. 03:24:34 if not http_tunnel_required: 03:24:34 headers = headers.copy() # type: ignore[attr-defined] 03:24:34 headers.update(self.proxy_headers) # type: ignore[union-attr] 03:24:34 03:24:34 # Must keep the exception bound to a separate variable or else Python 3 03:24:34 # complains about UnboundLocalError. 03:24:34 err = None 03:24:34 03:24:34 # Keep track of whether we cleanly exited the except block. This 03:24:34 # ensures we do proper cleanup in finally. 03:24:34 clean_exit = False 03:24:34 03:24:34 # Rewind body position, if needed. Record current position 03:24:34 # for future rewinds in the event of a redirect/retry. 03:24:34 body_pos = set_file_position(body, body_pos) 03:24:34 03:24:34 try: 03:24:34 # Request a connection from the queue. 03:24:34 timeout_obj = self._get_timeout(timeout) 03:24:34 conn = self._get_conn(timeout=pool_timeout) 03:24:34 03:24:34 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 03:24:34 03:24:34 # Is this a closed/new connection that requires CONNECT tunnelling? 03:24:34 if self.proxy is not None and http_tunnel_required and conn.is_closed: 03:24:34 try: 03:24:34 self._prepare_proxy(conn) 03:24:34 except (BaseSSLError, OSError, SocketTimeout) as e: 03:24:34 self._raise_timeout( 03:24:34 err=e, url=self.proxy.url, timeout_value=conn.timeout 03:24:34 ) 03:24:34 raise 03:24:34 03:24:34 # If we're going to release the connection in ``finally:``, then 03:24:34 # the response doesn't need to know about the connection. Otherwise 03:24:34 # it will also try to release it and we'll have a double-release 03:24:34 # mess. 03:24:34 response_conn = conn if not release_conn else None 03:24:34 03:24:34 # Make the request on the HTTPConnection object 03:24:34 > response = self._make_request( 03:24:34 conn, 03:24:34 method, 03:24:34 url, 03:24:34 timeout=timeout_obj, 03:24:34 body=body, 03:24:34 headers=headers, 03:24:34 chunked=chunked, 03:24:34 retries=retries, 03:24:34 response_conn=response_conn, 03:24:34 preload_content=preload_content, 03:24:34 decode_content=decode_content, 03:24:34 **response_kw, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:787: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:493: in _make_request 03:24:34 conn.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:500: in request 03:24:34 self.endheaders() 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1298: in endheaders 03:24:34 self._send_output(message_body, encode_chunked=encode_chunked) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:1058: in _send_output 03:24:34 self.send(msg) 03:24:34 /opt/pyenv/versions/3.11.10/lib/python3.11/http/client.py:996: in send 03:24:34 self.connect() 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:331: in connect 03:24:34 self.sock = self._new_conn() 03:24:34 ^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 03:24:34 def _new_conn(self) -> socket.socket: 03:24:34 """Establish a socket connection and set nodelay settings on it. 03:24:34 03:24:34 :return: New socket connection. 03:24:34 """ 03:24:34 try: 03:24:34 sock = connection.create_connection( 03:24:34 (self._dns_host, self.port), 03:24:34 self.timeout, 03:24:34 source_address=self.source_address, 03:24:34 socket_options=self.socket_options, 03:24:34 ) 03:24:34 except socket.gaierror as e: 03:24:34 raise NameResolutionError(self.host, self, e) from e 03:24:34 except SocketTimeout as e: 03:24:34 raise ConnectTimeoutError( 03:24:34 self, 03:24:34 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 03:24:34 ) from e 03:24:34 03:24:34 except OSError as e: 03:24:34 > raise NewConnectionError( 03:24:34 self, f"Failed to establish a new connection: {e}" 03:24:34 ) from e 03:24:34 E urllib3.exceptions.NewConnectionError: HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:219: NewConnectionError 03:24:34 03:24:34 The above exception was the direct cause of the following exception: 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 > resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:644: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:841: in urlopen 03:24:34 retries = retries.increment( 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 03:24:34 method = 'GET' 03:24:34 url = '/rests/data/transportpce-portmapping:network/nodes=ROADMA01/node-info' 03:24:34 response = None 03:24:34 error = NewConnectionError("HTTPConnection(host='localhost', port=8191): Failed to establish a new connection: [Errno 111] Connection refused") 03:24:34 _pool = 03:24:34 _stacktrace = 03:24:34 03:24:34 def increment( 03:24:34 self, 03:24:34 method: str | None = None, 03:24:34 url: str | None = None, 03:24:34 response: BaseHTTPResponse | None = None, 03:24:34 error: Exception | None = None, 03:24:34 _pool: ConnectionPool | None = None, 03:24:34 _stacktrace: TracebackType | None = None, 03:24:34 ) -> Self: 03:24:34 """Return a new Retry object with incremented retry counters. 03:24:34 03:24:34 :param response: A response object, or None, if the server did not 03:24:34 return a response. 03:24:34 :type response: :class:`~urllib3.response.BaseHTTPResponse` 03:24:34 :param Exception error: An error encountered during the request, or 03:24:34 None if the response was received successfully. 03:24:34 03:24:34 :return: A new ``Retry`` object. 03:24:34 """ 03:24:34 if self.total is False and error: 03:24:34 # Disabled, indicate to re-raise the error. 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 03:24:34 total = self.total 03:24:34 if total is not None: 03:24:34 total -= 1 03:24:34 03:24:34 connect = self.connect 03:24:34 read = self.read 03:24:34 redirect = self.redirect 03:24:34 status_count = self.status 03:24:34 other = self.other 03:24:34 cause = "unknown" 03:24:34 status = None 03:24:34 redirect_location = None 03:24:34 03:24:34 if error and self._is_connection_error(error): 03:24:34 # Connect retry? 03:24:34 if connect is False: 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif connect is not None: 03:24:34 connect -= 1 03:24:34 03:24:34 elif error and self._is_read_error(error): 03:24:34 # Read retry? 03:24:34 if read is False or method is None or not self._is_method_retryable(method): 03:24:34 raise reraise(type(error), error, _stacktrace) 03:24:34 elif read is not None: 03:24:34 read -= 1 03:24:34 03:24:34 elif error: 03:24:34 # Other retry? 03:24:34 if other is not None: 03:24:34 other -= 1 03:24:34 03:24:34 elif response and response.get_redirect_location(): 03:24:34 # Redirect retry? 03:24:34 if redirect is not None: 03:24:34 redirect -= 1 03:24:34 cause = "too many redirects" 03:24:34 response_redirect_location = response.get_redirect_location() 03:24:34 if response_redirect_location: 03:24:34 redirect_location = response_redirect_location 03:24:34 status = response.status 03:24:34 03:24:34 else: 03:24:34 # Incrementing because of a server error like a 500 in 03:24:34 # status_forcelist and the given method is in the allowed_methods 03:24:34 cause = ResponseError.GENERIC_ERROR 03:24:34 if response and response.status: 03:24:34 if status_count is not None: 03:24:34 status_count -= 1 03:24:34 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 03:24:34 status = response.status 03:24:34 03:24:34 history = self.history + ( 03:24:34 RequestHistory(method, url, error, status, redirect_location), 03:24:34 ) 03:24:34 03:24:34 new_retry = self.new( 03:24:34 total=total, 03:24:34 connect=connect, 03:24:34 read=read, 03:24:34 redirect=redirect, 03:24:34 status=status_count, 03:24:34 other=other, 03:24:34 history=history, 03:24:34 ) 03:24:34 03:24:34 if new_retry.is_exhausted(): 03:24:34 reason = error or ResponseError(cause) 03:24:34 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:535: MaxRetryError 03:24:34 03:24:34 During handling of the above exception, another exception occurred: 03:24:34 03:24:34 self = 03:24:34 03:24:34 def test_21_rdm_device_not_connected(self): 03:24:34 > response = test_utils.get_portmapping_node_attr("ROADMA01", "node-info", None) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 03:24:34 transportpce_tests/1.2.1/test01_portmapping.py:225: 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 transportpce_tests/common/test_utils.py:519: in get_portmapping_node_attr 03:24:34 response = get_request(target_url) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 transportpce_tests/common/test_utils.py:117: in get_request 03:24:34 return requests.request( 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 03:24:34 return session.request(method=method, url=url, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 03:24:34 resp = self.send(prep, **send_kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 03:24:34 r = adapter.send(request, **kwargs) 03:24:34 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 03:24:34 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 03:24:34 03:24:34 self = 03:24:34 request = , stream = False 03:24:34 timeout = Timeout(connect=30, read=30, total=None), verify = True, cert = None 03:24:34 proxies = OrderedDict() 03:24:34 03:24:34 def send( 03:24:34 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 03:24:34 ): 03:24:34 """Sends PreparedRequest object. Returns Response object. 03:24:34 03:24:34 :param request: The :class:`PreparedRequest ` being sent. 03:24:34 :param stream: (optional) Whether to stream the request content. 03:24:34 :param timeout: (optional) How long to wait for the server to send 03:24:34 data before giving up, as a float, or a :ref:`(connect timeout, 03:24:34 read timeout) ` tuple. 03:24:34 :type timeout: float or tuple or urllib3 Timeout object 03:24:34 :param verify: (optional) Either a boolean, in which case it controls whether 03:24:34 we verify the server's TLS certificate, or a string, in which case it 03:24:34 must be a path to a CA bundle to use 03:24:34 :param cert: (optional) Any user-provided SSL certificate to be trusted. 03:24:34 :param proxies: (optional) The proxies dictionary to apply to the request. 03:24:34 :rtype: requests.Response 03:24:34 """ 03:24:34 03:24:34 try: 03:24:34 conn = self.get_connection_with_tls_context( 03:24:34 request, verify, proxies=proxies, cert=cert 03:24:34 ) 03:24:34 except LocationValueError as e: 03:24:34 raise InvalidURL(e, request=request) 03:24:34 03:24:34 self.cert_verify(conn, request.url, verify, cert) 03:24:34 url = self.request_url(request, proxies) 03:24:34 self.add_headers( 03:24:34 request, 03:24:34 stream=stream, 03:24:34 timeout=timeout, 03:24:34 verify=verify, 03:24:34 cert=cert, 03:24:34 proxies=proxies, 03:24:34 ) 03:24:34 03:24:34 chunked = not (request.body is None or "Content-Length" in request.headers) 03:24:34 03:24:34 if isinstance(timeout, tuple): 03:24:34 try: 03:24:34 connect, read = timeout 03:24:34 timeout = TimeoutSauce(connect=connect, read=read) 03:24:34 except ValueError: 03:24:34 raise ValueError( 03:24:34 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 03:24:34 f"or a single float to set both timeouts to the same value." 03:24:34 ) 03:24:34 elif isinstance(timeout, TimeoutSauce): 03:24:34 pass 03:24:34 else: 03:24:34 timeout = TimeoutSauce(connect=timeout, read=timeout) 03:24:34 03:24:34 try: 03:24:34 resp = conn.urlopen( 03:24:34 method=request.method, 03:24:34 url=url, 03:24:34 body=request.body, 03:24:34 headers=request.headers, 03:24:34 redirect=False, 03:24:34 assert_same_host=False, 03:24:34 preload_content=False, 03:24:34 decode_content=False, 03:24:34 retries=self.max_retries, 03:24:34 timeout=timeout, 03:24:34 chunked=chunked, 03:24:34 ) 03:24:34 03:24:34 except (ProtocolError, OSError) as err: 03:24:34 raise ConnectionError(err, request=request) 03:24:34 03:24:34 except MaxRetryError as e: 03:24:34 if isinstance(e.reason, ConnectTimeoutError): 03:24:34 # TODO: Remove this in 3.0.0: see #2811 03:24:34 if not isinstance(e.reason, NewConnectionError): 03:24:34 raise ConnectTimeout(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, ResponseError): 03:24:34 raise RetryError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _ProxyError): 03:24:34 raise ProxyError(e, request=request) 03:24:34 03:24:34 if isinstance(e.reason, _SSLError): 03:24:34 # This branch is for urllib3 v1.22 and later. 03:24:34 raise SSLError(e, request=request) 03:24:34 03:24:34 > raise ConnectionError(e, request=request) 03:24:34 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")) 03:24:34 03:24:34 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:677: ConnectionError 03:24:34 ----------------------------- Captured stdout call ----------------------------- 03:24:34 execution of test_21_rdm_device_not_connected 03:24:34 --------------------------- Captured stdout teardown --------------------------- 03:24:34 all processes killed 03:24:34 ODL log file stored 03:24:34 =========================== short test summary info ============================ 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_02_rdm_device_connected 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_03_rdm_portmapping_info 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_04_rdm_portmapping_DEG1_TTP_TXRX 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_05_rdm_portmapping_SRG1_PP7_TXRX 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_06_rdm_portmapping_SRG3_PP1_TXRX 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_07_xpdr_device_connection 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_08_xpdr_device_connected 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_09_xpdr_portmapping_info 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_10_xpdr_portmapping_NETWORK1 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_11_xpdr_portmapping_NETWORK2 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_12_xpdr_portmapping_CLIENT1 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_13_xpdr_portmapping_CLIENT2 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_14_xpdr_portmapping_CLIENT3 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_15_xpdr_portmapping_CLIENT4 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_16_xpdr_device_disconnection 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_17_xpdr_device_disconnected 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_18_xpdr_device_not_connected 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_19_rdm_device_disconnection 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_20_rdm_device_disconnected 03:24:34 FAILED transportpce_tests/1.2.1/test01_portmapping.py::TestTransportPCEPortmapping::test_21_rdm_device_not_connected 03:24:34 20 failed, 1 passed in 271.12s (0:04:31) 03:24:34 tests71: OK ✔ in 7 minutes 48.07 seconds 03:24:34 tests200: OK ✔ in 3 minutes 41.96 seconds 03:24:34 tests121: exit 1 (271.44 seconds) /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh 1.2.1 pid=9242 03:25:24 . [100%] 03:25:28 51 passed in 324.65s (0:05:24) 03:25:28 pytest -q transportpce_tests/tapi/test02_full_topology.py 03:26:19 .................................... [100%] 03:30:55 36 passed in 326.90s (0:05:26) 03:30:55 pytest -q transportpce_tests/tapi/test03_tapi_device_change_notifications.py 03:31:43 ....................................................................... [100%] 03:39:14 71 passed in 498.73s (0:08:18) 03:39:14 pytest -q transportpce_tests/tapi/test04_topo_extension.py 03:40:05 ................... [100%] 03:41:36 19 passed in 142.01s (0:02:22) 03:41:37 pytest -q transportpce_tests/tapi/test05_pce_tapi.py 03:43:41 ...................... [100%] 03:49:17 22 passed in 460.25s (0:07:40) 03:49:17 tests121: FAIL ✖ in 4 minutes 40.8 seconds 03:49:17 tests_tapi: OK ✔ in 29 minutes 23.53 seconds 03:49:17 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 03:49:25 tests221: freeze> python -m pip freeze --all 03:49:26 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 03:49:26 tests221: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh 2.2.1 03:49:26 using environment variables from ./karaf221.env 03:49:26 pytest -q transportpce_tests/2.2.1/test01_portmapping.py 03:50:02 ................................... [100%] 03:50:42 35 passed in 76.11s (0:01:16) 03:50:42 pytest -q transportpce_tests/2.2.1/test02_topo_portmapping.py 03:51:16 ...... [100%] 03:54:29 6 passed in 226.37s (0:03:46) 03:54:29 pytest -q transportpce_tests/2.2.1/test03_topology.py 03:55:11 ............................................ [100%] 03:56:45 44 passed in 136.48s (0:02:16) 03:56:46 pytest -q transportpce_tests/2.2.1/test04_otn_topology.py 03:57:21 ............ [100%] 03:57:45 12 passed in 59.36s 03:57:45 pytest -q transportpce_tests/2.2.1/test05_flex_grid.py 03:58:10 ................ [100%] 03:59:39 16 passed in 113.21s (0:01:53) 03:59:39 pytest -q transportpce_tests/2.2.1/test06_renderer_service_path_nominal.py 04:00:09 ............................... [100%] 04:00:15 31 passed in 36.38s 04:00:15 pytest -q transportpce_tests/2.2.1/test07_otn_renderer.py 04:00:51 .......................... [100%] 04:01:46 26 passed in 90.61s (0:01:30) 04:01:46 pytest -q transportpce_tests/2.2.1/test08_otn_sh_renderer.py 04:02:22 ...................... [100%] 04:03:26 22 passed in 99.18s (0:01:39) 04:03:26 pytest -q transportpce_tests/2.2.1/test09_olm.py 04:04:06 ........................................ [100%] 04:06:27 40 passed in 181.44s (0:03:01) 04:06:27 pytest -q transportpce_tests/2.2.1/test11_otn_end2end.py 04:07:10 ........................................................................ [ 74%] 04:12:47 ......................... [100%] 04:14:39 97 passed in 491.00s (0:08:10) 04:14:39 pytest -q transportpce_tests/2.2.1/test12_end2end.py 04:15:18 ...................................................... [100%] 04:25:06 54 passed in 626.81s (0:10:26) 04:25:06 pytest -q transportpce_tests/2.2.1/test14_otn_switch_end2end.py 04:26:00 ........................................................................ [ 71%] 04:31:08 ............................. [100%] 04:33:18 101 passed in 490.88s (0:08:10) 04:33:18 pytest -q transportpce_tests/2.2.1/test15_otn_end2end_with_intermediate_switch.py 04:34:11 ........................................................................ [ 67%] 04:39:58 ................................... [100%] 04:46:18 107 passed in 780.79s (0:13:00) 04:46:18 pytest -q transportpce_tests/2.2.1/test16_freq_end2end.py 04:47:00 ............................................. [100%] 04:49:38 45 passed in 199.13s (0:03:19) 04:49:38 tests221: OK ✔ in 1 hour 20.51 seconds 04:49:38 tests_hybrid: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 04:49:46 tests_hybrid: freeze> python -m pip freeze --all 04:49:46 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 04:49:46 tests_hybrid: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh hybrid 04:49:46 using environment variables from ./karaf221.env 04:49:46 pytest -q transportpce_tests/hybrid/test01_device_change_notifications.py 04:50:27 ................................................... [100%] 04:52:14 51 passed in 147.67s (0:02:27) 04:52:14 pytest -q transportpce_tests/hybrid/test02_B100G_end2end.py 04:52:56 ........................................................................ [ 66%] 04:57:17 ..................................... [100%] 04:59:24 109 passed in 428.91s (0:07:08) 04:59:24 pytest -q transportpce_tests/hybrid/test03_autonomous_reroute.py 05:00:11 ..................................................... [100%] 05:03:44 53 passed in 260.42s (0:04:20) 05:03:44 buildcontroller: OK (107.43=setup[8.90]+cmd[98.54] seconds) 05:03:44 sims: OK (10.62=setup[8.00]+cmd[2.62] seconds) 05:03:44 build_karaf_tests121: OK (74.58=setup[9.19]+cmd[65.39] seconds) 05:03:44 testsPCE: OK (305.52=setup[62.55]+cmd[242.97] seconds) 05:03:44 tests121: FAIL code 1 (280.79=setup[9.35]+cmd[271.44] seconds) 05:03:44 build_karaf_tests221: OK (74.32=setup[9.21]+cmd[65.11] seconds) 05:03:44 tests_tapi: OK (1763.53=setup[9.36]+cmd[1754.16] seconds) 05:03:44 tests221: OK (3620.51=setup[8.58]+cmd[3611.94] seconds) 05:03:44 build_karaf_tests71: OK (70.62=setup[9.19]+cmd[61.43] seconds) 05:03:44 tests71: OK (468.07=setup[6.34]+cmd[461.73] seconds) 05:03:44 build_karaf_tests200: OK (74.53=setup[9.16]+cmd[65.37] seconds) 05:03:44 tests200: OK (221.96=setup[9.37]+cmd[212.59] seconds) 05:03:44 tests_hybrid: OK (846.73=setup[8.85]+cmd[837.88] seconds) 05:03:44 buildlighty: OK (43.44=setup[11.73]+cmd[31.72] seconds) 05:03:44 docs: OK (35.35=setup[32.93]+cmd[2.42] seconds) 05:03:44 docs-linkcheck: OK (36.67=setup[31.33]+cmd[5.35] seconds) 05:03:44 checkbashisms: OK (3.15=setup[1.90]+cmd[0.01,0.04,1.19] seconds) 05:03:44 pre-commit: OK (51.79=setup[3.29]+cmd[0.01,0.00,40.43,8.05] seconds) 05:03:44 pylint: OK (32.14=setup[7.46]+cmd[24.68] seconds) 05:03:44 evaluation failed :( (6718.36 seconds) 05:03:44 + tox_status=1 05:03:44 + echo '---> Completed tox runs' 05:03:44 ---> Completed tox runs 05:03:44 + for i in .tox/*/log 05:03:44 ++ echo .tox/build_karaf_tests121/log 05:03:44 ++ awk -F/ '{print $2}' 05:03:44 + tox_env=build_karaf_tests121 05:03:44 + cp -r .tox/build_karaf_tests121/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/build_karaf_tests121 05:03:44 + for i in .tox/*/log 05:03:44 ++ echo .tox/build_karaf_tests200/log 05:03:44 ++ awk -F/ '{print $2}' 05:03:44 + tox_env=build_karaf_tests200 05:03:44 + cp -r .tox/build_karaf_tests200/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/build_karaf_tests200 05:03:44 + for i in .tox/*/log 05:03:44 ++ echo .tox/build_karaf_tests221/log 05:03:44 ++ awk -F/ '{print $2}' 05:03:44 + tox_env=build_karaf_tests221 05:03:44 + cp -r .tox/build_karaf_tests221/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/build_karaf_tests221 05:03:44 + for i in .tox/*/log 05:03:44 ++ echo .tox/build_karaf_tests71/log 05:03:44 ++ awk -F/ '{print $2}' 05:03:44 + tox_env=build_karaf_tests71 05:03:44 + cp -r .tox/build_karaf_tests71/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/build_karaf_tests71 05:03:44 + for i in .tox/*/log 05:03:44 ++ echo .tox/buildcontroller/log 05:03:44 ++ awk -F/ '{print $2}' 05:03:44 + tox_env=buildcontroller 05:03:44 + cp -r .tox/buildcontroller/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/buildcontroller 05:03:44 + for i in .tox/*/log 05:03:44 ++ echo .tox/buildlighty/log 05:03:44 ++ awk -F/ '{print $2}' 05:03:44 + tox_env=buildlighty 05:03:44 + cp -r .tox/buildlighty/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/buildlighty 05:03:44 + for i in .tox/*/log 05:03:44 ++ echo .tox/checkbashisms/log 05:03:44 ++ awk -F/ '{print $2}' 05:03:44 + tox_env=checkbashisms 05:03:44 + cp -r .tox/checkbashisms/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/checkbashisms 05:03:44 + for i in .tox/*/log 05:03:44 ++ awk -F/ '{print $2}' 05:03:44 ++ echo .tox/docs-linkcheck/log 05:03:44 + tox_env=docs-linkcheck 05:03:44 + cp -r .tox/docs-linkcheck/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/docs-linkcheck 05:03:44 + for i in .tox/*/log 05:03:44 ++ echo .tox/docs/log 05:03:44 ++ awk -F/ '{print $2}' 05:03:44 + tox_env=docs 05:03:44 + cp -r .tox/docs/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/docs 05:03:44 + for i in .tox/*/log 05:03:44 ++ echo .tox/pre-commit/log 05:03:44 ++ awk -F/ '{print $2}' 05:03:44 + tox_env=pre-commit 05:03:44 + cp -r .tox/pre-commit/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/pre-commit 05:03:44 + for i in .tox/*/log 05:03:44 ++ echo .tox/pylint/log 05:03:44 ++ awk -F/ '{print $2}' 05:03:44 + tox_env=pylint 05:03:44 + cp -r .tox/pylint/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/pylint 05:03:44 + for i in .tox/*/log 05:03:44 ++ echo .tox/sims/log 05:03:44 ++ awk -F/ '{print $2}' 05:03:45 + tox_env=sims 05:03:45 + cp -r .tox/sims/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/sims 05:03:45 + for i in .tox/*/log 05:03:45 ++ echo .tox/tests121/log 05:03:45 ++ awk -F/ '{print $2}' 05:03:45 + tox_env=tests121 05:03:45 + cp -r .tox/tests121/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests121 05:03:45 + for i in .tox/*/log 05:03:45 ++ echo .tox/tests200/log 05:03:45 ++ awk -F/ '{print $2}' 05:03:45 + tox_env=tests200 05:03:45 + cp -r .tox/tests200/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests200 05:03:45 + for i in .tox/*/log 05:03:45 ++ echo .tox/tests221/log 05:03:45 ++ awk -F/ '{print $2}' 05:03:45 + tox_env=tests221 05:03:45 + cp -r .tox/tests221/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests221 05:03:45 + for i in .tox/*/log 05:03:45 ++ echo .tox/tests71/log 05:03:45 ++ awk -F/ '{print $2}' 05:03:45 + tox_env=tests71 05:03:45 + cp -r .tox/tests71/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests71 05:03:45 + for i in .tox/*/log 05:03:45 ++ echo .tox/testsPCE/log 05:03:45 ++ awk -F/ '{print $2}' 05:03:45 + tox_env=testsPCE 05:03:45 + cp -r .tox/testsPCE/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/testsPCE 05:03:45 + for i in .tox/*/log 05:03:45 ++ echo .tox/tests_hybrid/log 05:03:45 ++ awk -F/ '{print $2}' 05:03:45 + tox_env=tests_hybrid 05:03:45 + cp -r .tox/tests_hybrid/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests_hybrid 05:03:45 + for i in .tox/*/log 05:03:45 ++ echo .tox/tests_tapi/log 05:03:45 ++ awk -F/ '{print $2}' 05:03:45 + tox_env=tests_tapi 05:03:45 + cp -r .tox/tests_tapi/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests_tapi 05:03:45 + DOC_DIR=docs/_build/html 05:03:45 + [[ -d docs/_build/html ]] 05:03:45 + echo '---> Archiving generated docs' 05:03:45 ---> Archiving generated docs 05:03:45 + mv docs/_build/html /w/workspace/transportpce-tox-verify-transportpce-master/archives/docs 05:03:45 + echo '---> tox-run.sh ends' 05:03:45 ---> tox-run.sh ends 05:03:45 + test 1 -eq 0 05:03:45 + exit 1 05:03:45 ++ '[' 1 = 1 ']' 05:03:45 ++ '[' -x /usr/bin/clear_console ']' 05:03:45 ++ /usr/bin/clear_console -q 05:03:45 Build step 'Execute shell' marked build as failure 05:03:45 $ ssh-agent -k 05:03:45 unset SSH_AUTH_SOCK; 05:03:45 unset SSH_AGENT_PID; 05:03:45 echo Agent pid 1578 killed; 05:03:45 [ssh-agent] Stopped. 05:03:45 [PostBuildScript] - [INFO] Executing post build scripts. 05:03:45 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins11758342678620452368.sh 05:03:45 ---> sysstat.sh 05:03:46 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins1428690836780302260.sh 05:03:46 ---> package-listing.sh 05:03:46 ++ facter osfamily 05:03:46 ++ tr '[:upper:]' '[:lower:]' 05:03:46 + OS_FAMILY=debian 05:03:46 + workspace=/w/workspace/transportpce-tox-verify-transportpce-master 05:03:46 + START_PACKAGES=/tmp/packages_start.txt 05:03:46 + END_PACKAGES=/tmp/packages_end.txt 05:03:46 + DIFF_PACKAGES=/tmp/packages_diff.txt 05:03:46 + PACKAGES=/tmp/packages_start.txt 05:03:46 + '[' /w/workspace/transportpce-tox-verify-transportpce-master ']' 05:03:46 + PACKAGES=/tmp/packages_end.txt 05:03:46 + case "${OS_FAMILY}" in 05:03:46 + dpkg -l 05:03:46 + grep '^ii' 05:03:46 + '[' -f /tmp/packages_start.txt ']' 05:03:46 + '[' -f /tmp/packages_end.txt ']' 05:03:46 + diff /tmp/packages_start.txt /tmp/packages_end.txt 05:03:46 + '[' /w/workspace/transportpce-tox-verify-transportpce-master ']' 05:03:46 + mkdir -p /w/workspace/transportpce-tox-verify-transportpce-master/archives/ 05:03:46 + cp -f /tmp/packages_diff.txt /tmp/packages_end.txt /tmp/packages_start.txt /w/workspace/transportpce-tox-verify-transportpce-master/archives/ 05:03:46 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins9577440018918226452.sh 05:03:46 ---> capture-instance-metadata.sh 05:03:46 Setup pyenv: 05:03:46 system 05:03:46 3.8.20 05:03:46 3.9.20 05:03:46 3.10.15 05:03:46 * 3.11.10 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 05:03:46 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-z9Lp from file:/tmp/.os_lf_venv 05:03:46 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 05:03:46 lf-activate-venv(): INFO: Attempting to install with network-safe options... 05:03:49 lf-activate-venv(): INFO: Base packages installed successfully 05:03:49 lf-activate-venv(): INFO: Installing additional packages: lftools 05:03:58 lf-activate-venv(): INFO: Adding /tmp/venv-z9Lp/bin to PATH 05:03:59 INFO: Running in OpenStack, capturing instance metadata 05:03:59 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins14314181207449588537.sh 05:03:59 provisioning config files... 05:03:59 Could not find credentials [logs] for transportpce-tox-verify-transportpce-master #4501 05:03:59 copy managed file [jenkins-log-archives-settings] to file:/w/workspace/transportpce-tox-verify-transportpce-master@tmp/config17902647920880222928tmp 05:03:59 Regular expression run condition: Expression=[^.*logs-s3.*], Label=[odl-logs-s3-cloudfront-index] 05:03:59 Run condition [Regular expression match] enabling perform for step [Provide Configuration files] 05:03:59 provisioning config files... 05:04:00 copy managed file [jenkins-s3-log-ship] to file:/home/jenkins/.aws/credentials 05:04:00 [EnvInject] - Injecting environment variables from a build step. 05:04:00 [EnvInject] - Injecting as environment variables the properties content 05:04:00 SERVER_ID=logs 05:04:00 05:04:00 [EnvInject] - Variables injected successfully. 05:04:00 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins6596220139260608322.sh 05:04:00 ---> create-netrc.sh 05:04:00 WARN: Log server credential not found. 05:04:00 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins3162903259676901967.sh 05:04:00 ---> python-tools-install.sh 05:04:00 Setup pyenv: 05:04:00 system 05:04:00 3.8.20 05:04:00 3.9.20 05:04:00 3.10.15 05:04:00 * 3.11.10 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 05:04:01 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-z9Lp from file:/tmp/.os_lf_venv 05:04:01 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 05:04:01 lf-activate-venv(): INFO: Attempting to install with network-safe options... 05:04:02 lf-activate-venv(): INFO: Base packages installed successfully 05:04:02 lf-activate-venv(): INFO: Installing additional packages: lftools 05:04:12 lf-activate-venv(): INFO: Adding /tmp/venv-z9Lp/bin to PATH 05:04:12 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins466544716753745478.sh 05:04:12 ---> sudo-logs.sh 05:04:12 Archiving 'sudo' log.. 05:04:12 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins12258520799253141786.sh 05:04:12 ---> job-cost.sh 05:04:12 INFO: Activating Python virtual environment... 05:04:12 Setup pyenv: 05:04:12 system 05:04:12 3.8.20 05:04:12 3.9.20 05:04:12 3.10.15 05:04:12 * 3.11.10 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 05:04:12 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-z9Lp from file:/tmp/.os_lf_venv 05:04:12 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 05:04:12 lf-activate-venv(): INFO: Attempting to install with network-safe options... 05:04:14 lf-activate-venv(): INFO: Base packages installed successfully 05:04:14 lf-activate-venv(): INFO: Installing additional packages: zipp==1.1.0 python-openstackclient urllib3~=1.26.15 05:04:21 lf-activate-venv(): INFO: Adding /tmp/venv-z9Lp/bin to PATH 05:04:21 INFO: No stack-cost file found 05:04:21 INFO: Instance uptime: 6885s 05:04:21 INFO: Fetching instance metadata (attempt 1 of 3)... 05:04:21 DEBUG: URL: http://169.254.169.254/latest/meta-data/instance-type 05:04:21 INFO: Successfully fetched instance metadata 05:04:21 INFO: Instance type: v3-standard-4 05:04:21 INFO: Retrieving pricing info for: v3-standard-4 05:04:21 INFO: Fetching Vexxhost pricing API (attempt 1 of 3)... 05:04:21 DEBUG: URL: https://pricing.vexxhost.net/v1/pricing/v3-standard-4/cost?seconds=6885 05:04:21 INFO: Successfully fetched Vexxhost pricing API 05:04:21 INFO: Retrieved cost: 0.22 05:04:22 INFO: Retrieved resource: v3-standard-4 05:04:22 INFO: Creating archive directory: /w/workspace/transportpce-tox-verify-transportpce-master/archives/cost 05:04:22 INFO: Archiving costs to: /w/workspace/transportpce-tox-verify-transportpce-master/archives/cost.csv 05:04:22 INFO: Successfully archived job cost data 05:04:22 DEBUG: Cost data: transportpce-tox-verify-transportpce-master,4501,2026-03-05 05:04:22,v3-standard-4,6885,0.22,0.00,FAILURE 05:04:22 [transportpce-tox-verify-transportpce-master] $ /bin/bash -l /tmp/jenkins15198384943159284453.sh 05:04:22 ---> logs-deploy.sh 05:04:22 Setup pyenv: 05:04:22 system 05:04:22 3.8.20 05:04:22 3.9.20 05:04:22 3.10.15 05:04:22 * 3.11.10 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 05:04:22 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-z9Lp from file:/tmp/.os_lf_venv 05:04:22 lf-activate-venv(): INFO: Installing base packages (pip, setuptools, virtualenv) 05:04:22 lf-activate-venv(): INFO: Attempting to install with network-safe options... 05:04:24 lf-activate-venv(): INFO: Base packages installed successfully 05:04:24 lf-activate-venv(): INFO: Installing additional packages: lftools urllib3~=1.26.15 05:04:33 lf-activate-venv(): INFO: Adding /tmp/venv-z9Lp/bin to PATH 05:04:33 WARNING: Nexus logging server not set 05:04:33 INFO: S3 path logs/releng/vex-yul-odl-jenkins-1/transportpce-tox-verify-transportpce-master/4501/ 05:04:33 INFO: archiving logs to S3 05:04:33 /tmp/venv-z9Lp/lib/python3.11/site-packages/requests/__init__.py:113: RequestsDependencyWarning: urllib3 (1.26.20) or chardet (7.0.1)/charset_normalizer (3.4.4) doesn't match a supported version! 05:04:33 warnings.warn( 05:04:35 ---> uname -a: 05:04:35 Linux prd-ubuntu2204-docker-4c-16g-38770 5.15.0-171-generic #181-Ubuntu SMP Fri Feb 6 22:44:50 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux 05:04:35 05:04:35 05:04:35 ---> lscpu: 05:04:35 Architecture: x86_64 05:04:35 CPU op-mode(s): 32-bit, 64-bit 05:04:35 Address sizes: 40 bits physical, 48 bits virtual 05:04:35 Byte Order: Little Endian 05:04:35 CPU(s): 4 05:04:35 On-line CPU(s) list: 0-3 05:04:35 Vendor ID: AuthenticAMD 05:04:35 Model name: AMD EPYC-Rome Processor 05:04:35 CPU family: 23 05:04:35 Model: 49 05:04:35 Thread(s) per core: 1 05:04:35 Core(s) per socket: 1 05:04:35 Socket(s): 4 05:04:35 Stepping: 0 05:04:35 BogoMIPS: 5599.99 05:04:35 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 05:04:35 Virtualization: AMD-V 05:04:35 Hypervisor vendor: KVM 05:04:35 Virtualization type: full 05:04:35 L1d cache: 128 KiB (4 instances) 05:04:35 L1i cache: 128 KiB (4 instances) 05:04:35 L2 cache: 2 MiB (4 instances) 05:04:35 L3 cache: 64 MiB (4 instances) 05:04:35 NUMA node(s): 1 05:04:35 NUMA node0 CPU(s): 0-3 05:04:35 Vulnerability Gather data sampling: Not affected 05:04:35 Vulnerability Indirect target selection: Not affected 05:04:35 Vulnerability Itlb multihit: Not affected 05:04:35 Vulnerability L1tf: Not affected 05:04:35 Vulnerability Mds: Not affected 05:04:35 Vulnerability Meltdown: Not affected 05:04:35 Vulnerability Mmio stale data: Not affected 05:04:35 Vulnerability Reg file data sampling: Not affected 05:04:35 Vulnerability Retbleed: Mitigation; untrained return thunk; SMT disabled 05:04:35 Vulnerability Spec rstack overflow: Mitigation; SMT disabled 05:04:35 Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp 05:04:35 Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization 05:04:35 Vulnerability Spectre v2: Mitigation; Retpolines; IBPB conditional; STIBP disabled; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected 05:04:35 Vulnerability Srbds: Not affected 05:04:35 Vulnerability Tsa: Not affected 05:04:35 Vulnerability Tsx async abort: Not affected 05:04:35 Vulnerability Vmscape: Not affected 05:04:35 05:04:35 05:04:35 ---> nproc: 05:04:35 4 05:04:35 05:04:35 05:04:35 ---> df -h: 05:04:35 Filesystem Size Used Avail Use% Mounted on 05:04:35 tmpfs 1.6G 1.1M 1.6G 1% /run 05:04:35 /dev/vda1 78G 18G 61G 22% / 05:04:35 tmpfs 7.9G 0 7.9G 0% /dev/shm 05:04:35 tmpfs 5.0M 0 5.0M 0% /run/lock 05:04:35 /dev/vda15 105M 6.1M 99M 6% /boot/efi 05:04:35 tmpfs 1.6G 4.0K 1.6G 1% /run/user/1001 05:04:35 05:04:35 05:04:35 ---> free -m: 05:04:35 total used free shared buff/cache available 05:04:35 Mem: 15989 698 11528 3 3763 14948 05:04:35 Swap: 1023 3 1020 05:04:35 05:04:35 05:04:35 ---> ip addr: 05:04:35 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 05:04:35 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 05:04:35 inet 127.0.0.1/8 scope host lo 05:04:35 valid_lft forever preferred_lft forever 05:04:35 inet6 ::1/128 scope host 05:04:35 valid_lft forever preferred_lft forever 05:04:35 2: ens3: mtu 1458 qdisc mq state UP group default qlen 1000 05:04:35 link/ether fa:16:3e:c8:75:86 brd ff:ff:ff:ff:ff:ff 05:04:35 altname enp0s3 05:04:35 inet 10.30.170.14/23 metric 100 brd 10.30.171.255 scope global dynamic ens3 05:04:35 valid_lft 79508sec preferred_lft 79508sec 05:04:35 inet6 fe80::f816:3eff:fec8:7586/64 scope link 05:04:35 valid_lft forever preferred_lft forever 05:04:35 3: docker0: mtu 1458 qdisc noqueue state DOWN group default 05:04:35 link/ether 52:76:14:99:56:ab brd ff:ff:ff:ff:ff:ff 05:04:35 inet 10.250.0.254/24 brd 10.250.0.255 scope global docker0 05:04:35 valid_lft forever preferred_lft forever 05:04:35 05:04:35 05:04:35 ---> sar -b -r -n DEV: 05:04:35 Linux 5.15.0-171-generic (prd-ubuntu2204-docker-4c-16g-38770) 03/05/26 _x86_64_ (4 CPU) 05:04:35 05:04:35 03:09:47 LINUX RESTART (4 CPU) 05:04:35 05:04:35 03:10:00 tps rtps wtps dtps bread/s bwrtn/s bdscd/s 05:04:35 03:20:03 142.46 12.17 124.34 5.95 1523.18 39080.46 10636.50 05:04:35 03:30:05 35.41 4.16 29.41 1.84 154.83 3556.80 1422.56 05:04:35 03:40:20 7.49 0.23 6.90 0.36 13.09 204.85 593.69 05:04:35 03:50:05 28.52 2.36 9.93 16.23 118.55 510.41 220179.18 05:04:35 04:00:16 13.96 0.13 13.30 0.53 2.99 400.62 365.53 05:04:35 04:10:20 12.23 0.01 11.73 0.49 0.74 363.57 347.06 05:04:35 04:20:20 5.12 0.02 4.91 0.19 0.55 140.55 54.57 05:04:35 04:30:00 6.13 0.01 5.96 0.16 1.09 161.65 227.11 05:04:35 04:40:20 5.35 0.00 5.17 0.18 0.30 152.05 62.46 05:04:35 04:50:20 8.16 0.01 7.84 0.31 0.33 452.07 96.96 05:04:35 05:00:20 9.00 0.07 8.56 0.37 2.40 376.60 665.47 05:04:35 Average: 24.88 1.74 20.76 2.38 165.39 4136.83 20756.10 05:04:35 05:04:35 03:10:00 kbmemfree kbavail kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty 05:04:35 03:20:03 2240016 12771156 3151616 19.25 252820 10043980 3866392 22.19 1970240 11367336 226808 05:04:35 03:30:05 8666716 11191552 4749032 29.01 253960 2305296 5423696 31.13 1812200 5385876 192 05:04:35 03:40:20 7604408 10146200 5794992 35.39 255376 2320640 6820260 39.15 1826652 6433328 380 05:04:35 03:50:05 9812188 12489220 3452716 21.09 263456 2447780 4283332 24.59 1848840 4198052 1752 05:04:35 04:00:16 12577928 15323488 619584 3.78 265352 2514416 1312056 7.53 1872064 1420912 12088 05:04:35 04:10:20 8671780 11459640 4481500 27.37 267264 2554836 5154364 29.59 1875676 5314044 428 05:04:35 04:20:20 8464012 11271068 4670048 28.52 268004 2573328 5308172 30.47 1877292 5523668 232 05:04:35 04:30:00 7190772 10018160 5922220 36.17 268776 2592892 6616820 37.98 1879704 6781776 52 05:04:35 04:40:20 7192248 10042188 5898104 36.02 269560 2614648 6632424 38.07 1883200 6777716 124 05:04:35 04:50:20 9286432 12255576 3686288 22.51 273392 2729128 4894400 28.09 1913924 4669168 22876 05:04:35 05:00:20 7915532 10935628 5005480 30.57 274288 2779116 5824816 33.43 1933608 6010888 308 05:04:35 Average: 8147457 11627625 4311962 26.34 264750 3225096 5103339 29.29 1881218 5807524 24113 05:04:35 05:04:35 03:10:00 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil 05:04:35 03:20:03 lo 10.87 10.87 7.17 7.17 0.00 0.00 0.00 0.00 05:04:35 03:20:03 ens3 150.40 111.45 2074.15 16.38 0.00 0.00 0.00 0.00 05:04:35 03:20:03 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 05:04:35 03:30:05 lo 24.53 24.53 18.15 18.15 0.00 0.00 0.00 0.00 05:04:35 03:30:05 ens3 1.76 1.25 0.37 1.23 0.00 0.00 0.00 0.00 05:04:35 03:30:05 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 05:04:35 03:40:20 lo 9.66 9.66 5.26 5.26 0.00 0.00 0.00 0.00 05:04:35 03:40:20 ens3 0.55 0.44 0.12 0.09 0.00 0.00 0.00 0.00 05:04:35 03:40:20 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 05:04:35 03:50:05 lo 11.17 11.17 5.81 5.81 0.00 0.00 0.00 0.00 05:04:35 03:50:05 ens3 0.61 0.50 0.17 0.13 0.00 0.00 0.00 0.00 05:04:35 03:50:05 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 05:04:35 04:00:16 lo 9.15 9.15 4.47 4.47 0.00 0.00 0.00 0.00 05:04:35 04:00:16 ens3 0.81 0.74 0.16 0.82 0.00 0.00 0.00 0.00 05:04:35 04:00:16 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 05:04:35 04:10:20 lo 18.67 18.67 10.31 10.31 0.00 0.00 0.00 0.00 05:04:35 04:10:20 ens3 0.82 0.76 0.19 0.32 0.00 0.00 0.00 0.00 05:04:35 04:10:20 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 05:04:35 04:20:20 lo 24.35 24.35 9.08 9.08 0.00 0.00 0.00 0.00 05:04:35 04:20:20 ens3 0.55 0.48 0.12 0.09 0.00 0.00 0.00 0.00 05:04:35 04:20:20 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 05:04:35 04:30:00 lo 17.95 17.95 8.40 8.40 0.00 0.00 0.00 0.00 05:04:35 04:30:00 ens3 0.45 0.36 0.09 0.07 0.00 0.00 0.00 0.00 05:04:35 04:30:00 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 05:04:35 04:40:20 lo 18.06 18.06 10.11 10.11 0.00 0.00 0.00 0.00 05:04:35 04:40:20 ens3 0.65 0.58 0.15 0.12 0.00 0.00 0.00 0.00 05:04:35 04:40:20 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 05:04:35 04:50:20 lo 10.66 10.66 5.51 5.51 0.00 0.00 0.00 0.00 05:04:35 04:50:20 ens3 0.78 0.61 0.25 0.19 0.00 0.00 0.00 0.00 05:04:35 04:50:20 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 05:04:35 05:00:20 lo 24.55 24.55 12.08 12.08 0.00 0.00 0.00 0.00 05:04:35 05:00:20 ens3 0.94 0.75 0.24 0.19 0.00 0.00 0.00 0.00 05:04:35 05:00:20 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 05:04:35 Average: lo 16.32 16.32 8.76 8.76 0.00 0.00 0.00 0.00 05:04:35 Average: ens3 14.43 10.75 189.27 1.79 0.00 0.00 0.00 0.00 05:04:35 Average: docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 05:04:35 05:04:35 05:04:35 ---> sar -P ALL: 05:04:35 Linux 5.15.0-171-generic (prd-ubuntu2204-docker-4c-16g-38770) 03/05/26 _x86_64_ (4 CPU) 05:04:35 05:04:35 03:09:47 LINUX RESTART (4 CPU) 05:04:35 05:04:35 03:10:00 CPU %user %nice %system %iowait %steal %idle 05:04:35 03:20:03 all 49.84 0.00 2.89 2.75 0.12 44.40 05:04:35 03:20:03 0 50.88 0.00 2.84 3.42 0.12 42.74 05:04:35 03:20:03 1 49.24 0.00 3.01 2.14 0.12 45.49 05:04:35 03:20:03 2 49.57 0.00 3.00 2.73 0.12 44.58 05:04:35 03:20:03 3 49.67 0.00 2.71 2.70 0.12 44.80 05:04:35 03:30:05 all 35.00 0.00 1.43 0.08 0.11 63.38 05:04:35 03:30:05 0 35.33 0.00 1.36 0.06 0.11 63.15 05:04:35 03:30:05 1 35.57 0.00 1.44 0.04 0.11 62.84 05:04:35 03:30:05 2 34.25 0.00 1.55 0.05 0.11 64.03 05:04:35 03:30:05 3 34.85 0.00 1.37 0.16 0.11 63.50 05:04:35 03:40:20 all 14.04 0.00 0.57 0.04 0.10 85.25 05:04:35 03:40:20 0 13.86 0.00 0.58 0.07 0.10 85.40 05:04:35 03:40:20 1 14.18 0.00 0.50 0.04 0.11 85.18 05:04:35 03:40:20 2 14.17 0.00 0.55 0.01 0.10 85.16 05:04:35 03:40:20 3 13.96 0.00 0.66 0.02 0.10 85.26 05:04:35 03:50:05 all 15.11 0.00 0.63 0.07 0.11 84.08 05:04:35 03:50:05 0 13.80 0.00 0.62 0.03 0.10 85.44 05:04:35 03:50:05 1 15.32 0.00 0.52 0.05 0.11 83.99 05:04:35 03:50:05 2 16.11 0.00 0.75 0.12 0.12 82.89 05:04:35 03:50:05 3 15.22 0.00 0.63 0.06 0.11 83.99 05:04:35 04:00:16 all 19.47 0.00 0.70 0.09 0.10 79.65 05:04:35 04:00:16 0 19.21 0.00 0.73 0.03 0.09 79.94 05:04:35 04:00:16 1 19.40 0.00 0.65 0.07 0.11 79.76 05:04:35 04:00:16 2 19.24 0.00 0.65 0.14 0.11 79.87 05:04:35 04:00:16 3 20.01 0.00 0.76 0.12 0.10 79.01 05:04:35 04:10:20 all 20.05 0.00 0.65 0.05 0.12 79.14 05:04:35 04:10:20 0 19.82 0.00 0.64 0.04 0.12 79.38 05:04:35 04:10:20 1 20.71 0.00 0.55 0.11 0.12 78.51 05:04:35 04:10:20 2 19.98 0.00 0.68 0.02 0.12 79.20 05:04:35 04:10:20 3 19.67 0.00 0.71 0.04 0.11 79.47 05:04:35 04:20:20 all 7.88 0.00 0.32 0.03 0.11 91.66 05:04:35 04:20:20 0 7.60 0.00 0.37 0.08 0.11 91.85 05:04:35 04:20:20 1 7.91 0.00 0.33 0.02 0.11 91.63 05:04:35 04:20:20 2 8.14 0.00 0.28 0.01 0.10 91.46 05:04:35 04:20:20 3 7.86 0.00 0.31 0.01 0.12 91.70 05:04:35 04:30:00 all 9.54 0.00 0.42 0.03 0.11 89.90 05:04:35 04:30:00 0 8.89 0.00 0.40 0.02 0.11 90.57 05:04:35 04:30:00 1 9.65 0.00 0.45 0.03 0.12 89.75 05:04:35 04:30:00 2 10.17 0.00 0.48 0.06 0.11 89.17 05:04:35 04:30:00 3 9.43 0.00 0.35 0.01 0.11 90.11 05:04:35 04:40:20 all 9.27 0.00 0.52 0.03 0.12 90.06 05:04:35 04:40:20 0 9.11 0.00 0.47 0.05 0.12 90.25 05:04:35 04:40:20 1 9.51 0.00 0.51 0.01 0.12 89.85 05:04:35 04:40:20 2 9.18 0.00 0.61 0.03 0.12 90.06 05:04:35 04:40:20 3 9.29 0.00 0.49 0.02 0.11 90.09 05:04:35 04:50:20 all 10.75 0.00 0.59 0.06 0.11 88.48 05:04:35 04:50:20 0 11.60 0.00 0.73 0.06 0.11 87.50 05:04:35 04:50:20 1 10.54 0.00 0.57 0.02 0.11 88.76 05:04:35 04:50:20 2 10.52 0.00 0.56 0.15 0.13 88.65 05:04:35 04:50:20 3 10.35 0.00 0.52 0.02 0.11 89.00 05:04:35 05:00:20 all 15.93 0.00 0.60 0.07 0.10 83.30 05:04:35 05:00:20 0 15.89 0.00 0.57 0.02 0.11 83.42 05:04:35 05:00:20 1 16.01 0.00 0.66 0.11 0.10 83.12 05:04:35 05:00:20 2 16.18 0.00 0.63 0.12 0.11 82.96 05:04:35 05:00:20 3 15.65 0.00 0.53 0.04 0.10 83.68 05:04:35 05:04:35 Average: CPU %user %nice %system %iowait %steal %idle 05:04:35 Average: all 18.82 0.00 0.85 0.30 0.11 79.92 05:04:35 Average: 0 18.75 0.00 0.85 0.35 0.11 79.94 05:04:35 Average: 1 18.93 0.00 0.84 0.24 0.11 79.88 05:04:35 Average: 2 18.87 0.00 0.89 0.31 0.11 79.82 05:04:35 Average: 3 18.74 0.00 0.82 0.29 0.11 80.04 05:04:35 05:04:35 05:04:35